Monday, April 26, 2021

Applying themes

 flutter themes: flutter.dev/docs/cookbook/design/themes

cook books: flutter.dev/docs/cookbook/



to convert default themes to default dark theme:


ThemeData class: https://api.flutter.dev/flutter/material/ThemeData-class.html


In the material app,

theme: ThemeData.dark(),//default is light()


custom theme:

theme: ThemeData(

 primaryColor: Colors.red, //top menu color.

 accentColor: Colors.purple, // sub items color,like floating action button.

 scaffoldBackgroundColor: Color(0xFF0A0E21),

 textTheme: TextTheme(body1: TextStyle(color: Colors.white))

),


Can grab hex code values of a color using the chrome extention: colorzilla.com, it is a color picker

With the hex value picked, it is only RGB valeu, but opacity won't be shown, to get that we need to mention in ARGB format.

So change from #0A0E21 to 0xFF0A0E21 ,0xFF(fully opaque)


we can extend a current theme:
theme: ThemeData.dark().copyWith(
 ThemeData()
 ------
---------
,
),


we can apply theme just for a widget, we can wrap it in a ThemeWidget.:
floatingActionButton: Theme(
 data: ThemeData.light(),
 child: 
),

No comments:

Post a Comment