SwitchTile constructor

const SwitchTile({
  1. Key? key,
  2. TileWidgetPosition checkPosition = TileWidgetPosition.trailing,
  3. Widget? title,
  4. Widget? subtitle,
  5. Widget? leading,
  6. Widget? trailing,
  7. ValueChanged<bool>? onChanged,
  8. double knownIconSize = 20,
  9. EdgeInsets contentPadding = const EdgeInsets.symmetric(vertical: 4, horizontal: 18),
  10. EdgeInsets leadingPadding = const EdgeInsets.only(right: 10, top: 4),
  11. EdgeInsets trailingPadding = const EdgeInsets.only(left: 10, top: 4),
  12. bool sliver = false,
  13. bool? value,
})

Creates a SwitchTile with customizable content and switch behavior.

  • The title and subtitle define the primary and secondary text, styled via ArcaneTheme.
  • leading and trailing allow custom widgets; the switch position is controlled by checkPosition (defaults to trailing).
  • value represents the switch state (null defaults to false); onChanged handles toggle callbacks, converting to bool.
  • Padding defaults: contentPadding for overall spacing, leadingPadding and trailingPadding for icon alignment.
  • sliver enables sliver mode for SliverScreen integration; knownIconSize optimizes 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,
});