FormeCupertinoSegmentedControl<T extends Object> constructor
FormeCupertinoSegmentedControl<T extends Object> ({
- Key? key,
- String? name,
- T? initialValue,
- FormeAsyncValidator<
T?> ? asyncValidator, - Duration? asyncValidatorDebounce,
- AutovalidateMode? autovalidateMode,
- FormeFieldDecorator<
T?> ? decorator, - bool enabled = true,
- FocusNode? focusNode,
- FormeFieldInitialized<
T?> ? onInitialized, - FormeFieldSetter<
T?> ? onSaved, - FormeFieldStatusChanged<
T?> ? onStatusChanged, - int? order,
- bool quietlyValidate = false,
- bool readOnly = false,
- bool requestFocusOnUserInteraction = true,
- FormeFieldValidationFilter<
T?> ? validationFilter, - FormeValidator<
T?> ? validator, - required Map<
T, Widget> children, - Color? borderColor,
- Color? disableBorderColor,
- Color? disableSelectedColor,
- Color? disableUnselectedColor,
- EdgeInsetsGeometry? padding,
- Color? pressedColor,
- Color? selectedColor,
- Color? unselectedColor,
Implementation
FormeCupertinoSegmentedControl({
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.borderColor,
this.disableBorderColor,
this.disableSelectedColor,
this.disableUnselectedColor,
this.padding,
this.pressedColor,
this.selectedColor,
this.unselectedColor,
}) : super.allFields(builder: (state) {
final bool readOnly = state.readOnly;
return Focus(
focusNode: state.focusNode,
//still now way to disable CupertinoSegmentedControl officially after 3 years....
child: IgnorePointer(
ignoring: 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();
}),
),
);
});