Interval Time Picker
This package modifies the 2.8.0 (dev version) of the default Flutter Time Picker widget by adding interval options.
Version 1.0.0 now uses sound Null Safety and requires Dart SDK 2.12 or higher.
pubspec.yaml of your flutter project, add the following dependency:
dependencies: ... interval_time_picker: ^1.0.0+3
On top of your code add the following import:
In your code you can then call:
showIntervalTimePicker( context: context, initialTime: TimeOfDay.fromDateTime(DateTime.now()), interval: 5, visibleStep: VisibleStep.Fifths, );
This package adds two parameters:
In most cases it is recommended to set the Interval and VisibleStep as the same:
interval is the steps the Interval Time Picker uses when validating the chosen time (minutes) as well as the steps it rounds off to.
The default and minimum value is 1 minute. The maximum is 30 minute.
It is actually possible to also use an interval that is not a factor of 60.
So i.e., if you are weird and want to use 7 you can use that. In that case the highest pickable minute is 56 and going higher will pick 0.
This package also fixes the issue that individual minutes are only selectable by dragging the ring:
Flutter issue #62424
visibleStep are the minute labels that are visible on the ring. Choose the steps by using the
The options are a factor of 60 with 5 being the lowest and 30 being the highest. The default value is
If the initial minute is not a multiplication of the interval it will show that minute.
So handle this yourself when calling
The latest release has only been tested with Flutter version 2.5.3 (stable).