ThemeExtensions allow you to customize all instances of a widget across your entire application. Every MFL Widget with styling properties has a style model which has it's corresponding ThemeExtension that defines default styling values.
How ThemeExtensions work
- Global Scope:
ThemeExtensions are registered in your MyoroApp's theme and apply to all instances of the widget
- Default Values: They provide sensible defaults for all styling properties through the
builder factory
- Theme Integration: They integrate seamlessly with Flutter's theming system
- Overriding: You may pass a
ThemeExtension of an MFL Widget, i.e. MyoroButtonThemeExtension to MyoroAppConfiguration.themeExtensionsBuilder and your ThemeExtension will override said MFL Widgets ThemeExtension to change the styling globally
Example
// Register ThemeExtensions in your app theme
ThemeData(
extensions: [
MyoroButtonThemeExtension.builder(colorScheme),
MyoroCardThemeExtension.builder(colorScheme, textTheme),
// ... other extensions
],
)