-
Hi Mike! Playground produces ThemeData config that you can copy and… where does it fit? I've spent looking through different examples and in every usage the theme code was modified. theme: FlexThemeData.light(
colors: const FlexSchemeColor(
primary: Color(0xff004881),
primaryContainer: Color(0xffd0e4ff),
____. . .
useMaterial3: true,
// To use the Playground font, add GoogleFonts package and uncomment
// fontFamily: GoogleFonts.notoSans().fontFamily,
),
darkTheme: FlexThemeData.dark(
colors: const FlexSchemeColor(
primary: Color(0xff9fc9ff),
____. . .
navigationRailBackgroundSchemeColor: SchemeColor.surface,
),
visualDensity: FlexColorScheme.comfortablePlatformDensity,
useMaterial3: true,
// To use the Playground font, add GoogleFonts package and uncomment
// fontFamily: GoogleFonts.notoSans().fontFamily,
),
// If you do not have a themeMode switch, uncomment this line
// to let the device system mode control the theme mode:
// themeMode: ThemeMode.system, for example to store it as a class you'll have to change:
to
and also change middle and end. But it looks like ThemeData is formatted that way with some usage in mind. Would it fit as is or not? I am looking if it's possible to actually paste theme into file in automated way, without rewriting methods, etc. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi Roman, Thanks for your question. I'm maybe not 100% sure I fully understand the question, but I will try to answer anyway, and hope that some of my explanations provide the insights you are looking for. The What they do is based on any given config, spit out a Flutter's Additionally, both In early versions of The In most use cases it is more convenient to just use However, you can use it to extract the By using final FlexColorScheme flexScheme = FlexColorScheme.light(...);
final ColorScheme colorScheme = flexScheme.toScheme;
final themeData flexScheme.toTheme.copyWith(toggleButtonsTheme: myToggleTheme(colorScheme)); This is discussed in more detail here: https://rydmike.docs.page/flex_color_scheme_docs/api_guide#use-flexcolorscheme-or-flexthemedata Configuring ThemeData ObjectsWhen it comes to storing and accessing a The last tutorial step, example 5, which is the Themes Playground app itself, this is shown in its https://rydmike.docs.page/flex_color_scheme_docs/tutorial5#materialapp-setup In this case for state management, it uses a controller made with a Flutter As you have seen, the Themes Playground app, not only makes a FlexColorScheme API config for the theme you configure and show it in a some sample demo apps in mock device simulators, the Playground app itself also uses, via Not sure if any of this helped with your question, if not, just ask more 😄 |
Beta Was this translation helpful? Give feedback.
Hi Roman,
Thanks for your question. I'm maybe not 100% sure I fully understand the question, but I will try to answer anyway, and hope that some of my explanations provide the insights you are looking for.
The
FlexThemeData.light()
andFlexThemeData.dark()
are advanced, well at least very involved,ThemeData
object factories.What they do is based on any given config, spit out a
ThemeData.raw
object, which is the actual constructor of the ThemeData data class object. Their input are also put through Flutter'sThemeData()
factory constructor to do so.Flutter's
ThemeData()
is not a direct object constructor, it very much likeFlexThemeData.light/dark()
is also a factory constructor, that d…