0
0
Fluttermobile~10 mins

Color schemes in Flutter - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the primary color of the app's color scheme to blue.

Flutter
final colorScheme = ColorScheme.fromSeed(seedColor: Colors.[1]);
Drag options to blanks, or click blank then click option'
Ared
Bblue
Cyellow
Dgreen
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a color other than blue.
Using a color name that does not exist in Colors.
2fill in blank
medium

Complete the code to apply the color scheme to the MaterialApp theme.

Flutter
MaterialApp(
  theme: ThemeData(
    colorScheme: [1],
  ),
  home: const HomePage(),
);
Drag options to blanks, or click blank then click option'
AColors.blue
BThemeData.dark()
CThemeData.light()
DcolorScheme
Attempts:
3 left
💡 Hint
Common Mistakes
Passing a color like Colors.blue instead of the color scheme object.
Using ThemeData.light() or ThemeData.dark() directly.
3fill in blank
hard

Fix the error in the code to correctly create a dark color scheme from a seed color.

Flutter
final darkScheme = ColorScheme.fromSeed(
  seedColor: Colors.deepPurple,
  brightness: [1],
);
Drag options to blanks, or click blank then click option'
ABrightness.dark
BBrightness.light
CThemeMode.dark
DThemeData.dark()
Attempts:
3 left
💡 Hint
Common Mistakes
Using ThemeMode.dark instead of Brightness.dark.
Using ThemeData.dark() which is a ThemeData, not a brightness value.
4fill in blank
hard

Fill both blanks to create a color scheme with a custom primary and secondary color.

Flutter
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,
);
Drag options to blanks, or click blank then click option'
AColors.orange
BColors.green
CColors.purple
DColors.teal
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same color for both primary and secondary.
Choosing colors that do not contrast well.
5fill in blank
hard

Fill all three blanks to create a color scheme from a seed color with dark brightness and set the error color.

Flutter
final darkCustomScheme = ColorScheme.fromSeed(
  seedColor: [1],
  brightness: [2],
).copyWith(
  error: [3],
);
Drag options to blanks, or click blank then click option'
AColors.redAccent
BBrightness.dark
CColors.deepOrange
DColors.blueGrey
Attempts:
3 left
💡 Hint
Common Mistakes
Using a light brightness instead of dark.
Not overriding the error color correctly.