Skip to content

Switch ​

A labeled toggle switch, with a .tile() variant that adds a subtitle row for settings-screen-style rows.

View source on GitHub ↗

CLI ​

Install this component into your project:

switch
$flutter_beautify add switch

Variants ​

FBSwitch.standard() · FBSwitch.tile() (adds subtitle) · FBSwitch.android()

Key parameters ​

ParameterTypeDefault
valueboolrequired
onChangedValueChanged<bool>?—
labelString''
subtitleString?—
activeColorColor?—

Usage ​

dart
import 'package:your_app/widgets/switch.dart';

FBSwitch.tile(
  value: darkMode,
  onChanged: (v) => setState(() => darkMode = v),
  label: 'Dark mode',
  subtitle: 'Use a darker color scheme',
);

Released under the MIT License.