Closed matteoberla closed 7 months ago
@matteoberla
Would it be better to have a callback with another type instead of the DateTime type for the time
selection?
It is true that it does not seem necessary to have a DateTime type for time
only.
For example, how about defining another class to receive the hour and minute in a callback?
class BoardDateTimeDurationResult {
final int hour;
final int minute;
}
Yes it makes a lot of sense to have a separate callback when time/duration mode is used, that would be perfect!
@matteoberla
Implemented onResult
method.
onResult: (val) {
print('${val.hour}, ${val.minute});
}
In addition to the traditional showBoardDateTimePicker
method, a method for each type has been defined.
By using this one, you do not have to define the type of the onResult
parameter, but it will return the one that matches the type you want to display.
showBoardDateTimePickerForDateTime
: BoardDateTimeResult
showBoardDateTimePickerForDate
: BoardDateResult
showBoardDateTimePickerForTime
: BoardTimeResult
In the case of a regular Builder, generics can be used to obtain onResult
results. Please use it if necessary.
We will release v1.4.0 with this issue, so please be patient!
This is a perfect solution. I'll test it as soon as you will release the new version. Thank you very much, I really appreciate it.
Just asking if the following it's possible and could be a valid idea:
At the moment I'm using the library also as duration picker, but I need to convert every time the DateTime to a Duration which is fine, but not ideal.
I was wondering if it's possible to add duration as pickerType, pickers showed would be same as pickerType.time one, but the returned value would be a Duration.