FormeCupertinoSlidingSegmentedControl<T extends Object> constructor

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

Implementation

FormeCupertinoSlidingSegmentedControl({
  super.key,
  super.name,
  super.initialValue,
  super.asyncValidator,
  super.asyncValidatorDebounce,
  super.autovalidateMode,
  super.decorator,
  super.enabled = true,
  super.focusNode,
  super.onInitialized,
  super.onSaved,
  super.onStatusChanged,
  super.order,
  super.quietlyValidate = false,
  super.readOnly = false,
  super.requestFocusOnUserInteraction = true,
  super.validationFilter,
  super.validator,
  required this.children,
  this.backgroundColor,
  this.disableBackgroundColor,
  this.disableThumbColor,
  this.padding,
  this.thumbColor,
}) : super.allFields(builder: (state) {
        final bool readOnly = state.readOnly;
        return Focus(
          focusNode: state.focusNode,
          child: IgnorePointer(
            ignoring: 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();
                }),
          ),
        );
      });