editDialog method

Future<void> editDialog()

Implementation

Future<void> editDialog() async {
  if (context != null && callback != null) {
    DateTime date = DateTime.now();
    try {
      date = DateTime.parse(pref.value.toString());
    } catch (e) {}

    final TimeOfDay? time = await showTimePicker(
      context: context!,
      initialTime: TimeOfDay.fromDateTime(date),
    );

    if (time != null) {
      date = DateTime(date.year, date.month, date.day, time.hour, time.minute,
          date.second, date.millisecond, date.microsecond);
      pref.value = date;
      callback!(pref);
    }
  }
}