While defining ThemeData
of the Flutter app, we can define colorScheme
property.
This property has inner-properties such as background
& onBackground
, primary
& onPrimary
, secondary
& onSecondary
, etc. Also, all these properties are set as required
.
static final ThemeData lightTheme = ThemeData(
colorScheme: ColorScheme(
background: appBackgroundColor,
brightness: Brightness.light,
error: Colors.white,
onBackground: primaryColor,
onError: null,
onPrimary: null,
onSecondary: null,
onSurface: null,
primary: null,
secondary: secondaryColor,
surface: null,
),
);
I tried referring the documentation of Flutter but I was not quite able to understand the difference between them.