cupertinoSwitchBuilder function
The default FastSwitch Cupertino FormFieldBuilder.
Returns a CupertinoFormRow that contains a CupertinoSwitch.
Implementation
Widget cupertinoSwitchBuilder(FormFieldState<bool> field) {
field as FastSwitchState;
final FastSwitchState(:didChange, :enabled, :value!, :widget) = field;
assert(widget.thumbColor == null || widget.thumbColor is Color);
return CupertinoFormRow(
padding: widget.contentPadding,
prefix: widget.cupertinoPrefixBuilder(field),
helper: widget.cupertinoHelperBuilder(field),
error: widget.cupertinoErrorBuilder(field),
child: CupertinoSwitch(
offLabelColor: widget.offLabelColor,
onLabelColor: widget.onLabelColor,
activeColor: widget.activeColor,
applyTheme: widget.applyTheme,
autofocus: widget.autofocus,
dragStartBehavior: widget.dragStartBehavior,
focusColor: widget.focusColor,
focusNode: widget.focusNode,
onChanged: enabled ? didChange : null,
onFocusChange: widget.onFocusChange,
thumbColor: widget.thumbColor,
trackColor: widget.activeTrackColor,
value: value,
),
);
}