Open evandrmb opened 2 years ago
Hi @evandrmb, Thanks for filing the issue. That looks like a valid proposal to me,
This is how flutter's CupertinoTimePicker looks with CupertinoTimerPickerMode.hms
Probably we should have another enum to hide the text.
Any updates on this feature request?
Hiding the labels would also be useful in use cases where we want to use the CupertinoTimePicker to pick a time, e.g. for the start time of a calendar event in a calendar app, where the current implementation that has hours
and minutes
(referring to the Duration
, makes this use case rather confusing for the users.
A simple addition to the CupertinoTimerPickerMode
enum would be fine, as we can keep working with Durations
and use the following extensions to convert the Duration
to TimeOfDay
for the use case of i've mentioned above:
extension ExtTimeOfDay on TimeOfDay {
Duration get asDuration {
return Duration(hours: hour, minutes: minute);
}
}
extension ExtDuration on Duration {
TimeOfDay get asTime {
// You may add seconds if needed
return TimeOfDay(hour: inHours, minute: inMinutes % Duration.minutesPerHour);
}
}
Use case
By default,
CupertinoTimePicker
displays the number and what it represents like1 hour 24 min.
. But if we take a closer look at Apple's native Clock app, we can see that the TimePicker displayed there is built only with numbersProposal
I believe a boolean parameter could be added in order to either display or hide the text.