Form

Switch

A toggle switch component that allows users to enable or disable a setting with a sliding motion.

CLI

To generate a specific style for customization:

dart run forui style create switch

Usage

FSwitch(...)

1FSwitch(
2 style: const .delta(
3 trailingLabelStyle: .delta(labelPadding: .value(.only(left: 8))),
4 ),
5 leadingLabel: false,
6 enabled: true,
7 value: false,
8 onChange: (value) {},
9 dragStartBehavior: .start,
10 label: const Text('Enable notifications'),
11 description: const Text('Receive push notifications'),
12 error: null,
13)

Examples

Leading Label

Disabled

Form

On this page