showSinglePicker<T> static method
void
showSinglePicker<T>({
- required BuildContext context,
- required void onChanged(
- PickerItem<
T> ?
- PickerItem<
- required dynamic value,
- bool isDismissible = true,
- bool enableDrag = true,
- BoxConstraints? constraints,
- bool filterable = false,
- Widget? title,
- String? titleText,
- double? height,
- List<
PickerItem< ? options,T> > - ValueNotifier<
List< ? notifierOptions,PickerItem< >T> > - Future<
void> ? onRequest()?, - void onSelected()?,
- bool isScrollControlled = true,
显示单选选择器
Implementation
static void showSinglePicker<T>({
required BuildContext context,
required void Function(PickerItem<T>?) onChanged,
required dynamic value,
bool isDismissible = true,
bool enableDrag = true,
BoxConstraints? constraints,
bool filterable = false,
// -------------------------------------------------------------------------------------------- > Custom
Widget? title,
String? titleText,
double? height,
List<PickerItem<T>>? options,
ValueNotifier<List<PickerItem<T>>>? notifierOptions,
Future<void>? Function()? onRequest,
void Function()? onSelected,
bool isScrollControlled = true,
}) {
CustomBottomSheet.showDefault(
context: context,
isDismissible: isDismissible,
constraints: constraints ?? const BoxConstraints(),
builder: (BuildContext context) {
return SizedBox(
height: height ?? context.height * ConfigStore.to.config.app.bottomSheetHeight,
child: notifierOptions != null
? ValueListenableBuilder<List<PickerItem<T>>>(
valueListenable: notifierOptions,
builder: (BuildContext context, List<PickerItem<T>> data, Widget? widget) {
return InternalSinglePicker<T>(
value: value,
options: data,
onChanged: onChanged,
title: title,
titleText: titleText,
filterable: filterable,
onRequest: onRequest,
onSelected: onSelected,
);
},
)
: InternalSinglePicker<T>(
value: value,
options: options ?? [],
onChanged: onChanged,
title: title,
titleText: titleText,
filterable: filterable,
onRequest: onRequest,
onSelected: onSelected,
),
);
},
);
}