showCalendar function

Future showCalendar(
  1. BuildContext context, {
  2. String title = "Choose Date & Time",
  3. DateTime? currentDate,
  4. CalHead? calHead,
  5. CalCell? calCell,
  6. TextConfig? textConfig,
  7. bool canSelectPastDate = false,
})

Implementation

Future<dynamic> showCalendar(
  BuildContext context, {
  String title = "Choose Date & Time",
  DateTime? currentDate,
  CalHead? calHead,
  CalCell? calCell,
  TextConfig? textConfig,
  bool canSelectPastDate = false,
}) async {
  return await showDialog(
      context: context,
      builder: (BuildContext context) {
        DateTime initDate = (currentDate ??= DateTime.now());

        return AlertDialog(
          title: Text(title),
          content: calWidget(initDate,
              w: MediaQuery.of(context).size.width - 80,
              calHead: calHead,
              calCell: calCell,
              textConfig: textConfig,
              canSelectPastDate: canSelectPastDate),
          insetPadding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
        );
      });
}