SwitchListTile.adaptive constructor Null safety

const SwitchListTile.adaptive(
  1. {Key? key,
  2. required bool value,
  3. required ValueChanged<bool>? onChanged,
  4. Color? tileColor,
  5. Color? activeColor,
  6. Color? activeTrackColor,
  7. Color? inactiveThumbColor,
  8. Color? inactiveTrackColor,
  9. ImageProvider<Object>? activeThumbImage,
  10. ImageProvider<Object>? inactiveThumbImage,
  11. Widget? title,
  12. Widget? subtitle,
  13. bool isThreeLine = false,
  14. bool? dense,
  15. EdgeInsetsGeometry? contentPadding,
  16. Widget? secondary,
  17. bool selected = false,
  18. bool autofocus = false,
  19. ListTileControlAffinity controlAffinity = ListTileControlAffinity.platform,
  20. ShapeBorder? shape,
  21. Color? selectedTileColor,
  22. VisualDensity? visualDensity,
  23. FocusNode? focusNode,
  24. bool? enableFeedback,
  25. Color? hoverColor}
)

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({
  Key? key,
  required this.value,
  required this.onChanged,
  this.tileColor,
  this.activeColor,
  this.activeTrackColor,
  this.inactiveThumbColor,
  this.inactiveTrackColor,
  this.activeThumbImage,
  this.inactiveThumbImage,
  this.title,
  this.subtitle,
  this.isThreeLine = false,
  this.dense,
  this.contentPadding,
  this.secondary,
  this.selected = false,
  this.autofocus = false,
  this.controlAffinity = ListTileControlAffinity.platform,
  this.shape,
  this.selectedTileColor,
  this.visualDensity,
  this.focusNode,
  this.enableFeedback,
  this.hoverColor,
}) : _switchListTileType = _SwitchListTileType.adaptive,
     assert(value != null),
     assert(isThreeLine != null),
     assert(!isThreeLine || subtitle != null),
     assert(selected != null),
     assert(autofocus != null),
     super(key: key);