showBigFlightDatePicker method

void showBigFlightDatePicker(
  1. dynamic positionKey,
  2. dynamic context
)

Implementation

void showBigFlightDatePicker(positionKey, context) {
    final RenderBox renderBox =
    positionKey.currentContext!.findRenderObject() as RenderBox;
    final position = renderBox.localToGlobal(Offset.zero);
    final size = renderBox.size;
    showMenu(
 context: context,
 elevation: 8,
 surfaceTintColor: Colors.transparent,
 shadowColor: ColorHelper.black,
 shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
 color: Colors.white,
 constraints: BoxConstraints(maxWidth: 420.dp),
 position: RelativeRect.fromLTRB(
   position.dx,
   position.dy + size.height, // Position below the widget
   position.dx + size.width,
   position.dy + size.height * 2,
 ),
 items: [
   PopupMenuItem(
     enabled: false,
     child: SizedBox(
       width: 500,
       height: 250,
       child: SfDateRangePicker(
         view: DateRangePickerView.month,
         enableMultiView: true,
         selectionMode:  DateRangePickerSelectionMode.range,
         showActionButtons: false,
         showNavigationArrow: true,
         backgroundColor: Colors.white,
         headerStyle: const DateRangePickerHeaderStyle(
           backgroundColor: ColorHelper.white,
           textAlign: TextAlign.center,
         ),
         todayHighlightColor: Colors.transparent,
         selectionColor: ColorHelper.primaryColor1,
         startRangeSelectionColor: ColorHelper.primaryColor1,
         endRangeSelectionColor: ColorHelper.primaryColor1,
         rangeSelectionColor: ColorHelper.primaryColor1.withOpacity(0.12),
         minDate: DateTime.now(),
         onSelectionChanged: (args) {

             final range = args.value as PickerDateRange;
             String formattedDate1 = DateFormat('EEE, dd/MM/yy')
                 .format(range.startDate ?? DateTime(1990));
             searchCheckInDate.value = formattedDate1;
             searchCheckOutDate.value = '';
             if (range.endDate != null) {
               String formattedDate2 = DateFormat('EEE, dd/MM/yy')
                   .format(range.endDate ?? DateTime(1990));
               searchCheckOutDate.value = formattedDate2;
               closeDialog();

           }
         },
       ),
     ),
   ),
 ],
    );
  }