onTapDepartureDate method

void onTapDepartureDate()

Implementation

void onTapDepartureDate() async {
  if (navigatorKey.currentContext == null) {
    return;
  }

  var results = await showCalendarDatePicker2Dialog(
    context: navigatorKey.currentContext!,
    config: CalendarDatePicker2WithActionButtonsConfig(
      centerAlignModePicker: true,
      selectedDayHighlightColor: ColorHelper.primaryColor1,
      selectedRangeHighlightColor: ColorHelper.primaryColor1,
      daySplashColor: ColorHelper.primaryColor1,
      nextMonthIcon: Image.asset(
        'assets/myflights/next.png',
        color: ColorHelper.primaryColor1,
      ),
      lastMonthIcon: Image.asset(
        'assets/myflights/last.png',
        color: ColorHelper.primaryColor1,
      ),
      firstDate: DateTime(2000),
      currentDate: DateTime.now(),
    ),
    dialogSize: const Size(325, 400),
    value: [DateTime.now()],
    borderRadius: BorderRadius.circular(15),
  );

  if (results != null) {
    DateTime selectedDate = DateTime.parse(results[0].toString());
    departureDateFilterController.text =
        DateFormat('yyyy-MM-dd').format(selectedDate);
  }
}