SelectionMenuForm<T> constructor

SelectionMenuForm<T>({
  1. required WidgetBuilder selectorBuilder,
  2. required DropDownButtonBuilder? buttonBuilder,
  3. SelectionMenuFormController? controller,
  4. LayoutSelectPop? layoutSelectPop,
  5. DropDownPopCreated? onCreated,
  6. DropDownPopShow? onShow,
  7. DropDownPopDismiss? onDismiss,
  8. bool enableOnHover = false,
  9. bool enableClick = true,
  10. bool matchParentWidth = true,
  11. double popWidth = 0,
  12. double hMargin = 0,
  13. double vMargin = 0,
  14. double popHeight = 200,
  15. BorderRadiusGeometry? materialBorderRadius,
  16. Color? color = Colors.transparent,
  17. ShapeBorder? shape,
  18. double elevation = 0.0,
  19. Color? shadowColor,
  20. String? barrierLabel,
  21. Color? barrierColor,
  22. bool barrierDismissible = true,
  23. Duration transitionDuration = const Duration(milliseconds: 200),
  24. AlignType alignType = AlignType.left,
  25. GestureTapCallback? onDoubleTap,
  26. GestureLongPressCallback? onLongPress,
  27. GestureTapDownCallback? onTapDown,
  28. GestureTapUpCallback? onTapUp,
  29. GestureTapCancelCallback? onTapCancel,
  30. ValueChanged<bool>? onHighlightChanged,
  31. ValueChanged<bool>? onHover,
  32. MouseCursor? mouseCursor,
  33. Color? focusColor,
  34. Color? hoverColor,
  35. Color? highlightColor,
  36. WidgetStateProperty<Color?>? overlayColor,
  37. Color? splashColor,
  38. InteractiveInkFeatureFactory? splashFactory,
  39. double? radius,
  40. BorderRadius? borderRadius,
  41. ShapeBorder? customBorder,
  42. bool enableFeedback = true,
  43. bool excludeFromSemantics = false,
  44. FocusNode? focusNode,
  45. bool canRequestFocus = true,
  46. ValueChanged<bool>? onFocusChange,
  47. bool autofocus = false,
  48. AutovalidateMode? autovalidateMode,
  49. ScrollController? scrollController,
  50. String? restorationId,
  51. FormFieldSetter? onSaved,
  52. FormFieldValidator? validator,
  53. bool? enabled,
  54. required ValueNotifier<FormTips> valueNotifier,
  55. Widget? noneTips,
  56. Widget? warningTips,
  57. Widget? errorTips,
  58. InputDecoration decoration = const InputDecoration(),
  59. Key? key,
})

Implementation

SelectionMenuForm(
    {required this.selectorBuilder,
    required this.buttonBuilder,
    this.controller,
    this.layoutSelectPop,
    this.onCreated,
    this.onShow,
    this.onDismiss,
    this.enableOnHover = false,
    this.enableClick = true,
    this.matchParentWidth = true,
    this.popWidth = 0,
    this.hMargin = 0,
    this.vMargin = 0,
    this.popHeight = 200,
    this.materialBorderRadius,
    this.color = Colors.transparent,
    this.shape,
    this.elevation = 0.0,
    this.shadowColor,
    this.barrierLabel,
    this.barrierColor,
    this.barrierDismissible = true,
    this.transitionDuration = const Duration(milliseconds: 200),
    this.alignType = AlignType.left,
    this.onDoubleTap,
    this.onLongPress,
    this.onTapDown,
    this.onTapUp,
    this.onTapCancel,
    this.onHighlightChanged,
    this.onHover,
    this.mouseCursor,
    this.focusColor,
    this.hoverColor,
    this.highlightColor,
    this.overlayColor,
    this.splashColor,
    this.splashFactory,
    this.radius,
    this.borderRadius,
    this.customBorder,
    this.enableFeedback = true,
    this.excludeFromSemantics = false,
    this.focusNode,
    this.canRequestFocus = true,
    this.onFocusChange,
    this.autofocus = false,
    AutovalidateMode? autovalidateMode,
    ScrollController? scrollController,
    String? restorationId,
    FormFieldSetter? onSaved,
    FormFieldValidator? validator,
    bool? enabled,
    required ValueNotifier<FormTips> valueNotifier,
    Widget? noneTips,
    Widget? warningTips,
    Widget? errorTips,
    InputDecoration decoration = const InputDecoration(),
    Key? key})
    : super(
        key: key,
        restorationId: restorationId,
        onSaved: onSaved,
        validator: validator,
        autovalidateMode: autovalidateMode ?? AutovalidateMode.disabled,
        builder: (FormFieldState field) {
          final SelectionMenuFormState state =
              field as SelectionMenuFormState;
          return UnmanagedRestorationScope(
            bucket: field.bucket,
            child: Builder(builder: (context) {
              return Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisSize: MainAxisSize.min,
                children: [
                  InkWell(
                    key: state._rootKey,
                    onDoubleTap: onDoubleTap,
                    onLongPress: onLongPress,
                    onTapDown: onTapDown,
                    onTapUp: onTapUp,
                    onTapCancel: onTapCancel,
                    onHighlightChanged: onHighlightChanged,
                    mouseCursor: mouseCursor,
                    focusColor: focusColor,
                    hoverColor: hoverColor,
                    highlightColor: highlightColor,
                    overlayColor: overlayColor,
                    splashColor: splashColor,
                    splashFactory: splashFactory,
                    radius: radius,
                    borderRadius: borderRadius,
                    customBorder: customBorder,
                    enableFeedback: enableFeedback,
                    excludeFromSemantics: excludeFromSemantics,
                    focusNode: focusNode,
                    canRequestFocus: canRequestFocus,
                    onFocusChange: onFocusChange,
                    autofocus: autofocus,
                    onHover: (hover) {
                      if (hover && enableOnHover) {
                        state._showSelection(context);
                        return;
                      }
                    },
                    onTap: () {
                      if(enabled == false) {
                        return;
                      }
                      if (!enableClick) {
                        return;
                      }
                      if (state._popShowIng) {
                        return;
                      }
                      state._showSelection(context);
                    },
                    child: buttonBuilder?.call(state._popShowIng),
                  ),
                  ValueListenableBuilder<FormTips>(
                      valueListenable: valueNotifier,
                      builder: (context, value, child) {
                        if (value == FormTips.warning) {
                          return warningTips ?? const SizedBox();
                        }
                        if (value == FormTips.error) {
                          return errorTips ?? const SizedBox();
                        }
                        return const SizedBox();
                      })
                ],
              );
            }),
          );
        },
      );