diff --git a/CHANGELOG.md b/CHANGELOG.md index 784c3db..d0c3c53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 6.0.2 - 2024-12-16 +- Fixed [#109](https://github.com/Macacoazul01/month_picker_dialog/issues/109). +- Improved function docs. + ## 6.0.1 - 2024-12-16 - Improved sample diff --git a/lib/src/helpers/controller.dart b/lib/src/helpers/controller.dart index 90d795e..55e1d5e 100644 --- a/lib/src/helpers/controller.dart +++ b/lib/src/helpers/controller.dart @@ -144,22 +144,27 @@ class MonthpickerController { ///function to return the range of selected months List selectRange() { - if (initialRangeDate != null && endRangeDate != null) { + if (initialRangeDate != null) { + if (endRangeDate == null) { + return [initialRangeDate!]; + } + if (initialRangeDate == endRangeDate) { return [initialRangeDate!]; } final DateTime startDate = initialRangeDate!; final DateTime endDate = endRangeDate!; - if (rangeList) { return rangeListCreation(startDate, endDate); - } else { - return [startDate, endDate]; } + return [startDate, endDate]; } else { - return []; + if (endRangeDate != null) { + return [endRangeDate!]; + } } + return []; } ///function to return the full list range of selected months diff --git a/lib/src/pickers/show_month_picker.dart b/lib/src/pickers/show_month_picker.dart index f25885b..ef025dd 100644 --- a/lib/src/pickers/show_month_picker.dart +++ b/lib/src/pickers/show_month_picker.dart @@ -5,23 +5,23 @@ import '/month_picker_dialog.dart'; /// Displays month picker dialog. /// -/// `initialDate:` is the initially selected month. +/// `initialDate:` the initially selected month. /// -/// `firstDate:` is the optional lower bound for month selection. +/// `firstDate:` the optional lower bound for month selection. /// -/// `lastDate:` is the optional upper bound for month selection. +/// `lastDate:` the optional upper bound for month selection. /// -/// `selectableMonthPredicate:` lets you control enabled months just like the official selectableDayPredicate. +/// `selectableMonthPredicate:` control enabled months just like the official selectableDayPredicate. /// -/// `selectableYearPredicate:` lets you control enabled years just like the official selectableDayPredicate. +/// `selectableYearPredicate:` control enabled years just like the official selectableDayPredicate. /// -/// `monthStylePredicate:` allows you to individually customize each month. +/// `monthStylePredicate:` individually customize each month. /// -/// `yearStylePredicate:` allows you to individually customize each year. +/// `yearStylePredicate:` individually customize each year. /// -/// `headerTitle:` lets you add a custom title to the header of the dialog (default is `null`). +/// `headerTitle:` add a custom title to the header of the dialog (default is `null`). /// -/// `monthPickerDialogSettings:` is the object that will hold all of the style of the picker dialog (default is `defaultMonthPickerDialogSettings`). +/// `monthPickerDialogSettings:` holds all the style of the picker dialog (default is `defaultMonthPickerDialogSettings`). /// /// `onlyYear:` Displays only year picker dialog. Prefer to use `showYearPicker` instead of `showMonthPicker` with this parameter set to `true` to avoid unnecessary parameters. /// diff --git a/lib/src/pickers/show_month_range_picker.dart b/lib/src/pickers/show_month_range_picker.dart index 2025cc2..d6305a3 100644 --- a/lib/src/pickers/show_month_range_picker.dart +++ b/lib/src/pickers/show_month_range_picker.dart @@ -5,27 +5,27 @@ import '/month_picker_dialog.dart'; /// Displays month picker dialog. /// -/// `initialRangeDate:` the initial date of the range of months to be selected. +/// `initialRangeDate:` initial selected date of the months range. /// -/// `endRangeDate:` the last date of the range of months to be selected. +/// `endRangeDate:` latest selected date of the months range. /// -/// `firstDate:` is the optional lower bound for month selection. +/// `firstDate:` optional lower bound for month selection. /// -/// `lastDate:` is the optional upper bound for month selection. +/// `lastDate:` optional upper bound for month selection. /// -/// `selectableMonthPredicate:` lets you control enabled months just like the official selectableDayPredicate. +/// `selectableMonthPredicate:` control enabled months just like the official selectableDayPredicate. /// -/// `selectableYearPredicate:` lets you control enabled months just like the official selectableDayPredicate. +/// `selectableYearPredicate:` control enabled months just like the official selectableDayPredicate. /// -/// `monthStylePredicate:` allows you to individually customize each month. +/// `monthStylePredicate:` individually customize each month. /// -/// `yearStylePredicate:` allows you to individually customize each year. +/// `yearStylePredicate:` individually customize each year. /// -/// `headerTitle:` lets you add a custom title to the header of the dialog (default is `null`). +/// `headerTitle:` adds a custom title to the header of the dialog (default is `null`). /// -/// `monthPickerDialogSettings:` is the object that will hold all of the style of the picker dialog (default is `defaultMonthPickerDialogSettings`). +/// `monthPickerDialogSettings:` holds all the style of the picker dialog (default is `defaultMonthPickerDialogSettings`). /// -/// `rangeList:` lets you define if the controller will return the full list of months between the two selected or only them (default is `false`). +/// `rangeList:` defines if the controller will return the full list of months between the two selected or only them (default is `false`). /// Future?> showMonthRangePicker({ required BuildContext context, diff --git a/lib/src/pickers/show_year_picker.dart b/lib/src/pickers/show_year_picker.dart index 4176a31..ffa4c5e 100644 --- a/lib/src/pickers/show_year_picker.dart +++ b/lib/src/pickers/show_year_picker.dart @@ -4,19 +4,19 @@ import '/month_picker_dialog.dart'; /// Displays only year picker dialog. /// -/// `initialDate:` is the initially selected month. +/// `initialDate:` initially selected month. /// -/// `firstDate:` is the optional lower bound for month selection. +/// `firstDate:` optional lower bound for month selection. /// -/// `lastDate:` is the optional upper bound for month selection. +/// `lastDate:` optional upper bound for month selection. /// -/// `selectableYearPredicate:` lets you control enabled years just like the official selectableDayPredicate. +/// `selectableYearPredicate:` control enabled years just like the official selectableDayPredicate. /// -/// `yearStylePredicate:` allows you to individually customize each year. +/// `yearStylePredicate:` individually customize each year. /// -/// `headerTitle:` lets you add a custom title to the header of the dialog (default is `null`). +/// `headerTitle:` adds a custom title to the header of the dialog (default is `null`). /// -/// `monthPickerDialogSettings:` is the object that will hold all of the style of the picker dialog (default is `defaultMonthPickerDialogSettings`). +/// `monthPickerDialogSettings:` holds all the style of the picker dialog (default is `defaultMonthPickerDialogSettings`). /// Future showYearPicker({ required BuildContext context, diff --git a/pubspec.yaml b/pubspec.yaml index 16d1a6b..6e80594 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: month_picker_dialog description: Internationalized dialog for picking a single month from an infinite list of years. -version: 6.0.1 +version: 6.0.2 homepage: https://github.com/hmkrivoj/month_picker_dialog environment: