t×tecexpressby TeKOcloud
DEv0.7.1
Editors & selection / FLUTTER

TxSelectBox.

Interactive preview

Single selection from a list or data source.

TxSelectBox

ParameterTypeDefaultMeaning
itemsList<TxItem<T>>const []Entries; replaced by dataSource when bound.
dataSourceObject?nullList, configuration or DataSource instance; takes precedence over items.
valueT?nullCurrent input/option value.
onChangedValueChanged<T?>?nullCallback for changed; see the signature for arguments and return type.
labelString?nullLabel or accessible name.
placeholderString'Bitte wählen'Hint for an empty input.
disabledboolfalseDisables interaction.
readOnlyboolfalsePrevents value changes.
isValidbooltrueControls error presentation; does not perform validation.
validationMessageString'Bitte Eingabe prüfen.'Error message when isValid is false.
dart
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)),
  );
}