Complete the code to set the primary color of the app's color scheme to blue.
final colorScheme = ColorScheme.fromSeed(seedColor: Colors.[1]);The seedColor defines the main color for the ColorScheme. Using Colors.blue sets the primary color to blue.
Complete the code to apply the color scheme to the MaterialApp theme.
MaterialApp(
theme: ThemeData(
colorScheme: [1],
),
home: const HomePage(),
);The colorScheme variable holds the color scheme object. It should be passed to ThemeData.colorScheme to apply it.
Fix the error in the code to correctly create a dark color scheme from a seed color.
final darkScheme = ColorScheme.fromSeed(
seedColor: Colors.deepPurple,
brightness: [1],
);To create a dark color scheme, set brightness to Brightness.dark. Other options are incorrect types or values.
Fill both blanks to create a color scheme with a custom primary and secondary color.
final customScheme = ColorScheme( brightness: Brightness.light, primary: [1], secondary: [2], background: Colors.white, surface: Colors.white, onPrimary: Colors.white, onSecondary: Colors.black, onBackground: Colors.black, onSurface: Colors.black, error: Colors.red, onError: Colors.white, );
The primary color is set to Colors.orange and the secondary color to Colors.teal to create a custom color scheme.
Fill all three blanks to create a color scheme from a seed color with dark brightness and set the error color.
final darkCustomScheme = ColorScheme.fromSeed( seedColor: [1], brightness: [2], ).copyWith( error: [3], );
The seed color is set to Colors.blueGrey, brightness to Brightness.dark, and the error color overridden to Colors.redAccent.