Skip to content

Switches

Switches toggle the state of a single item on or off.

Switches Default

Switch Default

Switch(
  value: light,
  onChanged: (bool value) {}

)

Checkbox List Tile

Switch Button list tile

SwitchListTile(
  title: const Text('Switch Title'),
  value: true,
  onChanged:(bool? value) { },
),

Customization

To change the whole Switches Theme, please open the core/themes/app_theme.dart. Here's how to change the Widget Radio Switch theme:

switchTheme: SwitchThemeData(
    fillColor: MaterialStateProperty.resolveWith<Color>((Set<MaterialState> states) {
    if (states.contains(MaterialState.selected)) {
        return AppColors.secondary;
    } else if (states.contains(MaterialState.hovered)) {
        return AppColors.splash;
    }
    return AppColors.fillPrimary;
    }),
),
Authors: Nanang Prasetya