FormeCupertinoSegmentedControl<T extends Object> constructor

FormeCupertinoSegmentedControl<T extends Object>({
  1. required String name,
  2. required Map<T, Widget> children,
  3. Color? unselectedColor,
  4. Color? selectedColor,
  5. Color? borderColor,
  6. Color? pressedColor,
  7. EdgeInsetsGeometry? padding,
  8. Color? disableUnselectedColor,
  9. Color? disableSelectedColor,
  10. Color? disableBorderColor,
  11. T? initialValue,
  12. bool readOnly = false,
  13. Key? key,
  14. int? order,
  15. bool quietlyValidate = false,
  16. Duration? asyncValidatorDebounce,
  17. AutovalidateMode? autovalidateMode,
  18. FormeValueChanged<T?>? onValueChanged,
  19. FormeFocusChanged<T?>? onFocusChanged,
  20. FormeFieldValidationChanged<T?>? onValidationChanged,
  21. FormeFieldInitialed<T?>? onInitialed,
  22. FormeFieldSetter<T?>? onSaved,
  23. FormeValidator<T?>? validator,
  24. FormeAsyncValidator<T?>? asyncValidator,
  25. FormeFieldDecorator<T?>? decorator,
  26. bool requestFocusOnUserInteraction = true,
  27. bool registrable = true,
  28. bool enabled = true,
})

Implementation

FormeCupertinoSegmentedControl({
  required String name,
  required this.children,
  Color? unselectedColor,
  Color? selectedColor,
  Color? borderColor,
  Color? pressedColor,
  EdgeInsetsGeometry? padding,
  Color? disableUnselectedColor,
  Color? disableSelectedColor,
  Color? disableBorderColor,
  T? initialValue,
  bool readOnly = false,
  Key? key,
  int? order,
  bool quietlyValidate = false,
  Duration? asyncValidatorDebounce,
  AutovalidateMode? autovalidateMode,
  FormeValueChanged<T?>? onValueChanged,
  FormeFocusChanged<T?>? onFocusChanged,
  FormeFieldValidationChanged<T?>? onValidationChanged,
  FormeFieldInitialed<T?>? onInitialed,
  FormeFieldSetter<T?>? onSaved,
  FormeValidator<T?>? validator,
  FormeAsyncValidator<T?>? asyncValidator,
  FormeFieldDecorator<T?>? decorator,
  bool requestFocusOnUserInteraction = true,
  bool registrable = true,
  bool enabled = true,
}) : super(
          enabled: enabled,
          registrable: registrable,
          requestFocusOnUserInteraction: requestFocusOnUserInteraction,
          decorator: decorator,
          quietlyValidate: quietlyValidate,
          asyncValidatorDebounce: asyncValidatorDebounce,
          autovalidateMode: autovalidateMode,
          onValueChanged: onValueChanged,
          onFocusChanged: onFocusChanged,
          onValidationChanged: onValidationChanged,
          onInitialed: onInitialed,
          onSaved: onSaved,
          validator: validator,
          asyncValidator: asyncValidator,
          order: order,
          name: name,
          initialValue: initialValue,
          readOnly: readOnly,
          key: key,
          builder: (state) {
            final bool readOnly = state.readOnly;
            return Row(
              children: [
                Expanded(
                    child: Focus(
                  focusNode: state.focusNode,
                  child: AbsorbPointer(
                    absorbing: readOnly,
                    child: CupertinoSegmentedControl<T>(
                        groupValue: state.value,
                        children: children,
                        unselectedColor: readOnly
                            ? disableUnselectedColor
                            : unselectedColor,
                        selectedColor:
                            readOnly ? disableSelectedColor : selectedColor,
                        borderColor:
                            readOnly ? disableBorderColor : borderColor,
                        pressedColor: pressedColor,
                        padding: padding,
                        onValueChanged: (v) {
                          state.didChange(v);
                          state.requestFocusOnUserInteraction();
                        }),
                  ),
                ))
              ],
            );
          });