# Theme

Since the theme configuration of Flutter is already rich enough, here are just some shortcut methods and extensions.

# Dark Mode

dark mode

The widget will read the brightness property of the current theme from the context. You can configure the theme like this:

ThemeData _buildDarkTheme() {
  final ThemeData base = ThemeData(
    brightness: Brightness.dark,
    // colors ...
    cupertinoOverrideTheme: CupertinoThemeData(
      brightness: Brightness.dark,
    ),
  );
  return base;
}

ThemeData _buildLightTheme() {
  final ThemeData base = ThemeData(
      brightness: Brightness.light,
      // colors ...
      cupertinoOverrideTheme: CupertinoThemeData(
        brightness: Brightness.light,
      ));
  return base;
}

Then assign values to themeMode, theme and darkTheme in MaterialApp:

MaterialApp(
    title: 'FLUI',
    themeMode: themeMode,
    theme: _buildLightTheme(),
    darkTheme: _buildDarkTheme(),
    routes: [...]
)

# FLPrimaryColorOverride

FLPrimaryColorOverride can configure a new primary color for a sub-widget.

FLPrimaryColorOverride(
    color: Colors.blue,
    child: RaisedButton(
        child: Text('Color Override');
    ),
    onPressed: (){}
)

# API

# FLPrimaryColorOverride

property description type default value
color primary color Color
child widget Widget