options property

AppThemeOptions? options
final

Passed options object. Use this object to pass additional data that should be associated with the theme.

eg: If font color on a specific button changes create a class to encapsulate the value.

class MyThemeOptions implements AppThemeOptions{
  final Color specificButtonColor;
  ThemeOptions(this.specificButtonColor);
}

Then provide the options with the theme.

themes: [
  AppTheme(
    data: ThemeData.light(),
    options: MyThemeOptions(Colors.blue),
  ),
  AppTheme(
    data: ThemeData.dark(),
    options: MyThemeOptions(Colors.red),
  ),
]

Then the option can be retrieved as ThemeProvider.optionsOf<MyThemeOptions>(context).specificButtonColor.

Implementation

final AppThemeOptions? options;