Carousel
Use a carousel when the reader can inspect a short sequence one item at a time. Keep the order stable and let the reader choose when to move.
Browse the rooms
#Move from the Hall to the Studio, then return. Try the carousel’s navigation as well as dragging the slides.
components/carousel/appliance/browse_rooms.dart
import 'package:flutter/widgets.dart';
import 'package:appliance_ui/appliance_ui.dart';
class BrowseRooms extends StatelessWidget {
const BrowseRooms({super.key});
@override
Widget build(BuildContext context) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 440),
child: ApplianceCarousel(
semanticLabel: 'Rooms',
height: 112,
itemCount: 3,
itemBuilder: (context, i) =>
Center(child: Text(const ['Hall', 'Studio', 'Loft'][i])),
),
);
}
Parameters
ApplianceCarousel API ↗itemCount- How many slides.
itemBuilder- Builds a slide.
height- The window's height.
loop- Whether the last slide turns to the first.
onPageChanged- Called with the slide turned to.
semanticLabel- Its name for a screen reader.
style- Overrides the component’s themed appearance for this instance.
Shared behaviour
- Keyboard and focus. Tab into the carousel or its controls. Try its arrow keys or navigation buttons to move to the adjacent room.
- Screen readers. Read the room name and the position information the look provides as you move between slides.
- Direction and type. Check the direction of travel in RTL. Try the phone preview at 200% and read the room on each slide.