openModal method

void openModal(
  1. BuildContext context
)

Implementation

void openModal(BuildContext context) {
  CalendarStyle<T> calendarStyle = CalendarStyle.of<T>(context);
  var eventStyle = calendarStyle.getEventStyle(event);
  var calendarText = CalendarText.of(context);

  var modalOptions = CalendarEventModalOptions.of<T>(context);

  if (ScreenSizes.isMobile(context)) {
    showModalBottomSheet<void>(
        context: context,
        backgroundColor: calendarStyle.primaryBackgroundColor,
        barrierColor: calendarStyle.barrierColor,
        isScrollControlled: true,
        constraints: BoxConstraints(
            maxHeight: (MediaQuery.of(context).size.height) - 50,
            maxWidth: (MediaQuery.of(context).size.width) - 40),
        shape: const RoundedRectangleBorder(
          borderRadius: BorderRadius.only(
            topLeft: Radius.circular(20),
            topRight: Radius.circular(20),
          ),
        ),
        builder: (BuildContext context) {
          return CalendarEventModal<T>(
            event: event,
            style: calendarStyle,
            eventStyle: eventStyle,
            text: calendarText,
            options: modalOptions,
          );
        });
  } else {
    showDialog(
      context: context,
      barrierColor: calendarStyle.barrierColor,
      builder: (context) => Center(
          child: SizedBox(
        width: 600,
        child: Wrap(
          direction: Axis.horizontal,
          crossAxisAlignment: WrapCrossAlignment.start,
          spacing: 5,
          runSpacing: 5,
          children: [
            CalendarEventModal<T>(
              event: event,
              style: calendarStyle,
              eventStyle: eventStyle,
              text: calendarText,
              options: modalOptions,
              dialog: true,
            )
          ],
        ),
      )),
    );
  }
}