Single selection from a list or data source.
TxSelectBox
| 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. |
| value | T? | null | Current input/option value. |
| onChanged | ValueChanged<T?>? | null | Callback for changed; see the signature for arguments and return type. |
| label | String? | null | Label or accessible name. |
| placeholder | String | 'Bitte wählen' | Hint for an empty input. |
| disabled | bool | false | Disables interaction. |
| readOnly | bool | false | Prevents value changes. |
| isValid | bool | true | Controls error presentation; does not perform validation. |
| validationMessage | String | 'Bitte Eingabe prüfen.' | Error message when isValid is false. |
import 'package:flutter/material.dart';
import 'package:tecexpress/tecexpress.dart';
Widget example() {
const options = [TxItem(value: 1, text: 'One'), TxItem(value: 2, text: 'Two')];
int? choice = 1;
return StatefulBuilder(
builder: (context, setState) => TxSelectBox<int>(items: options, value: choice, onChanged: (v) => setState(() => choice = v)),
);
}