DatePicker static method
void
DatePicker({})
DatePicker Method
lastDate if it's null it'll automatically generate from (DateTime.now()) to next 100 years
firstDate if it's null it'll automatically generate from (DateTime.now()) to past 100 years
initialDate if it's null it's (DateTime.now())
Implementation
static void DatePicker({required BuildContext context, DateTime? initialDate, DateTime? firstDate, DateTime? lastDate, required Function(DateTime?)? onChanged, Color bgColor = Colors.white}) async {
var last = lastDate ?? DateTime.now().add(const Duration(days: 36500));
var first = firstDate ?? DateTime.now().subtract(const Duration(days: 36500));
var initial = initialDate ?? DateTime.now();
CustomDatePickerDialog.show(context, initialDate: initial, firstDate: first, lastDate: last, onChanged: onChanged, bgColor: bgColor);
// DateTime? pickedDate = await showDatePicker(
// helpText: "CURRENT DATE",
// initialEntryMode: DatePickerEntryMode.calendar,
// context: context,
// initialDate: initial,
// firstDate: first,
// lastDate: last);
//
// if (pickedDate != null) {
// onChanged?.call(pickedDate);
// }
}