Wheel picker
A wheel or stepped dial makes an ordered set of values easy to browse one at a time. It works best when nearby choices have a natural sequence.
Choose a day with a wheel
#Choose a day in November. Ledger supplies a date wheel, Appliance a knob with stops, and the other examples a short list of days.
components/wheel-picker/appliance/choose_day.dart
import 'package:flutter/widgets.dart';
import 'package:appliance_ui/appliance_ui.dart';
class ChooseDay extends StatefulWidget {
const ChooseDay({super.key});
@override
State<ChooseDay> createState() => _ChooseDayState();
}
class _ChooseDayState extends State<ChooseDay> {
int day = 12;
@override
Widget build(BuildContext context) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 400),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ApplianceKnob<int>(
semanticLabel: 'Day in November',
options: const [
ApplianceKnobOption(value: 10, label: '10'),
ApplianceKnobOption(value: 11, label: '11'),
ApplianceKnobOption(value: 12, label: '12'),
ApplianceKnobOption(value: 13, label: '13'),
ApplianceKnobOption(value: 14, label: '14'),
],
value: day,
onChanged: (next) => setState(() => day = next),
),
const SizedBox(height: 12),
Text('November $day'),
],
),
),
);
}
Parameters
ApplianceKnob API ↗options- Days available in order.
value- Currently selected day.
onChanged- Receives the day at the selected stop.
Shared behaviour
- Keyboard and focus. Focus the wheel or dial and use the arrows to move between adjacent values.
- Screen readers. Inspect the control’s day label and value. The text beneath it gives the selected day.
- Direction and type. In RTL the labels follow reading direction. Compare the current item with its neighbours at the larger text size.