import 'package:calendar_date_picker2/calendar_date_picker2.dart'; import 'package:flutter/material.dart'; import 'package:flutter_rounded_date_picker/flutter_rounded_date_picker.dart'; import 'package:get/get.dart'; import '../res/app_colors.dart'; class DatePicker { static Future showDatePicker(BuildContext context) async { return await showRoundedDatePicker( borderRadius: 10, context: context, onTapDay: (date, test) { return true; }, textPositiveButton: "Yes", theme: ThemeData( primarySwatch: Colors.green, ), styleDatePicker: MaterialRoundedDatePickerStyle( textStyleDayButton: const TextStyle(fontSize: 25, color: Colors.white), textStyleYearButton: const TextStyle( fontSize: 15, color: Colors.white, ), textStyleDayHeader: const TextStyle( fontSize: 14, color: AppColors.colorPrimary, ), backgroundHeader: AppColors.colorPrimary, textStyleCurrentDayOnCalendar: const TextStyle( fontSize: 12, color: Colors.grey, fontWeight: FontWeight.normal), textStyleDayOnCalendar: TextStyle(fontSize: 12, color: Colors.black.withOpacity(0.9)), textStyleDayOnCalendarSelected: TextStyle( fontSize: 12, color: AppColors.white.withOpacity(0.9), fontWeight: FontWeight.bold), textStyleDayOnCalendarDisabled: TextStyle(fontSize: 12, color: Colors.grey.withOpacity(0.1)), textStyleMonthYearHeader: TextStyle( fontSize: 12, color: Colors.black.withOpacity(0.9), fontWeight: FontWeight.bold), // paddingDatePicker: EdgeInsets.all(0), // paddingMonthHeader: EdgeInsets.all(15), paddingActionBar: const EdgeInsets.all(5), paddingDateYearHeader: const EdgeInsets.all(10), sizeArrow: 20, colorArrowNext: Colors.black.withOpacity(0.9), colorArrowPrevious: Colors.black.withOpacity(0.9), marginLeftArrowPrevious: 8, marginTopArrowPrevious: 8, marginTopArrowNext: 8, marginRightArrowNext: 8, // textStyleButtonAction: TextStyle(fontSize: 208, color: Colors.white), textStyleButtonPositive: const TextStyle( fontSize: 15, color: Colors.white, fontWeight: FontWeight.bold), textStyleButtonNegative: TextStyle(fontSize: 15, color: Colors.white.withOpacity(0.5)), decorationDateSelected: const BoxDecoration( color: AppColors.colorPrimary, shape: BoxShape.circle), backgroundPicker: AppColors.white.withOpacity(0.9), backgroundActionBar: AppColors.colorPrimary.withOpacity(0.9), // backgroundHeaderMonth: AppColors.primary.withOpacity(0.9), ), styleYearPicker: MaterialRoundedYearPickerStyle( textStyleYear: const TextStyle(fontSize: 20, color: Colors.grey), textStyleYearSelected: const TextStyle( fontSize: 20, color: Colors.grey, fontWeight: FontWeight.bold), heightYearRow: 30, backgroundPicker: AppColors.colorPrimary.withOpacity(0.3), )); // Toasty.success("--------->>> " + newDateTime.toString()); } static Future?> showRangeDatePicker() async { return showCalendarDatePicker2Dialog( context: Get.context!, config: CalendarDatePicker2WithActionButtonsConfig( calendarType: CalendarDatePicker2Type.range, allowSameValueSelection: false, currentDate: DateTime.now(), firstDate: DateTime(2020), lastDate: DateTime.now().add(Duration(days: 1)), ), dialogSize: Size(Get.width, 150), ); } }