showMonthYearPicker static method
Future<void>
showMonthYearPicker(
- BuildContext context, {
- required void onDateSelected(),
- String? title,
- int? maxYear,
- String? type,
- CalendarTheme? theme,
- String? buttonText,
- Widget? customButton,
Shows a month/year picker bottom sheet (without day selection).
Displays a modal bottom sheet with two scrollable pickers for month and year selection only. The day parameter in the callback will always be 0.
Example usage:
CalendarBottomSheet.showMonthYearPicker(
context,
onDateSelected: (year, month, day) {
print('Selected month/year: $month/$year');
},
theme: CalendarTheme.dark,
);
Implementation
static Future<void> showMonthYearPicker(
BuildContext context, {
required void Function(int year, int month, int day) onDateSelected,
String? title,
int? maxYear,
String? type,
CalendarTheme? theme,
String? buttonText,
Widget? customButton,
}) {
return showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (BuildContext context) {
return _MonthYearPickerBottomSheet(
onDateSelected: onDateSelected,
title: title ?? "Select Month/Year",
maxYear: maxYear,
type: type,
theme: theme ?? CalendarTheme.light,
buttonText: buttonText,
customButton: customButton,
);
},
);
}