Skip to content

Instantly share code, notes, and snippets.

@fredgrott
Created February 19, 2026 19:23
Show Gist options
  • Select an option

  • Save fredgrott/537da4e68da91ecb0a7a3301ccb7165b to your computer and use it in GitHub Desktop.

Select an option

Save fredgrott/537da4e68da91ecb0a7a3301ccb7165b to your computer and use it in GitHub Desktop.
typical m3e theme usage
@override
Widget build(BuildContext context) {
final light = ColorScheme.fromSeed(
seedColor: Colors.purple, brightness: Brightness.light);
final dark = ColorScheme.fromSeed(
seedColor: Colors.purple, brightness: Brightness.dark);
return MaterialApp(
title: 'M3E Gallery',
theme: light.toM3EThemeData(override: M3eOverride(colors: M3ECustomColors.from(light),
brandColors: M3EBrandColors.copyWith(brandOne: brandOne.harmonizeWith(light.primary),
brandTwo: brandTwo.harmonizeWith(light.primary), brandThree: brandThree.harmonizeWWith(light.primary)),
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),
brandColors: M3EBrandColors.copyWith(brandOne: brandOne.harmonizeWith(dark.primary),
brandTwo: brandTwo.harmonizeWith(dark.primary), brandThree: brandThree.harmonizeWith(dark.primary)),
typography: M3ECustomTypography(base: CustomTextTheme, emphasized: MyM3ECustomEmphasized ),
shapes: M3ECustomShapes.expressive(),
spacing: M3ECustomSpacing.regular(),
motion: M3EMotion.expressive()),
base: ThemeDataWithCustomComponentThemes(colorScheme: dark)),
themeMode: _mode,
home: GalleryHome(
isDark: _mode == ThemeMode.dark,
onToggleBrightness: _toggleMode,
),
debugShowCheckedModeBanner: false,
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment