0
0
Fluttermobile~20 mins

Color schemes in Flutter - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Color Scheme Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
ui_behavior
intermediate
1:30remaining
What color will the text display?
Given this Flutter code snippet, what color will the text "Hello" appear on the screen?
Flutter
MaterialApp(
  theme: ThemeData(
    colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
  ),
  home: Scaffold(
    body: Builder(
      builder: (context) => Center(
        child: Text('Hello', style: TextStyle(color: Theme.of(context).colorScheme.primary)),
      ),
    ),
  ),
)
AWhite color
BBlack color
CRed color
DA shade of blue derived from the seed color
Attempts:
2 left
💡 Hint
The colorScheme.primary uses the seed color to generate its primary color.
🧠 Conceptual
intermediate
1:00remaining
What does ColorScheme.brightness control?
In Flutter's ColorScheme, what is the role of the brightness property?
AIt sets the saturation level of the colors
BIt controls the transparency of all colors in the scheme
CIt defines whether the color scheme is light or dark, affecting default background and text colors
DIt determines the font size used in the app
Attempts:
2 left
💡 Hint
Think about how apps switch between light and dark modes.
📝 Syntax
advanced
1:30remaining
Which code correctly creates a dark ColorScheme with a custom primary color?
Select the Flutter code snippet that correctly creates a dark ColorScheme with a primary color of deep purple.
AColorScheme.dark(primary: Colors.deepPurple)
BColorScheme.dark(primaryColor: Colors.deepPurple)
CColorScheme.dark(primary: Color.deepPurple)
DColorScheme.dark(primaryColor: Color(0xFF673AB7))
Attempts:
2 left
💡 Hint
Check the exact property name used in ColorScheme.
lifecycle
advanced
1:30remaining
When does Flutter apply a new ColorScheme after theme change?
If you update the ColorScheme in ThemeData dynamically, when does Flutter apply the new colors to the UI?
AOnly when the user navigates to a new screen
BImmediately on the next frame after setState triggers rebuild
CAfter a delay of 5 seconds automatically
DOnly after restarting the app
Attempts:
2 left
💡 Hint
Think about how Flutter rebuilds widgets after state changes.
🔧 Debug
expert
2:00remaining
Why does this app show default colors ignoring custom ColorScheme?
This Flutter app uses ThemeData with a custom ColorScheme, but the UI still shows default colors. What is the most likely cause?
Flutter
MaterialApp(
  theme: ThemeData(
    colorScheme: ColorScheme.light(primary: Colors.orange),
  ),
  home: Scaffold(
    appBar: AppBar(title: Text('Test')),
    body: Center(child: Text('Hello')),
  ),
)
AAppBar uses its own default color because it does not use the colorScheme by default
BColorScheme.light is invalid and ignored
CText widget ignores theme colors by default
DMaterialApp requires a dark theme to apply custom colors
Attempts:
2 left
💡 Hint
Check how AppBar gets its colors from the theme.