Date range picker
A date range picker takes two related dates, such as arrival and departure. Showing the interval helps the reader check which days are included.
Book a date range
#Choose the first and last days of a stay. Try another pair to replace the original booking.
Use the calendar arrows to reach later dates.
components/date-range-picker/appliance/book_dates.dart
import 'package:flutter/widgets.dart';
import 'package:material_ui/material_ui.dart' show MaterialLocalizations;
import 'package:appliance_ui/appliance_ui.dart';
class BookDates extends StatefulWidget {
const BookDates({super.key});
@override
State<BookDates> createState() => _BookDatesState();
}
class _BookDatesState extends State<BookDates> {
DesignDateRange? stay;
String bookingSummary(BuildContext context) {
final start = stay?.start;
final end = stay?.end;
if (start == null) return 'Choose an arrival date';
final dates = MaterialLocalizations.of(context);
if (end == null) return 'Arrival: ${dates.formatCompactDate(start)}';
return 'Stay: ${dates.formatCompactDate(start)} – ${dates.formatCompactDate(end)}';
}
@override
Widget build(BuildContext context) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 440),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ApplianceDateRangePicker(
label: 'Stay',
firstDate: DateTime(2026, 11),
lastDate: DateTime(2026, 12, 31),
currentDate: DateTime(2026, 11, 12),
value: stay,
onChanged: (next) => setState(() => stay = next),
),
const SizedBox(height: 12),
Text(bookingSummary(context)),
],
),
),
);
}
Parameters
ApplianceDateRangePicker API ↗value- Selected arrival and departure dates.
firstDate- First available day.
lastDate- Last available day.
onChanged- Receives the chosen interval.
Shared behaviour
- Keyboard and focus. Tab to the calendar or its opener. Use the day controls to choose both endpoints, confirming the choice when the look offers a confirmation action.
- Screen readers. Inspect the day labels and the selected range. The booking summary prints both ends once the selection is complete.
- Direction and type. Try the month controls in RTL. At phone width and larger text, scroll within the example to reach the whole grid.