showPopup method

void showPopup(
  1. BuildContext context,
  2. DateTime date,
  3. dynamic onClose(
    1. DateTime endDate
    )
)

Implementation

void showPopup(BuildContext context, DateTime date, Function(DateTime endDate) onClose) {
  DateTime selectedDate = date;
  //Если не задана дата (<1755) устанавливаем initialTime как начальную
  //Иначе, при нажатии на галку не происходит выбор даты
  if (selectedDate.year < 1800) {
    selectedDate = initialTime;
  }

  showDialog(
    context: context,
    builder: (BuildContext context) => NsgPopUp(
      title: tran.select_date,
      //height: 410,
      onConfirm: () {
        onClose(selectedDate);
      },
      onCancel: () {
        Navigator.of(context).pop();
        //Get.back();
      },
      getContent: () => [
        DatePickerContent(
          textAlign: textAlign,
          firstDateTime: firstDateTime,
          lastDateTime: lastDateTime,
          initialTime: initialTime,
          onChange: (endDate) {
            selectedDate = endDate;
          },
        ),
      ],
    ),
  );
}