ReactiveSwitchListTile.adaptive constructor
ReactiveSwitchListTile.adaptive({
- Key? key,
- String? formControlName,
- FormControl<
bool> ? formControl, - Color? activeColor,
- Color? activeTrackColor,
- Color? inactiveThumbColor,
- Color? inactiveTrackColor,
- ImageProvider<
Object> ? activeThumbImage, - ImageErrorListener? onActiveThumbImageError,
- ImageProvider<
Object> ? inactiveThumbImage, - ImageErrorListener? onInactiveThumbImageError,
- WidgetStateProperty<
Color?> ? thumbColor, - WidgetStateProperty<
Color?> ? trackColor, - WidgetStateProperty<
Color?> ? trackOutlineColor, - WidgetStateProperty<
Icon?> ? thumbIcon, - MaterialTapTargetSize? materialTapTargetSize,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- MouseCursor? mouseCursor,
- WidgetStateProperty<
Color?> ? overlayColor, - double? splashRadius,
- bool autofocus = false,
- bool? applyCupertinoTheme,
- EdgeInsetsGeometry? contentPadding,
- ListTileControlAffinity controlAffinity = ListTileControlAffinity.platform,
- bool? dense,
- bool? enableFeedback,
- FocusNode? focusNode,
- ValueChanged<
bool> ? onFocusChange, - Color? hoverColor,
- bool isThreeLine = false,
- Widget? secondary,
- bool selected = false,
- Color? selectedTileColor,
- ShapeBorder? shape,
- Widget? subtitle,
- Color? tileColor,
- Widget? title,
- VisualDensity? visualDensity,
- ReactiveFormFieldCallback<
bool> ? onChanged,
Creates a ReactiveSwitchListTile that wraps a Material ListTile with an adaptive Switch, following Material design's Cross-platform guidelines.
This widget uses Switch.adaptive to change the graphics of the switch component based on the ambient ThemeData.platform. On iOS and macOS, a CupertinoSwitch will be used. On other platforms a Material design Switch will be used.
If a CupertinoSwitch is created, the following parameters are
ignored: activeTrackColor, inactiveThumbColor, inactiveTrackColor,
activeThumbImage, inactiveThumbImage.
For documentation about the various parameters, see the SwitchListTile.adaptive constructor.
Implementation
ReactiveSwitchListTile.adaptive({
super.key,
super.formControlName,
super.formControl,
Color? activeColor,
Color? activeTrackColor,
Color? inactiveThumbColor,
Color? inactiveTrackColor,
ImageProvider? activeThumbImage,
ImageErrorListener? onActiveThumbImageError,
ImageProvider? inactiveThumbImage,
ImageErrorListener? onInactiveThumbImageError,
WidgetStateProperty<Color?>? thumbColor,
WidgetStateProperty<Color?>? trackColor,
WidgetStateProperty<Color?>? trackOutlineColor,
WidgetStateProperty<Icon?>? thumbIcon,
MaterialTapTargetSize? materialTapTargetSize,
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
MouseCursor? mouseCursor,
WidgetStateProperty<Color?>? overlayColor,
double? splashRadius,
bool autofocus = false,
bool? applyCupertinoTheme,
EdgeInsetsGeometry? contentPadding,
ListTileControlAffinity controlAffinity = ListTileControlAffinity.platform,
bool? dense,
bool? enableFeedback,
super.focusNode,
ValueChanged<bool>? onFocusChange,
Color? hoverColor,
bool isThreeLine = false,
Widget? secondary,
bool selected = false,
Color? selectedTileColor,
ShapeBorder? shape,
Widget? subtitle,
Color? tileColor,
Widget? title,
VisualDensity? visualDensity,
ReactiveFormFieldCallback<bool>? onChanged,
}) : super(
builder: (field) {
return SwitchListTile.adaptive(
value: field.value ?? false,
activeColor: activeColor,
activeTrackColor: activeTrackColor,
inactiveThumbColor: inactiveThumbColor,
inactiveTrackColor: inactiveTrackColor,
activeThumbImage: activeThumbImage,
onActiveThumbImageError: onActiveThumbImageError,
inactiveThumbImage: inactiveThumbImage,
onInactiveThumbImageError: onInactiveThumbImageError,
thumbColor: thumbColor,
trackColor: trackColor,
trackOutlineColor: trackOutlineColor,
thumbIcon: thumbIcon,
materialTapTargetSize: materialTapTargetSize,
dragStartBehavior: dragStartBehavior,
mouseCursor: mouseCursor,
overlayColor: overlayColor,
splashRadius: splashRadius,
autofocus: autofocus,
applyCupertinoTheme: applyCupertinoTheme,
contentPadding: contentPadding,
controlAffinity: controlAffinity,
dense: dense,
enableFeedback: enableFeedback,
focusNode: field.focusNode,
onFocusChange: onFocusChange,
hoverColor: hoverColor,
isThreeLine: isThreeLine,
secondary: secondary,
selected: selected,
selectedTileColor: selectedTileColor,
shape: shape,
subtitle: subtitle,
tileColor: tileColor,
title: title,
visualDensity: visualDensity,
onChanged:
field.control.enabled
? (value) {
field.didChange(value);
onChanged?.call(field.control);
}
: null,
);
},
);