import 'package:flutter/material.dart'; import '../../core/theme/app_colors.dart'; /// Shared Settings switch styling so each card matches the rest of the page. class SettingsSwitch extends StatelessWidget { const SettingsSwitch({ super.key, required this.value, required this.onChanged, required this.semanticsLabel, this.enabled = true, }); final bool value; final ValueChanged onChanged; final String semanticsLabel; final bool enabled; @override Widget build(BuildContext context) { final colors = context.colors; return Semantics( label: semanticsLabel, child: Switch( value: value, onChanged: enabled ? onChanged : null, thumbColor: WidgetStateProperty.resolveWith((states) { if (states.contains(WidgetState.disabled)) { return colors.inkFaint.withValues(alpha: 0.45); } return states.contains(WidgetState.selected) ? colors.accentInk : colors.inkFaint; }), trackColor: WidgetStateProperty.resolveWith((states) { if (states.contains(WidgetState.disabled)) { return colors.surfaceStrong.withValues(alpha: 0.5); } return states.contains(WidgetState.selected) ? colors.accent : colors.surfaceStrong; }), trackOutlineColor: WidgetStatePropertyAll( colors.border.withValues(alpha: enabled ? 1 : 0.5), ), ), ); } }