diff --git a/CHANGELOG.md b/CHANGELOG.md index 6873c66..59a4c5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.0.0-dev.2 +- Added `dialogSettings.insetPadding` parameter. +- Changed `headerSettings.headerPageTextStyle` name to `headerSettings.headerCurrentPageTextStyle` parameter + removed the fallback to avoid strange results. + ## 5.0.0-dev.1 - [Breaking] Reworked dialog configuration to use the new class `MonthPickerDialogSettings`. Please follow the sample app to learn how to configure your widget using the new way (or feel free to open an issue on github). - Added `selectableYearPredicate` to range and single month pickers. It lets you control enabled years like `selectableMonthPredicate`. diff --git a/example/lib/main.dart b/example/lib/main.dart index 5cdcf69..5887962 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -126,6 +126,14 @@ class _MyAppState extends State { color: Colors.red[900], ), ), + monthPickerDialogSettings: + const MonthPickerDialogSettings( + headerSettings: PickerHeaderSettings( + headerCurrentPageTextStyle: TextStyle(fontSize: 14), + headerSelectedIntervalTextStyle: + TextStyle(fontSize: 16), + ), + ), ).then((DateTime? date) { if (date != null) { setState(() { @@ -177,7 +185,7 @@ class _MyAppState extends State { fontWeight: FontWeight.bold, fontSize: 20, ), - headerPageTextStyle: const TextStyle( + headerCurrentPageTextStyle: const TextStyle( color: Colors.black, ), previousIcon: Icons.arrow_back, diff --git a/lib/src/helpers/settings/dialog_settings.dart b/lib/src/helpers/settings/dialog_settings.dart index 6b69592..d60b975 100644 --- a/lib/src/helpers/settings/dialog_settings.dart +++ b/lib/src/helpers/settings/dialog_settings.dart @@ -17,6 +17,7 @@ class PickerDialogSettings { this.dialogBorderSide = BorderSide.none, this.dialogBackgroundColor, this.locale, + this.insetPadding, }) : assert(forceSelectedDate == dismissible || !forceSelectedDate, 'forceSelectedDate can only be used with dismissible = true'); @@ -89,6 +90,11 @@ class PickerDialogSettings { /// /// default: `null` final Locale? locale; + + /// Defines the insetPadding of the dialog. + /// + /// default: `null` + final EdgeInsets? insetPadding; } ///The default settings for the Dialog style. diff --git a/lib/src/helpers/settings/header_settings.dart b/lib/src/helpers/settings/header_settings.dart index 5ec919e..445655b 100644 --- a/lib/src/helpers/settings/header_settings.dart +++ b/lib/src/helpers/settings/header_settings.dart @@ -9,13 +9,10 @@ class PickerHeaderSettings { this.headerIconsSize, this.headerIconsColor, this.headerBackgroundColor, - TextStyle? headerSelectedIntervalTextStyle, - TextStyle? headerPageTextStyle, + this.headerSelectedIntervalTextStyle, + this.headerCurrentPageTextStyle, this.titleSpacing = 5, - }) : headerPageTextStyle = - headerPageTextStyle ?? headerSelectedIntervalTextStyle, - headerSelectedIntervalTextStyle = - headerSelectedIntervalTextStyle ?? headerPageTextStyle; + }); /// Hides the row with the arrows + years/months page range from the header, forcing the user to scroll to change the page. /// @@ -55,7 +52,7 @@ class PickerHeaderSettings { /// The text style of current page title on the header. /// /// default: `null` - final TextStyle? headerPageTextStyle; + final TextStyle? headerCurrentPageTextStyle; /// The space between the title widget and the current selected month/year/range text on the header. /// diff --git a/lib/src/month_picker_dialog.dart b/lib/src/month_picker_dialog.dart index 5835208..bcb8548 100644 --- a/lib/src/month_picker_dialog.dart +++ b/lib/src/month_picker_dialog.dart @@ -107,6 +107,8 @@ class MonthPickerDialogState extends State { data: widget.controller.theme .copyWith(dialogBackgroundColor: Colors.transparent), child: Dialog( + insetPadding: widget + .controller.monthPickerDialogSettings.dialogSettings.insetPadding, shape: RoundedRectangleBorder( side: widget.controller.monthPickerDialogSettings.dialogSettings .dialogBorderSide, diff --git a/lib/src/month_picker_widgets/header/header_row.dart b/lib/src/month_picker_widgets/header/header_row.dart index b6a74e9..821995e 100644 --- a/lib/src/month_picker_widgets/header/header_row.dart +++ b/lib/src/month_picker_widgets/header/header_row.dart @@ -23,13 +23,13 @@ class HeaderRow extends StatelessWidget { @override Widget build(BuildContext context) { - final TextStyle? headline5 = controller - .monthPickerDialogSettings.headerSettings.headerPageTextStyle ?? + final TextStyle? headline5 = controller.monthPickerDialogSettings + .headerSettings.headerCurrentPageTextStyle ?? theme.primaryTextTheme.headlineSmall; final Color? arrowcolors = controller.monthPickerDialogSettings.headerSettings.headerIconsColor ?? (controller.monthPickerDialogSettings.headerSettings - .headerPageTextStyle?.color ?? + .headerCurrentPageTextStyle?.color ?? theme.primaryIconTheme.color); final TextScaler? scaler = diff --git a/pubspec.yaml b/pubspec.yaml index ce92f46..69228c0 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: 5.0.0-dev.1 +version: 5.0.0-dev.2 homepage: https://github.com/hmkrivoj/month_picker_dialog environment: