Bump m3e_design to 0.2.1; add .toM3EThemeData() extension for simplified theme creation, update documentation, and refactor BuildContext extension for fallback handling.
This commit is contained in:
parent
eef97c0938
commit
c6e843f238
5 changed files with 88 additions and 20 deletions
|
|
@ -110,3 +110,21 @@ extension M3EThemeAccessors on ThemeData {
|
|||
return e ?? M3ETheme.defaults(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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue