Created
January 26, 2026 16:24
-
-
Save fredgrott/0dfcddbb6cff097c4640d9770d8bf730 to your computer and use it in GitHub Desktop.
using M3ETheme, the dynamic color way
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @override | |
| Widget build(BuildContext context) { | |
| return DynamicColorBuilder( | |
| builder: (lightDynamic, darkDynamic){ | |
| final light = lightDynamic ?? ColorScheme.fromSeed(seedColor: Colors.teal); | |
| final dark = darkDynamic ?? | |
| ColorScheme.fromSeed(seedColor: Colors.teal, brightness: Brightness.dark); | |
| return MaterialApp( | |
| theme: light.toM3EThemeData(override: M3eOverride(colors: M3ECustomColors.from(light), | |
| typography: M3ECustomTypography(base: CustomTextTheme, emphasized: MyM3ECustomEmphasized ), | |
| shapes: M3ECustomShapes.expressive(), | |
| spacing: M3ECustomSpacing.regular(), | |
| motion: M3EMotion.expressive()), | |
| base: ThemeDataWithCustomComponentThemes(colorScheme: light) ), | |
| darkTheme: dark.toM3EThemeData(override: M3eOverride(colors: M3ECustomColors(dark), | |
| typography: M3ECustomTypography(base: CustomTextTheme, emphasized: MyM3ECustomEmphasized ), | |
| shapes: M3ECustomShapes.expressive(), | |
| spacing: M3ECustomSpacing.regular(), | |
| motion: M3EMotion.expressive()), | |
| base: ThemeDataWithCustomComponentThemes(colorScheme: dark)), | |
| home: const MyHomePage(), | |
| ); | |
| }, | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment