Import
import 'package:flutter/widgets.dart';
import 'package:fluttyui/fluttyui.dart' as ui;Usage
Use this expression inside a stateful widget. Keep the current value in your widget state and update it in the callback.
ui.Switch(
value: enabled,
onChanged: (value) => setState(() => enabled = value),
)API Reference
The declarations below match the current FluttyUI source. Types are shown without the optional ui. import prefix.
Switch
const Switch({
super.key,
this.motion,
required this.value,
required this.onChanged,
this.enabled = true,
this.size,
this.width,
this.height,
this.thumbSize,
this.thumbWidth,
this.activeColor,
this.inactiveColor,
this.thumbColor = const Color(0xFFFFFFFF),
this.borderColor = const Color(0x00000000),
this.thumbPadding,
});| Parameter | Type | Required | Default |
|---|---|---|---|
key | Key? | No | null |
motion | ComponentMotion? | No | null |
value | bool | Yes | — |
onChanged | ValueChanged<bool>? | Yes | — |
enabled | bool | No | true |
size | ComponentSize? | No | null |
width | double? | No | null |
height | double? | No | null |
thumbSize | double? | No | null |
thumbWidth | double? | No | null |
activeColor | Color? | No | null |
inactiveColor | Color? | No | null |
thumbColor | Color | No | const Color(0xFFFFFFFF) |
borderColor | Color | No | const Color(0x00000000) |
thumbPadding | double? | No | null |
Application Setup
Place components under FluttyApp to provide theme, navigation, localization, and overlay defaults. Use theme tokens for shared appearance settings.
Source
lib/src/widgets/controls/switch/switch.dart
This reference is generated from the Switch declaration in the FluttyUI core checkout. The component catalog lists the other available building blocks.

