CupertinoTimerPicker constructor

CupertinoTimerPicker({
  1. Key? key,
  2. CupertinoTimerPickerMode mode = CupertinoTimerPickerMode.hms,
  3. Duration initialTimerDuration = Duration.zero,
  4. int minuteInterval = 1,
  5. int secondInterval = 1,
  6. AlignmentGeometry alignment = Alignment.center,
  7. Color? backgroundColor,
  8. required ValueChanged<Duration> onTimerDurationChanged,
})

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 and must not be null.

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({
  Key? key,
  this.mode = CupertinoTimerPickerMode.hms,
  this.initialTimerDuration = Duration.zero,
  this.minuteInterval = 1,
  this.secondInterval = 1,
  this.alignment = Alignment.center,
  this.backgroundColor,
  required this.onTimerDurationChanged,
})  : 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),
      super(key: key);