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

TxTagBox.

Interactive preview

Searchable multiple selection with tags. Select all applies to loaded results.

TxTagBox

ParameterTypeDefaultMeaning
itemsList<TxItem<T>>const []Entries; replaced by dataSource when bound.
dataSourceObject?nullList, configuration or DataSource instance; takes precedence over items.
valuesSet<T>const {}Currently selected values.
onChangedValueChanged<Set<T>>?nullCallback for changed; see the signature for arguments and return type.
disabledboolfalseDisables interaction.
labelString'Auswählen'Label or accessible name.
maxDisplayedTagsint4Maximum visible tags before summarizing.
applyOnConfirmboolfalseApplies selection only on confirmation.
onCustomItemCreatingFutureOr<TxItem<T>> Function(String)?nullCreates a TxItem synchronously or asynchronously from entered text.
showSelectionControlsbooltrueShows multiple/select-all controls.
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')];
  var keys = <int>{};
  return StatefulBuilder(
    builder: (context, setState) => TxTagBox<int>(items: options, values: keys, onChanged: (v) => setState(() => keys = v)),
  );
}