SwitchListTile.adaptive constructor

const SwitchListTile.adaptive({
  1. Key? key,
  2. required bool value,
  3. required ValueChanged<bool>? onChanged,
  4. @Deprecated('Use activeThumbColor or activeTrackColor instead. ' 'This feature was deprecated after v3.31.0-2.0.pre.') Color? activeColor,
  5. Color? activeThumbColor,
  6. Color? activeTrackColor,
  7. Color? inactiveThumbColor,
  8. Color? inactiveTrackColor,
  9. ImageProvider<Object>? activeThumbImage,
  10. ImageErrorListener? onActiveThumbImageError,
  11. ImageProvider<Object>? inactiveThumbImage,
  12. ImageErrorListener? onInactiveThumbImageError,
  13. WidgetStateProperty<Color?>? thumbColor,
  14. WidgetStateProperty<Color?>? trackColor,
  15. WidgetStateProperty<Color?>? trackOutlineColor,
  16. WidgetStateProperty<Icon?>? thumbIcon,
  17. MaterialTapTargetSize? materialTapTargetSize,
  18. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  19. MouseCursor? mouseCursor,
  20. WidgetStateProperty<Color?>? overlayColor,
  21. double? splashRadius,
  22. FocusNode? focusNode,
  23. WidgetStatesController? statesController,
  24. ValueChanged<bool>? onFocusChange,
  25. bool autofocus = false,
  26. bool? applyCupertinoTheme,
  27. Color? tileColor,
  28. Widget? title,
  29. Widget? subtitle,
  30. bool? isThreeLine,
  31. bool? dense,
  32. EdgeInsetsGeometry? contentPadding,
  33. Widget? secondary,
  34. bool selected = false,
  35. ListTileControlAffinity? controlAffinity,
  36. ShapeBorder? shape,
  37. Color? selectedTileColor,
  38. VisualDensity? visualDensity,
  39. bool? enableFeedback,
  40. double? horizontalTitleGap,
  41. double? minVerticalPadding,
  42. double? minLeadingWidth,
  43. double? minTileHeight,
  44. Color? hoverColor,
  45. bool internalAddSemanticForOnTap = false,
})

Creates 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.

Implementation

const SwitchListTile.adaptive({
  super.key,
  required this.value,
  required this.onChanged,
  @Deprecated(
    'Use activeThumbColor or activeTrackColor instead. '
    'This feature was deprecated after v3.31.0-2.0.pre.',
  )
  this.activeColor,
  this.activeThumbColor,
  this.activeTrackColor,
  this.inactiveThumbColor,
  this.inactiveTrackColor,
  this.activeThumbImage,
  this.onActiveThumbImageError,
  this.inactiveThumbImage,
  this.onInactiveThumbImageError,
  this.thumbColor,
  this.trackColor,
  this.trackOutlineColor,
  this.thumbIcon,
  this.materialTapTargetSize,
  this.dragStartBehavior = DragStartBehavior.start,
  this.mouseCursor,
  this.overlayColor,
  this.splashRadius,
  this.focusNode,
  this.statesController,
  this.onFocusChange,
  this.autofocus = false,
  this.applyCupertinoTheme,
  this.tileColor,
  this.title,
  this.subtitle,
  this.isThreeLine,
  this.dense,
  this.contentPadding,
  this.secondary,
  this.selected = false,
  this.controlAffinity,
  this.shape,
  this.selectedTileColor,
  this.visualDensity,
  this.enableFeedback,
  this.horizontalTitleGap,
  this.minVerticalPadding,
  this.minLeadingWidth,
  this.minTileHeight,
  this.hoverColor,
  this.internalAddSemanticForOnTap = false,
}) : _switchListTileType = _SwitchListTileType.adaptive,
     assert(isThreeLine != true || subtitle != null),
     assert(activeThumbImage != null || onActiveThumbImageError == null),
     assert(inactiveThumbImage != null || onInactiveThumbImageError == null);