Skip to content
On this page

Picker 选择器

代码演示

基本用法

dart
Picker(
  // ignore: avoid_print
  onChange: (values) => print(values),
  columns: citiesColumns,
),

无限滑动

dart
Picker(columns: citiesColumns, loop: true),

搭配弹出层使用

dart
PopupStatic.show(
  context,
  round: true,
  position: PopupPosition.bottom,
  child: WatchModel(popupValues, (model) {
    return Picker(
      onCancel: (_) => popupShow.value = false,
      onConfirm: (_) => popupShow.value = false,
      columns: citiesColumns,
      values: model.value,
      onChange: (values) => popupValues.value = values,
    );
  }),
);

多列选择

dart
Picker(columns: weekTimesColumns),

级联选择

dart
Picker(columns: cascadeCities),

API

Props类型描述
columnsList<NamedValue | PickerOption> | List<List<NamedValue | PickerOption>>带子级联选项、或多维固定选项
valuesList当前值列表
onChangeFunction(List)值变化回调
loopbool循环选项列
titleWidget | String面板标题
confirmTextString确认文本
cancelTetxString取消文本
onConfirmFunction(List)确认回调
onCancelFunction(List)取消回调