Einfachauswahl aus einer Liste oder Datenquelle.
TxSelectBox
| Parameter | Typ | Standard | Bedeutung |
|---|---|---|---|
| items | List<TxItem<T>> | const [] | Einträge; bei Datenbindung durch dataSource ersetzt. |
| dataSource | Object? | null | Liste, Konfiguration oder DataSource-Instanz; hat Vorrang vor items. |
| value | T? | null | Aktueller Eingabe-/Optionswert. |
| onChanged | ValueChanged<T?>? | null | Callback für changed; Argumente und Rückgabetyp siehe Signatur. |
| label | String? | null | Beschriftung beziehungsweise zugänglicher Name. |
| placeholder | String | 'Bitte wählen' | Hinweis bei leerer Eingabe. |
| disabled | bool | false | Sperrt die Interaktion. |
| readOnly | bool | false | Verhindert Änderungen des Werts. |
| isValid | bool | true | Steuert die Fehlerdarstellung; führt keine eigene Validierung aus. |
| validationMessage | String | 'Bitte Eingabe prüfen.' | Fehlermeldung bei isValid = 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)),
);
}