Section header
A section header names the group that follows it. Put it immediately before the rows it describes so a reader can tell where a new group begins.
Browse the agenda
#Read today’s agenda, then switch to the other day. The heading and the appointment beneath it change together.
components/section-header/appliance/browse_days.dart
import 'package:flutter/widgets.dart';
import 'package:appliance_ui/appliance_ui.dart';
class BrowseDays extends StatefulWidget {
const BrowseDays({super.key});
@override
State<BrowseDays> createState() => _BrowseDaysState();
}
class _BrowseDaysState extends State<BrowseDays> {
bool tomorrow = false;
@override
Widget build(BuildContext context) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 440),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ApplianceSectionHeader(tomorrow ? 'Tomorrow' : 'Today'),
const SizedBox(height: 12),
Text(tomorrow ? '10 am · Walk' : '2 pm · Workshop'),
const SizedBox(height: 12),
ApplianceButton(
tomorrow ? 'Show today' : 'Show tomorrow',
onPressed: () => setState(() => tomorrow = !tomorrow),
),
],
),
),
);
}
Parameters
ApplianceSectionHeader API ↗text- Supplies the displayed text.
trailing- What stands at its end.
style- Overrides the component’s themed appearance for this instance.
Shared behaviour
- Keyboard and focus. Tab to the day switch and activate it. The section title and its content are read together in document order.
- Screen readers. Read the day followed by its appointment. After switching days, check the new title in the same place.
- Direction and type. The heading follows the reading direction. Larger type shows how much room the title leaves for its content.