Reputation: 764
I am very confused to set the color scheme in my Flutter app properly. Please help me in understanding what actually these things i.e surface, background, secondary, and all others mean.
ThemeData(
fontFamily: 'Poppins',
primaryColor: MyColors.amberPrimary,
colorScheme: const ColorScheme(
primary: MyColors.amberPrimary,
onPrimary: Colors.white,
secondary: Colors.white,
onSecondary: MyColors.amberPrimary,
surface: Colors.white,
onSurface: MyColors.titleFontColor,
background: Colors.white,
onBackground: MyColors.titleFontColor,
brightness: Brightness.light,
error: Colors.red,
onError: Colors.white,
),
Please elaborate these parameters.
Upvotes: 0
Views: 274
Reputation: 1
as my understanding themedata class contains colorscheme and when you press ctrl and put your mouse pointer in the colorscheme there are some properties in required(you need to use them because they are required otherwise it will through error). and at conclusion themedata can help you to create your own custom theme and colorscheme helps more
example:
ThemeData darkTheme(BuildContext context) => ThemeData(
brightness: Brightness.dark,
fontFamily: GoogleFonts.poppins().fontFamily,
cardColor: Colors.black,
canvasColor: darkCreamColor,
colorScheme: ColorScheme(
brightness: Brightness.dark,background:
),
appBarTheme: AppBarTheme(
color: Colors.black,
elevation: 0.0,
iconTheme: const IconThemeData(color: Colors.white),
titleTextStyle: Theme.of(context).textTheme.copyWith(
titleLarge:
context.textTheme.titleLarge.copyWith(color: Colors.white),
),
));
Upvotes: 0
Reputation: 3348
Please refer to dart's official documentation so that you can understand the latest updated use of these parameters. You can check here
Upvotes: 0
Reputation: 44081
The names are defined by the standard terminology of the "Material Design". You can read more about this at the core website http://material.io, specifically at https://material.io/design/color/the-color-system.html#color-theme-creation.
Upvotes: 2