Description list
A description list pairs each label with a value for one record. Use it when readers need to look up individual facts about the same thing.
Inspect a booking
#Check the room and day for the first booking. Switch bookings and read the same two labels with their new values.
components/description-list/appliance/inspect_booking.dart
import 'package:flutter/widgets.dart';
import 'package:appliance_ui/appliance_ui.dart';
class InspectBooking extends StatefulWidget {
const InspectBooking({super.key});
@override
State<InspectBooking> createState() => _InspectBookingState();
}
class _InspectBookingState extends State<InspectBooking> {
bool second = false;
@override
Widget build(BuildContext context) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 440),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ApplianceDescriptionList(
items: [
('Room', second ? 'Loft' : 'Hall'),
('Day', second ? 'Friday' : 'Monday'),
],
),
const SizedBox(height: 12),
ApplianceButton(
second ? 'First booking' : 'Second booking',
onPressed: () => setState(() => second = !second),
),
],
),
),
);
}
Parameters
ApplianceDescriptionList API ↗items- The terms and their values, in order.
style- Overrides the component’s themed appearance for this instance.
Shared behaviour
- Keyboard and focus. Tab to the booking switch and activate it. The individual facts are available in reading order.
- Screen readers. Read Room with its name, then Day with its value. Those pairings stay intact when you switch records.
- Direction and type. Compare where the label and value sit in RTL and at 200%. A value can move beneath its label in a narrow layout.