showComicTimePicker function
Raises a clock and returns the confirmed time, or null on dismissal.
final time = await showComicTimePicker(context, value: ComicTime(19,30));
Implementation
Future<ComicTime?> showComicTimePicker(
BuildContext context, {
ComicTime? value,
int minuteStep = 1,
bool? use24hFormat,
String? title,
String? confirm,
String? cancel,
}) {
var picked = value;
return showComicDialog<ComicTime>(
context,
builder: (context) => StatefulBuilder(
builder: (context, setState) => ComicDialog(
title: title ?? ComicLocalizations.of(context).chooseTime,
content: [
ComicTimePicker(
value: picked,
minuteStep: minuteStep,
use24hFormat: use24hFormat,
onChanged: (time) => setState(() => picked = time),
),
],
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),
),
],
),
),
);
}