Skip to content

Commit

Permalink
2.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Macacoazul01 committed Jan 18, 2024
1 parent 29313f7 commit 6a0aadd
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 28 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2.6.0 - 2024-01-17
- Added `customDivider` property to allow you add a custom divider between the months/years and the confirm/cancel buttons.

## 2.5.1 - 2024-01-17
- Mini fix in `customWidth`.

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ There are other parameters to configure on the dialog if you want:

`forcePortrait` lets you block the widget from entering in landscape mode.

`customDivider` lets you add a custom divider between the months/years and the confirm/cancel buttons.

## Screenshots
### Left-To-Right
![LTR portrait](screenshots/ltr_portrait.png)
Expand Down
5 changes: 5 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ class _MyAppState extends State<MyApp> {
roundedCornersRadius: 20,
yearFirst: true,
backgroundColor: Colors.yellow[100],
// customDivider: Divider(
// color: Colors.black,
// endIndent: 25,
// indent: 25,
// ),
// forcePortrait: true,
//forceSelectedDate: true,
//dismissible: true,
Expand Down
59 changes: 33 additions & 26 deletions lib/month_picker_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,57 +12,59 @@ import 'src/year_selector/year_selector.dart';

/// Displays month picker dialog.
///
/// [initialDate] is the initially selected month.
/// `initialDate:` is the initially selected month.
///
/// [firstDate] is the optional lower bound for month selection.
/// `firstDate:` is the optional lower bound for month selection.
///
/// [lastDate] is the optional upper bound for month selection.
/// `lastDate:` is the optional upper bound for month selection.
///
/// [selectableMonthPredicate] lets you control enabled months just like the official selectableDayPredicate.
/// `selectableMonthPredicate:` lets you control enabled months just like the official selectableDayPredicate.
///
/// [monthStylePredicate] allows you to individually customize each month.
/// `monthStylePredicate:` allows you to individually customize each month.
///
/// [yearStylePredicate] allows you to individually customize each year.
/// `yearStylePredicate:` allows you to individually customize each year.
///
/// [capitalizeFirstLetter] lets you control if your months names are capitalized or not.
/// `capitalizeFirstLetter:` lets you control if your months names are capitalized or not.
///
/// [headerColor] lets you control the calendar header color.
/// `headerColor:` lets you control the calendar header color.
///
/// [headerTextColor] lets you control the calendar header text and arrows color.
/// `headerTextColor:` lets you control the calendar header text and arrows color.
///
/// [selectedMonthBackgroundColor] lets you control the current selected month/year background color.
/// `selectedMonthBackgroundColor:` lets you control the current selected month/year background color.
///
/// [selectedMonthTextColor] lets you control the text color of the current selected month/year.
/// `selectedMonthTextColor:` lets you control the text color of the current selected month/year.
///
/// [unselectedMonthTextColor] lets you control the text color of the current unselected months/years.
/// `unselectedMonthTextColor:` lets you control the text color of the current unselected months/years.
///
/// [selectedMonthPadding] lets you control the size of the current selected month/year circle by increasing the padding of it (default is 0).
/// `selectedMonthPadding:` lets you control the size of the current selected month/year circle by increasing the padding of it (default is 0).
///
/// [confirmWidget] lets you set a custom confirm widget.
/// `confirmWidget:` lets you set a custom confirm widget.
///
/// [cancelWidget] lets you set a custom cancel widget.
/// `cancelWidget:` lets you set a custom cancel widget.
///
/// [customHeight] lets you set a custom height for the calendar widget (default is 240).
/// `customHeight:` lets you set a custom height for the calendar widget (default is 240).
///
/// [customWidth] lets you set a custom width for the calendar widget (default is 320).
/// `customWidth:` lets you set a custom width for the calendar widget (default is 320).
///
/// [yearFirst] lets you define that the user must select first the year, then the month.
/// `yearFirst:` lets you define that the user must select first the year, then the month.
///
/// [roundedCornersRadius] lets you define the Radius of the rounded dialog (default is 0).
/// `roundedCornersRadius:` lets you define the Radius of the rounded dialog (default is 0).
///
/// [dismissible] lets you define if the dialog will be dismissible by clicking outside it.
/// `dismissible:` lets you define if the dialog will be dismissible by clicking outside it.
///
/// [forceSelectedDate] lets you define that the current selected date will be returned if the user clicks outside of the dialog. Needs `dismissible = true`.
/// `forceSelectedDate:` lets you define that the current selected date will be returned if the user clicks outside of the dialog. Needs `dismissible = true`.
///
/// [animationMilliseconds] lets you define the speed of the page transition animation (default is 450).
/// `animationMilliseconds:` lets you define the speed of the page transition animation (default is 450).
///
/// [hideHeaderRow] lets you hide the row with the arrows + years/months page range from the header, forcing the user to scroll to change the page (default is false).
/// `hideHeaderRow:` lets you hide the row with the arrows + years/months page range from the header, forcing the user to scroll to change the page (default is false).
///
/// [textScaleFactor] lets you control the scale of the texts in the widget.
/// `textScaleFactor:` lets you control the scale of the texts in the widget.
///
/// [arrowSize] lets you control the size of the header arrows.
/// `arrowSize:` lets you control the size of the header arrows.
///
/// [forcePortrait] lets you block the widget from entering in landscape mode.
/// `forcePortrait:` lets you block the widget from entering in landscape mode.
///
/// `customDivider:` lets you add a custom divider between the months/years and the confirm/cancel buttons.
///
Future<DateTime?> showMonthPicker({
required BuildContext context,
Expand Down Expand Up @@ -94,6 +96,7 @@ Future<DateTime?> showMonthPicker({
double? textScaleFactor,
double? arrowSize,
bool forcePortrait = false,
Widget? customDivider,
}) async {
assert(forceSelectedDate == dismissible || !forceSelectedDate,
'forceSelectedDate can only be used with dismissible = true');
Expand Down Expand Up @@ -128,6 +131,7 @@ Future<DateTime?> showMonthPicker({
textScaleFactor: textScaleFactor,
arrowSize: arrowSize,
forcePortrait: forcePortrait,
customDivider: customDivider,
);
final DateTime? dialogDate = await showDialog<DateTime>(
context: context,
Expand Down Expand Up @@ -211,13 +215,16 @@ class _MonthPickerDialogState extends State<_MonthPickerDialog> {
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
PickerPager(
selector: _selector,
theme: widget.controller.theme,
controller: widget.controller,
),
if (widget.controller.customDivider != null)
widget.controller.customDivider!,
PickerButtonBar(
controller: widget.controller,
),
Expand Down
3 changes: 2 additions & 1 deletion lib/src/helpers/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class MonthpickerController {
this.textScaleFactor,
this.arrowSize,
required this.forcePortrait,
this.customDivider,
});

//User defined variables
Expand All @@ -57,7 +58,7 @@ class MonthpickerController {
selectedMonthTextColor,
unselectedMonthTextColor,
backgroundColor;
final Widget? confirmWidget, cancelWidget;
final Widget? confirmWidget, cancelWidget, customDivider;
final double? customHeight, textScaleFactor, arrowSize;
final double roundedCornersRadius, selectedMonthPadding, customWidth;
final int animationMilliseconds;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: month_picker_dialog
description: Internationalized dialog for picking a single month from an infinite list of years.
version: 2.5.1
version: 2.6.0
homepage: https://github.com/hmkrivoj/month_picker_dialog

environment:
Expand Down

0 comments on commit 6a0aadd

Please sign in to comment.