Icons
body: Center( //LOCATED IN THE MIDDLE
child: Icon(
Icons.add_circle_outline
),
),
In body, we insert a widget called Icon with the shapeadd_circle_outline.
(Different Icon Shape can be checked here.)
We can add different properties as well. (colors, size, etc.)
child: Icon(
Icons.add_circle_outline,
color: Colors.red,
size: 50.0,
body: Center( //LOCATED IN THE MIDDLE
child: RaisedButton(
onPressed: (){},
child: Text('click me'),
color: Colors.lightBlue,
),
),
It’s important to include onPressed: (){} even it doesn’t have any function, or else an error will occur.
We can insert some action in the parenthesis{} in onPressed: to add some functionality. In this example, we print a string ‘You clicked me!’ whenever the button was clicked.
body: Center( //LOCATED IN THE MIDDLE
child: RaisedButton(
onPressed: (){
print('you clicked me!');
},
child: Text('click me'),
color: Colors.lightBlue,
),
),