showSinglePicker<T> static method

void showSinglePicker<T>({
  1. required BuildContext context,
  2. required void onChanged(
    1. PickerItem<T>?
    ),
  3. required dynamic value,
  4. bool isDismissible = true,
  5. bool enableDrag = true,
  6. BoxConstraints? constraints,
  7. bool filterable = false,
  8. Widget? title,
  9. String? titleText,
  10. double? height,
  11. List<PickerItem<T>>? options,
  12. ValueNotifier<List<PickerItem<T>>>? notifierOptions,
  13. Future<void>? onRequest()?,
  14. void onSelected()?,
  15. 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,
              ),
      );
    },
  );
}