Time picker
A time picker sets the hour and minute of a recurring event. A date is unnecessary when the reminder repeats every day.
Set a reminder time
#Move the reminder from 09:30 to another time. Some looks present the hour and minute inline, while others open a picker from the displayed time.
components/time-picker/appliance/set_reminder.dart
import 'package:flutter/widgets.dart';
import 'package:appliance_ui/appliance_ui.dart';
class SetReminder extends StatefulWidget {
const SetReminder({super.key});
@override
State<SetReminder> createState() => _SetReminderState();
}
class _SetReminderState extends State<SetReminder> {
var reminder = const ApplianceTime(9, 30);
@override
Widget build(BuildContext context) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 440),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ApplianceTimePicker(
semanticLabel: 'Reminder',
value: reminder,
onChanged: (next) => setState(() => reminder = next),
),
const SizedBox(height: 12),
Text(
"Reminder: ${reminder.hour.toString().padLeft(2, '0')}:${reminder.minute.toString().padLeft(2, '0')}",
),
],
),
),
);
}
Parameters
ApplianceTimePicker API ↗value- Hour and minute of the reminder.
onChanged- Receives the updated reminder time.
Shared behaviour
- Keyboard and focus. Focus the hour or minute control and change its value. Use any confirmation action offered by the picker to apply the new time.
- Screen readers. Inspect the names of the hour and minute controls and read the reminder’s time below them.
- Direction and type. In RTL, check the order of the controls and read the time as a single value. Scroll inside the preview when larger type needs more height.