Created
January 23, 2026 15:52
-
-
Save fredgrott/c16009a4f060ec7496586cf0e9cdf58f to your computer and use it in GitHub Desktop.
colorscheme extension
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
| // 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