Group of actions with no, single or multiple selection.
TxButtonGroup
| Parameter | Type | Default | Meaning |
|---|---|---|---|
| items | List<TxItem<T>> | const [] | Entries; replaced by dataSource when bound. |
| dataSource | Object? | null | List, configuration or DataSource instance; takes precedence over items. |
| values | Set<T> | const {} | Currently selected values. |
| onChanged | ValueChanged<Set<T>>? | null | Callback for changed; see the signature for arguments and return type. |
| onItemClick | ValueChanged<TxItem<T>>? | null | Reports the activated entry; arguments follow the callback signature. |
| selection | TxSelectionMode | TxSelectionMode.single | Selection mode. |
| disabled | bool | false | Disables interaction. |
| direction | Axis | Axis.horizontal | Entry layout direction. |
import 'package:flutter/material.dart';
import 'package:tecexpress/tecexpress.dart';
Widget example() {
const options = [TxItem(value: 1, text: 'One'), TxItem(value: 2, text: 'Two')];
var keys = <int>{};
return StatefulBuilder(
builder: (context, setState) => TxButtonGroup<int>(items: options, values: keys, onChanged: (v) => setState(() => keys = v)),
);
}