Skip to content

Instantly share code, notes, and snippets.

@fredgrott
Created November 12, 2025 19:11
Show Gist options
  • Select an option

  • Save fredgrott/1f2e39321a7d53434530f6c750b8c1c4 to your computer and use it in GitHub Desktop.

Select an option

Save fredgrott/1f2e39321a7d53434530f6c750b8c1c4 to your computer and use it in GitHub Desktop.
m3e theme extension on colorscheme
// Convenience creation helpers to install M3ETheme with minimal boilerplate.
extension M3EColorSchemeAccessors on ColorScheme {
/// Creates a ThemeData from this ColorScheme and installs the M3ETheme
/// extension in one call.
///
/// Example:
/// final theme = ColorScheme.fromSeed(seedColor: Colors.teal).toM3EThemeData();
ThemeData toM3EThemeData({
bool useMaterial3 = true,
M3ETheme? override,
ThemeData? base,
}) {
final ThemeData seed =
base ?? ThemeData(useMaterial3: useMaterial3, colorScheme: this);
return withM3ETheme(seed, override: override);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment