Flutter Widgets 1
Flutter Widgets 1
D. Gichuki,
Widget
new Text(
'Hello, Skillologies!',
textAlign: TextAlign.center,
style: new TextStyle(fontWeight: FontWeight.bold),
)
Visible Widget
//FlatButton Example
new FlatButton(
child: Text("Click here"),
onPressed: () {
// Do something here
},
),
Visible Widget
//RaisedButton Example
new RaisedButton(
child: Text("Click here"),
elevation: 5.0,
onPressed: () {
// Do something here
},
),
Image
new Icon(
Icons.add,
size: 34.0,
)
Invisible Widget
new Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
new Text(
"VegElement",
),
new Text(
"Non-vegElement"
),
],
),
Invisible Widget
• Center: This widget is used to center the child widget, which comes inside it. All the
previous examples contain inside the center widget.
Center(
child: new clumn(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
new Text(
"VegElement",
),
new Text(
"Non-vegElement"
),
],
),
),
Invisible Widget
• Scaffold
– This widget provides a framework that allows
you to add common material design elements
like AppBar, Floating Action Buttons,
Drawers, etc.
• Stack
– It is an essential widget, which is mainly used
for overlapping a widget, such as a button on
a background gradient.
StatefulWidget