frosty/lib/widgets/expandable_section_header.dart
Tommy Chow 289d513af2 style(ui): lift section-header alpha 0.5->0.6 to match muted-label tier
Section headers and the expandable chevron were muted to onSurfaceVariant
@ 0.5 — a notch below the app's own secondary-text floor (theme.dart uses
0.6-0.7 for hint/leading/trailing labels) and borderline for 12px
uppercase against WCAG AA. 0.6 keeps the muted look while landing on the
existing leadingAndTrailingTextStyle tier. TabBars already use M3 default
primary-on-selected (consistent with the new bottom nav); nav inactive
icons stay at 0.5 (24px glyphs, intentional).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 21:40:27 -07:00

79 lines
2.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:frosty/utils/context_extensions.dart';
class ExpandableSectionHeader extends StatelessWidget {
final String text;
final EdgeInsets? padding;
final double? fontSize;
final bool isFirst;
final bool isExpanded;
final VoidCallback? onToggle;
const ExpandableSectionHeader(
this.text, {
super.key,
this.padding,
this.fontSize,
this.isFirst = false,
required this.isExpanded,
this.onToggle,
});
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onToggle != null
? () {
HapticFeedback.selectionClick();
onToggle!();
}
: null,
child: Padding(
padding:
padding ??
EdgeInsets.fromLTRB(
16 + MediaQuery.of(context).padding.left,
0,
16 + MediaQuery.of(context).padding.right,
8,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
if (!isFirst) ...[const SizedBox(height: 32)],
Row(
children: [
Expanded(
child: Text(
text.toUpperCase(),
style: TextStyle(
fontSize: fontSize ?? 12,
fontWeight: FontWeight.w500,
letterSpacing: 0.8,
color: context.colorScheme.onSurfaceVariant.withValues(
alpha: 0.6,
),
),
),
),
AnimatedRotation(
turns: isExpanded ? 0.5 : 0.0,
duration: const Duration(milliseconds: 200),
child: Icon(
Icons.keyboard_arrow_down,
color: context.colorScheme.onSurfaceVariant.withValues(
alpha: 0.6,
),
size: 20,
),
),
],
),
],
),
),
);
}
}