selectDateTimeRange static method

Future<List<DateTime>?> selectDateTimeRange({
  1. required dynamic context,
  2. required DateTime startDate,
  3. required DateTime endDate,
  4. DateTime? startFirstDate,
  5. DateTime? endFirstDate,
  6. DateTime? startLastDate,
  7. DateTime? endLastDate,
  8. DefaultTab? defaultTab,
  9. bool isSelectTime = false,
})

Implementation

static Future<List<DateTime>?> selectDateTimeRange({
  required context,
  required DateTime startDate,
  required DateTime endDate,
  DateTime? startFirstDate,
  DateTime? endFirstDate,
  DateTime? startLastDate,
  DateTime? endLastDate,
  DefaultTab? defaultTab,
  bool isSelectTime = false,
}) async {
  return await showOmniDateTimeRangePicker(
      defaultTab: defaultTab ?? DefaultTab.start,
      is24HourMode: false,
      isForce2Digits: true,
      padding: const EdgeInsets.all(NumberConst.INDEX_5_00),
      endWidget: GNBoldTextWidget(
        title: StringConst.TO_DATE,
        fontsize: subHeaderFontSize - 1.sp,
        fontcolor: Colors.grey.shade800,
      ),
      startWidget: GNBoldTextWidget(
        title: StringConst.FROM_DATE,
        fontsize: NumberConst.SUB_HEADER_FONT_SIZE - 1.sp,
        fontcolor: Colors.grey.shade800,
      ),
      startInitialDate: startDate,
      endInitialDate: endDate,
      endFirstDate: endFirstDate,
      endLastDate: endLastDate,
      startFirstDate: startFirstDate,
      startLastDate: startLastDate,
      isForceEndDateAfterStartDate: true,
      onStartDateAfterEndDateError: () {
        Get.snackbar(
          StringConst.EMPTY,
          StringConst.EMPTY,
          colorText: Colors.white,
          icon: Icon(
            Icons.warning_amber_outlined,
            color: Colors.white,
            size: 18.sp,
          ),
          titleText: GNSemiBoldTextWidget(
            title: StringConst.FROM_TO_DATE_ERROR_MESSAGE,
            fontsize: 11.sp,
            fontcolor: Colors.white,
          ),
          messageText: Container(),
          margin: const EdgeInsets.symmetric(vertical: 5, horizontal: 8),
          snackStyle: SnackStyle.FLOATING,
          snackPosition: SnackPosition.BOTTOM,
          backgroundColor: Colors.red,
          duration: const Duration(seconds: 4),
        );
      },
      transitionBuilder: (context, anim1, anim2, child) {
        return FadeTransition(
          opacity: anim1.drive(
            Tween(
              begin: NumberConst.ZERO_00,
              end: NumberConst.INDEX_1_00,
            ),
          ),
          child: child,
        );
      },
      transitionDuration: const Duration(milliseconds: NumberConst.DURATION_200),
      type: isSelectTime ? OmniDateTimePickerType.dateAndTime : OmniDateTimePickerType.date,
      theme: ThemeData(fontFamily: FONT_STYLE_QUICK_SEMI_BOLD, colorSchemeSeed: AppColors.DATE_TIME_PICKER_COLOR),
      context: context);
}