-
Hi, I was wondering why the clock component isn't being filled with color. Is this correct behavior and do I have to modify the theme manually ? Code:static ThemeData getThemeData(final int color, {final bool isDark = false}) {
return switch (isDark) {
false => FlexThemeData.light(
colorScheme: ColorScheme.fromSeed(seedColor: Color(color)),
appBarElevation: Insets.xxs,
useMaterial3: true,
swapLegacyOnMaterial3: true,
useMaterial3ErrorColors: true,
pageTransitionsTheme: const NoTransitionsOnWeb(),
visualDensity: FlexColorScheme.comfortablePlatformDensity,
),
true => FlexThemeData.dark(
colorScheme: ColorScheme.fromSeed(
seedColor: Color(color),
brightness: Brightness.dark,
),
appBarElevation: Insets.xxs,
useMaterial3: true,
swapLegacyOnMaterial3: true,
useMaterial3ErrorColors: true,
pageTransitionsTheme: const NoTransitionsOnWeb(),
visualDensity: FlexColorScheme.comfortablePlatformDensity,
),
};
} Flutter version: 3.13.4 (stable) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @sabin26, thanks for your question. If you do not enable using sub-themes/component themes in FlexColorScheme, you for most component themes get no additional theming on them other than Flutter SDK component theme defaults.
In the sample above you are not enabling or using FlexColorScheme's component theming features, which means that for the The Flutter SDK default for Material3 The issue has been fixed in the Flutter master channel, but the fix has not landed in latest Flutter stable version (3.13.4). Thus if you do not use FlexColorScheme's opinionated component themes, then you get the Flutter default with this issue, as you noticed and as also demonstrated below with the Themes Playground FCS API configurator: If you enable FlexColorScheme's opinionated component themes, then it automatically also fixes this issue and applies the correct M3 color mapping to the clock dial. As shown below: Fix without FCS component themesIf you do not want to use FlexColorScheme component theming features, you can also use Using your example, e.g.: static ThemeData getThemeData(final int color, {final bool isDark = false}) {
ColorScheme colorScheme = isDark
? ColorScheme.fromSeed(seedColor: Color(color), brightness: Brightness.dark)
: ColorScheme.fromSeed(seedColor: Color(color));
return switch (isDark) {
false => FlexThemeData.light(
colorScheme: colorScheme,
appBarElevation: Insets.xxs,
useMaterial3: true,
swapLegacyOnMaterial3: true,
useMaterial3ErrorColors: true,
pageTransitionsTheme: const NoTransitionsOnWeb(),
visualDensity: FlexColorScheme.comfortablePlatformDensity,
).copyWith(timePickerTheme(dialBackgroundColor: colorScheme.surfaceVariant)),
true => FlexThemeData.dark(
colorScheme: colorScheme,
appBarElevation: Insets.xxs,
useMaterial3: true,
swapLegacyOnMaterial3: true,
useMaterial3ErrorColors: true,
pageTransitionsTheme: const NoTransitionsOnWeb(),
visualDensity: FlexColorScheme.comfortablePlatformDensity,
).copyWith(timePickerTheme(dialBackgroundColor: colorScheme.surfaceVariant)),
};
} Hope this explains this oddity and helps! 😄 FCS component themes has handled this Flutter issue for many Flutter version already. However, when the issue fix in Flutter lands, this color correction is of course no longer needed if you use the default |
Beta Was this translation helpful? Give feedback.
-
I'm closing this issue as answered and also converting it to a Q&A for discussions section so that other users may also find it there if they notice it. If you have more questions we can continue the discussion there 😃 |
Beta Was this translation helpful? Give feedback.
Hi @sabin26, thanks for your question.
If you do not enable using sub-themes/component themes in FlexColorScheme, you for most component themes get no additional theming on them other than Flutter SDK component theme defaults.
In the sample above you are not enabling or using FlexColorScheme's component theming features, which means that for the
TimePicker
you get the Flutter SDK defaul…