Widgets : Center, Container, InkWell, Row, Column.

 Aim : Widgets : Center, Container, InkWell, Row, Column.

Center widget

Code :

body: Center(

child: Text('Welcome'),

),


Container widget :

Code:

body: Container(

height: 200,

width: 200,

color: Colors.red,

),


InkWell widget:

Code:

body: InkWell(

child: Container(

width: 200,

height: 200,

color: Colors.orangeAccent,

),

onTap: () {

return print('You clicked on container widget');

},

),


Row:

Code :

body: Row(

children: [

Text('one '),

Text('two '),

Text('three '),

Text('four '),

Text('five '),

Text('six'),

],

),


Column:

Code:

body: Column(

children: [

Text('one '),

Text('two '),

Text('three '),

Text('four '),

Text('five '),

Text('six'),

],

),


Add image in project folder and display it on screen.

Create new folder with name ‘asset’

- Add image with .jpg or .png extension in that folder by dragging it inside the asset folder

- Open pugspec.yaml file and remove the comments of line number 63 and 64 and save file.

   assets:

     -asset/

- In main.dart file inside body, type code for image widget and add path inside image widget.

body: Image.asset('asset/flower.jpg'),

Comments