Grouped list
A grouped list puts related rows under one subject. Use it when the rows make more sense together than they would as separate cards.
Choose a delivery channel
#Choose Email or Post under Delivery. The line beneath the group shows which channel will be used.
components/grouped-list/appliance/choose_channel.dart
import 'package:flutter/widgets.dart';
import 'package:appliance_ui/appliance_ui.dart';
class ChooseChannel extends StatefulWidget {
const ChooseChannel({super.key});
@override
State<ChooseChannel> createState() => _ChooseChannelState();
}
class _ChooseChannelState extends State<ChooseChannel> {
String channel = 'Email';
@override
Widget build(BuildContext context) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 440),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ApplianceListGroup(
header: 'Delivery',
children: [
ApplianceListTile(
title: 'Email',
onTap: () => setState(() => channel = 'Email'),
),
ApplianceListTile(
title: 'Post',
onTap: () => setState(() => channel = 'Post'),
),
],
),
const SizedBox(height: 12),
Text('Deliver by $channel'),
],
),
),
);
}
Parameters
ApplianceListGroup API ↗children- The rows.
header- The caps legend over the plate.
headerTrailing- What stands at the legend's end.
footer- A note under the plate.
style- The plate's style, over ApplianceThemeData.panelStyle.
Shared behaviour
- Keyboard and focus. Tab through the two actions and activate a channel. The current choice appears below the rows.
- Screen readers. Read the two choices in order, then continue to the line that names the chosen channel.
- Direction and type. The choices keep their vertical order in RTL. At larger text sizes check that both actions remain readable.