ShadToggleGroup<T> constructor
const
ShadToggleGroup<T> ({
- Key? key,
- required List<
ShadToggleGroupItem< children,T> > - Set<
T> ? values, - ValueChanged<
Set< ? onChanged,T> > - ShadToggleGroupController<
T> ? controller, - bool allowDeselection = true,
- bool enabled = true,
- ShadToggleVariant toggleVariant = ShadToggleVariant.default_,
- double? gap,
- Axis axis = Axis.horizontal,
- MainAxisSize mainAxisSize = MainAxisSize.min,
A set of ShadToggles sharing a selection.
Mirrors shadcn/ui's ToggleGroup, in single or multiple mode.
ShadToggleGroup<String>(
values: const {'bold'},
onChanged: (values) => setState(() => selected = values),
children: const [
ShadToggleGroupItem(value: 'bold', child: Icon(LucideIcons.bold)),
ShadToggleGroupItem(value: 'italic', child: Icon(LucideIcons.italic)),
],
)
Implementation
const ShadToggleGroup({
super.key,
required this.children,
this.values,
this.onChanged,
this.controller,
this.allowDeselection = true,
this.enabled = true,
this.toggleVariant = ShadToggleVariant.default_,
this.gap,
this.axis = Axis.horizontal,
this.mainAxisSize = MainAxisSize.min,
}) : variant = ShadToggleGroupVariant.single;