showComicDateRangePicker function
Future<DesignDateRange?>
showComicDateRangePicker(
- BuildContext context, {
- required DateTime firstDate,
- required DateTime lastDate,
- DesignDateRange? value,
- DateTime? currentDate,
- String? title,
- String? confirm,
- String? cancel,
Raises a ComicDateRangePicker in the dialog and returns the confirmed span, or null on dismissal.
final stay = await showComicDateRangePicker(context, firstDate: DateTime(2026), lastDate: DateTime(2027));
Implementation
Future<DesignDateRange?> showComicDateRangePicker(
BuildContext context, {
required DateTime firstDate,
required DateTime lastDate,
DesignDateRange? value,
DateTime? currentDate,
String? title,
String? confirm,
String? cancel,
}) {
var picked = value;
return showComicDialog<DesignDateRange>(
context,
builder: (context) => StatefulBuilder(
builder: (context, setState) => ComicDialog(
title: title ?? ComicLocalizations.of(context).chooseDate,
content: [
ComicDateRangePicker(
firstDate: firstDate,
lastDate: lastDate,
value: picked,
currentDate: currentDate,
onChanged: (span) => setState(() => picked = span),
),
],
actions: [
ComicButton(
cancel ?? DesignLocalizations.of(context).cancelButtonLabel,
onPressed: () => Navigator.pop(context),
),
ComicButton.filled(
confirm ?? ComicLocalizations.of(context).choose,
size: ComicButtonSize.small,
onPressed: picked == null
? null
: () => Navigator.pop(context, picked),
),
],
),
),
);
}