Switch
Toggle switch for boolean values with label support.
File: example/lib/widgets/switch.dart
Factory Methods
FBSwitch.basic()- Standard toggleFBSwitch.withLabel()- Switch with labelFBSwitch.adaptive()- Platform-specific styleFBSwitch.filled()- Custom color
Properties
value: bool
onChanged: Function(bool)
label: String
activeColor: Color
inactiveColor: Color
enabled: bool
thumbColor: Color
Usage Example
FBSwitch.withLabel(
value: isDarkMode,
label: 'Dark Mode',
onChanged: (value) => setState(() => isDarkMode = value),
)
Multiple Settings
Column(
children: [
FBSwitch.withLabel(
value: notifications,
label: 'Notifications',
onChanged: (v) => setState(() => notifications = v),
),
FBSwitch.withLabel(
value: darMode,
label: 'Dark Mode',
onChanged: (v) => setState(() => darkMode = v),
),
],
)