FormeCupertinoSlidingSegmentedControl<T extends Object> constructor
FormeCupertinoSlidingSegmentedControl<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? backgroundColor,
- Color? disableBackgroundColor,
- Color? disableThumbColor,
- EdgeInsetsGeometry? padding,
- 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();
}),
),
);
});