FormeCupertinoSegmentedControl<T extends Object> constructor
FormeCupertinoSegmentedControl<T extends Object> ({
- required String name,
- required Map<
T, Widget> 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,
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();
}),
),
))
],
);
});