project02 - The second knockdown
A basic Flutter project showcasing the use of Scaffolding and adding custom colors
This app focuses on adding Scaffolding and custom colors features of Flutter by following these steps:
project02 > lib > main.dart
final appBarColor = const Color(0xFFd2527f);Declaring a custom
Colorfor our AppBar. We use
finalas we don't want the value of
appBarColorto change anyhere throughout the app. Same goes for the use of
const. Flutter uses 32-bit ARGB value i.e. Alpha Red Green Blue for colors. Every color value begins with
0x?), next comes the opacity to use, we choose
FFor full opaque without any transparency. Next up is our usual hex value of
d2527fwithout any hash (#).
final bgColor = const Color(0xFFe4e9ed);Same goes for the background color for the
backgroundColor: bgColor,We use the declared
Scaffoldto give it a value of
appBar: AppBarWe initialise the
AppBarwhich is basically a material toolbar containing the app's name and/or other elements like logo and other actions (menu).
backgroundColor: appBarColorFinally, we do the same, apply the declared
AppBaras its background color.