I am working on a flutter project where it is required by the user that the user must have to pick the time in hours:minutes:seconds
, by using showTimePicker()
I am able to pick the hours and minutes but i cannot find any way to pick the seconds. any help in this regard will be very helpful.
CodePudding user response:
flutter_time_picker_spinner provides functionality to select/pick seconds, one can observe it's source code or use this third party package as per requirement. Read the documentation to know more or get look on source code and modify the provided MaterialTimePicker.
Enjoy.
CodePudding user response:
Try this one,
TimePickerDialog tpd = TimePickerDialog.newInstance(
new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePickerDialog view, int hourOfDay, int minute, int second) {
//put some interesting code
}
},
now.get(Calendar.HOUR_OF_DAY),
now.get(Calendar.MINUTE),
true
);
tpd.setMinTime(10, 0, 0); // MIN: hours, minute, secconds
tpd.show(getFragmentManager(), "TimePickerDialog");
The easiest way to add the Material DateTime Picker
library to your project is by adding it as a dependency to your build.gradle
.