ThemeConfig constructor

const ThemeConfig({
  1. ThemeMode initialMode = ThemeMode.system,
  2. bool cacheThemeMode = false,
  3. LightThemeData? lightThemeData,
  4. DarkThemeData? darkThemeData,
  5. ScrollBarConfiguration? scrollBarConfiguration,
  6. List<StyleRule> styles = const [],
})

Naki Theme Configuration for defining global light and dark theme customizations.

Theme configuration should occur once at the top-level root component (e.g. inside main() or in the root NakiApp or NakiThemeProvider.fromConfig declaration).

Example: Basic Usage

final _themeConfig = ThemeConfig(
  initialMode: ThemeMode.system,
  cacheThemeMode: true,
  lightThemeData: LightThemeData(
    colorSeed: ColorSeed(
        green: Color('#10b981'),
      ),
    ),
    darkModeThemeData: DarkThemeData(
      colorSeed: ColorSeed(
        green: Color('#059669'),
      ),
    ),
  ),
);

void main() {
  runApp(NakiThemeProvider.fromConfig(
    configuration: _themeConfig,
    builder: (context) => MyApp(),
  ));
}

Implementation

const ThemeConfig({
  this.initialMode = ThemeMode.system,
  this.cacheThemeMode = false,
  this.lightThemeData,
  this.darkThemeData,
  this.scrollBarConfiguration,
  this.styles = const [],
});