CupertinoTimerPicker constructor
CupertinoTimerPicker({
- Key? key,
- CupertinoTimerPickerMode mode = CupertinoTimerPickerMode.hms,
- Duration initialTimerDuration = Duration.zero,
- int minuteInterval = 1,
- int secondInterval = 1,
- AlignmentGeometry alignment = Alignment.center,
- Color? backgroundColor,
- double itemExtent = _kItemExtent,
- required ValueChanged<
Duration> onTimerDurationChanged, - SelectionOverlayBuilder? selectionOverlayBuilder,
Constructs an iOS style countdown timer picker.
mode
is one of the modes listed in CupertinoTimerPickerMode and
defaults to CupertinoTimerPickerMode.hms.
onTimerDurationChanged
is the callback called when the selected duration
changes.
initialTimerDuration
defaults to 0 second and is limited from 0 second
to 23 hours 59 minutes 59 seconds.
minuteInterval
is the granularity of the minute spinner. Must be a
positive integer factor of 60.
secondInterval
is the granularity of the second spinner. Must be a
positive integer factor of 60.
Implementation
CupertinoTimerPicker({
super.key,
this.mode = CupertinoTimerPickerMode.hms,
this.initialTimerDuration = Duration.zero,
this.minuteInterval = 1,
this.secondInterval = 1,
this.alignment = Alignment.center,
this.backgroundColor,
this.itemExtent = _kItemExtent,
required this.onTimerDurationChanged,
this.selectionOverlayBuilder,
}) : assert(initialTimerDuration >= Duration.zero),
assert(initialTimerDuration < const Duration(days: 1)),
assert(minuteInterval > 0 && 60 % minuteInterval == 0),
assert(secondInterval > 0 && 60 % secondInterval == 0),
assert(initialTimerDuration.inMinutes % minuteInterval == 0),
assert(initialTimerDuration.inSeconds % secondInterval == 0),
assert(itemExtent > 0, 'item extent should be greater than 0');