ZetaListItem.toggle constructor

ZetaListItem.toggle({
  1. Key? key,
  2. bool? rounded,
  3. Widget? title,
  4. String? primaryText,
  5. String? secondaryText,
  6. TextStyle? primaryTextStyle,
  7. TextStyle? secondaryTextStyle,
  8. bool? showDivider,
  9. Widget? leading,
  10. bool value = false,
  11. ValueChanged<bool?>? onChanged,
})

Creates a ZetaListItem with a ZetaSwitch in the trailing widget space.

Implementation

ZetaListItem.toggle({
  super.key,
  super.rounded,
  this.title,
  this.primaryText,
  this.secondaryText,
  this.primaryTextStyle,
  this.secondaryTextStyle,
  this.showDivider,
  this.leading,
  bool value = false,
  ValueChanged<bool?>? onChanged,
})  : trailing = ZetaSwitch(
        value: value,
        onChanged: onChanged,
        variant: ZetaSwitchType.android,
      ),
      onTap = (() => onChanged?.call(!value)),
      assert(
        (title != null && primaryText == null && secondaryText == null) ||
            (title == null && (primaryText != null || secondaryText != null)),
        'Provide one of either title or primaryText/secondaryText',
      );