Toggle Group
Multiple toggle buttons in a group.
Installation
bash
flutter_studio add togglegroupbash
flutter pub add flutter_studioUsage
dart
CustomToggleGroup(
options: ['Left', 'Center', 'Right'],
selectedIndex: selectedAlignment,
onChanged: (index) {
setState(() {
selectedAlignment = index;
});
},
)Multiple Selection
dart
CustomToggleGroup(
options: ['Bold', 'Italic', 'Underline'],
multiSelect: true,
selectedIndices: [0, 2], // Bold and Underline selected
onMultiChanged: (indices) {
setState(() {
selectedIndices = indices;
});
},
)API Reference
Properties
| Property | Type | Default | Description |
|---|---|---|---|
options | List<String> | required | Toggle options |
selectedIndex | int? | null | Selected option index |
multiSelect | bool | false | Allow multiple selections |
