FormeCupertinoSlidingSegmentedControl<T extends Object> constructor

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

Implementation

FormeCupertinoSlidingSegmentedControl({
  required String name,
  required this.children,
  Color? thumbColor,
  Color? backgroundColor,
  EdgeInsetsGeometry? padding,
  Color? disableThumbColor,
  Color? disableBackgroundColor,
  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: CupertinoSlidingSegmentedControl<T>(
                        groupValue: state.value,
                        children: children,
                        thumbColor:
                            (readOnly ? disableThumbColor : thumbColor) ??
                                const CupertinoDynamicColor.withBrightness(
                                  color: Color(0xFFFFFFFF),
                                  darkColor: Color(0xFF636366),
                                ),
                        backgroundColor: (readOnly
                                ? disableBackgroundColor
                                : backgroundColor) ??
                            CupertinoColors.tertiarySystemFill,
                        padding: padding ??
                            const EdgeInsets.symmetric(
                                vertical: 2, horizontal: 3),
                        onValueChanged: (v) {
                          state.didChange(v);
                          state.requestFocusOnUserInteraction();
                        }),
                  ),
                ))
              ],
            );
          });