showJHijriPicker function

Future<HijriDate?> showJHijriPicker({
  1. required BuildContext context,
  2. JDateModel? selectedDate,
  3. JDateModel? startDate,
  4. JDateModel? endDate,
  5. DatePickerMode pickerMode = DatePickerMode.day,
  6. String? okButton,
  7. PickerType pickerType = PickerType.JHijri,
  8. String? cancelButton,
  9. Widget? headerTitle,
  10. Widget? buttons,
  11. dynamic onOk(
    1. HijriDate datetime
    )?,
  12. dynamic onChange(
    1. HijriDate datetime
    )?,
  13. VoidCallback? onCancel,
  14. ThemeData? theme,
  15. Color? primaryColor,
  16. Color? backgroundColor,
  17. Color? calendarTextColor,
  18. Color? buttonTextColor,
  19. SelectableDayPredicate? selectableDayPredicate,
  20. Radius? borderRadius,
  21. TextDirection? textDirection,
  22. Locale? locale,
})

Implementation

Future<HijriDate?> showJHijriPicker({
  required BuildContext context,
  JDateModel? selectedDate,
  JDateModel? startDate,
  JDateModel? endDate,
  DatePickerMode pickerMode = DatePickerMode.day,
  String? okButton,
  PickerType pickerType = PickerType.JHijri,
  String? cancelButton,
  Widget? headerTitle,
  Widget? buttons,
  Function(HijriDate datetime)? onOk,
  Function(HijriDate datetime)? onChange,
  VoidCallback? onCancel,
  ThemeData? theme,
  Color? primaryColor,
  Color? backgroundColor,
  Color? calendarTextColor,
  Color? buttonTextColor,
  SelectableDayPredicate? selectableDayPredicate,
  Radius? borderRadius,
  TextDirection? textDirection,
  Locale? locale,
}) {
  Widget dialog = JHijriPicker(
    startDate: startDate,
    selectedDate: selectedDate,
    endDate: endDate,
    pickerMode: pickerMode,
    themeD: theme,
    textDirection: textDirection,
    locale: locale,
    okButtonT: okButton,
    cancelButtonT: cancelButton,
    onOk: onOk,
    onCancel: onCancel,
    primaryColor: primaryColor,
    calendarTextColor: calendarTextColor,
    backgroundColor: backgroundColor,
    borderRadius: borderRadius,
    buttonTextColor: buttonTextColor,
    headerTitle: headerTitle,
    buttons: buttons,
    widgetType: WidgetType.JDialog,
    onChange: onChange,
    selectableDayPredicate: selectableDayPredicate,
  );
  if (pickerType != PickerType.JHijri) {
    dialog = JWesternDatePicker(
      startDate: startDate,
      selectedDate: selectedDate,
      endDate: endDate,
      pickerMode: pickerMode,
      themeD: theme,
      textDirection: textDirection,
      locale: locale,
      okButtonT: okButton,
      cancelButtonT: cancelButton,
      onOk: onOk,
      onCancel: onCancel,
      primaryColor: primaryColor,
      calendarTextColor: calendarTextColor,
      backgroundColor: backgroundColor,
      borderRadius: borderRadius,
      buttonTextColor: buttonTextColor,
      headerTitle: headerTitle,
      buttons: buttons,
      widgetType: WidgetType.JDialog,
      onChange: onChange,
    );
  }
  return showDialog<HijriDate?>(
    context: context,
    builder: (BuildContext context) {
      return dialog;
    },
  );
}