SwitchTile constructor
const
SwitchTile({
- Key? key,
- TileWidgetPosition checkPosition = TileWidgetPosition.trailing,
- Widget? title,
- Widget? subtitle,
- Widget? leading,
- Widget? trailing,
- ValueChanged<
bool> ? onChanged, - double knownIconSize = 20,
- EdgeInsets contentPadding = const EdgeInsets.symmetric(vertical: 4, horizontal: 18),
- EdgeInsets leadingPadding = const EdgeInsets.only(right: 10, top: 4),
- EdgeInsets trailingPadding = const EdgeInsets.only(left: 10, top: 4),
- bool sliver = false,
- bool? value,
Creates a SwitchTile with customizable content and switch behavior.
- The
titleandsubtitledefine the primary and secondary text, styled via ArcaneTheme. leadingandtrailingallow custom widgets; the switch position is controlled bycheckPosition(defaults to trailing).valuerepresents the switch state (null defaults to false);onChangedhandles toggle callbacks, converting to bool.- Padding defaults:
contentPaddingfor overall spacing,leadingPaddingandtrailingPaddingfor icon alignment. sliverenables sliver mode for SliverScreen integration;knownIconSizeoptimizes layout calculations. Initialization uses const constructor for performance, promoting reuse in lists without rebuilds.
Implementation
const SwitchTile({
super.key,
this.checkPosition = TileWidgetPosition.trailing,
this.title,
this.subtitle,
this.leading,
this.trailing,
this.onChanged,
this.knownIconSize = 20,
this.contentPadding =
const EdgeInsets.symmetric(vertical: 4, horizontal: 18),
this.leadingPadding = const EdgeInsets.only(right: 10, top: 4),
this.trailingPadding = const EdgeInsets.only(left: 10, top: 4),
this.sliver = false,
this.value,
});