import 'package:flutter/material.dart'; import '../theme/app_theme.dart'; class SectionHeader extends StatelessWidget { final String label; final int? count; final bool collapsible; final bool collapsed; final VoidCallback? onToggle; final Widget? trailing; final Color? labelColor; const SectionHeader({ super.key, required this.label, this.count, this.collapsible = false, this.collapsed = false, this.onToggle, this.trailing, this.labelColor, }); @override Widget build(BuildContext context) { final theme = Theme.of(context); final tokens = context.appTokens; final mutedColor = labelColor != null ? labelColor!.withValues(alpha: 0.55) : tokens.mutedForeground; final row = Padding( padding: const EdgeInsets.symmetric(vertical: 10), child: Row( children: [ Text( label, style: theme.textTheme.titleSmall?.copyWith( fontWeight: FontWeight.w700, color: labelColor, ), ), if (count != null) ...[ const SizedBox(width: 8), Text( '$count', style: theme.textTheme.bodySmall?.copyWith(color: mutedColor), ), ], const Spacer(), if (trailing != null) trailing!, if (collapsible) AnimatedRotation( turns: collapsed ? -0.25 : 0, duration: const Duration(milliseconds: 180), child: Icon( Icons.keyboard_arrow_down_rounded, size: 20, color: mutedColor, ), ), ], ), ); if (!collapsible) return row; return InkWell( onTap: onToggle, borderRadius: BorderRadius.circular(6), child: row, ); } }