showGlobalDatePicker function
Future<JPickerValue?>
showGlobalDatePicker({
- required BuildContext context,
- PickerType pickerType = PickerType.JHijri,
- JDateModel? startDate,
- JDateModel? endDate,
- JDateModel? selectedDate,
- DatePickerMode? pickerMode,
- String? okButtonText,
- String? cancelButtonText,
- Widget? headerTitle,
- dynamic onOk(
- JPickerValue datetime
- dynamic onChange(
- JPickerValue datetime
- VoidCallback? onCancel,
- ThemeData? pickerTheme,
- Color? primaryColor,
- Color? backgroundColor,
- Color? calendarTextColor,
- Color? buttonTextColor,
- Color? cancelButtonColor,
- Color? okButtonColor,
- Radius? borderRadius,
- Widget? buttons,
- TextDirection? textDirection,
- Locale? locale,
- SelectableDayPredicate? selectableDayPredicate,
- JSelectableDayPredicate? jSelectableDayPredicate,
Implementation
Future<JPickerValue?> showGlobalDatePicker({
required BuildContext context,
PickerType pickerType = PickerType.JHijri,
JDateModel? startDate,
JDateModel? endDate,
JDateModel? selectedDate,
DatePickerMode? pickerMode,
String? okButtonText,
String? cancelButtonText,
Widget? headerTitle,
Function(JPickerValue datetime)? onOk,
Function(JPickerValue datetime)? onChange,
VoidCallback? onCancel,
ThemeData? pickerTheme,
Color? primaryColor,
Color? backgroundColor,
Color? calendarTextColor,
Color? buttonTextColor,
Color? cancelButtonColor,
Color? okButtonColor,
Radius? borderRadius,
Widget? buttons,
TextDirection? textDirection,
Locale? locale,
SelectableDayPredicate? selectableDayPredicate,
JSelectableDayPredicate? jSelectableDayPredicate,
}) {
JHijri _select = JHijri();
JHijri _start = JHijri(fYear: 2000);
JHijri _end = JHijri(fYear: 2060);
JDateModel _startDate = startDate != null
? startDate
: pickerType == PickerType.JHijri
? JDateModel(jhijri: _start)
: JDateModel(dateTime: _start.dateTime);
JDateModel _endDate = endDate != null
? endDate
: pickerType == PickerType.JHijri
? JDateModel(jhijri: _end)
: JDateModel(dateTime: _end.dateTime);
JDateModel _selectedDate = selectedDate != null
? selectedDate
: pickerType == PickerType.JHijri
? JDateModel(jhijri: _select)
: JDateModel(dateTime: _select.dateTime);
return showDialog<JPickerValue?>(
context: context,
builder: (BuildContext context) {
return JGlobalDatePicker(
pickerType: pickerType,
selectableDayPredicate: selectableDayPredicate,
jSelectableDayPredicate: jSelectableDayPredicate,
locale: locale,
textDirection: textDirection,
buttons: buttons,
borderRadius: borderRadius,
okButtonText: okButtonText,
okButtonColor: okButtonColor,
cancelButtonText: cancelButtonText,
cancelButtonColor: cancelButtonColor,
calendarTextColor: calendarTextColor,
primaryColor: primaryColor,
pickerTheme: pickerTheme,
pickerMode: pickerMode,
onCancel: onCancel,
onChange: onChange,
onOk: onOk,
headerTitle: headerTitle,
backgroundColor: backgroundColor,
buttonTextColor: buttonTextColor,
selectedDate: _selectedDate,
startDate: _startDate,
endDate: _endDate);
},
);
}