used various widgets like Container, Column, Row, Expanded, etc to develop a stateful Dice app.
- it adjusts it's child a/c to the screen size.
- it's
flex
property will divide the children into ratio
Image.asset('images/name.png')
- FlatButton => TextButton()
- RaisedButton => ElevatedButton()
- using
CircleAvatar()
widget
CircleAvatar(
radius: 50,
child: Text('My Avatar'),
)
- using
borderRadius:
property of Container widget
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
),
)
- Using
shape: BoxShape.circle
property
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
),
)
- Using the
CustomPaint
CustomPaint(
painter: CirclePainter(),
)
-
whatever will change, is coded inside the
State
part of the stateful widget -
State part tracks and updates the screen as the state changes
-
setState((){})
marks certain things dirty
for eg: leftDice is getting changed inside setState(), so setState() will mark every part, wherever leftDice is used, as DIRTY
-
setState((){})
triggers/calls the build method and tells it that state has changed -
whenever hot reload is done, the
build()
method is called and it re-builds only those parts that are marked as DIRTY -
Hot reload
is a feature of Flutter that allows to see the changes in code without having to rebuild the app. When a change is made to astateful widget
, thedirty
flag will be set and thebuild()
method will be called. This will cause the widget to be rebuilt and the changes will be reflected in the app.
Run any Flutter repository on Zapp website: refer this link
List of all Flutter apps: click here