Skip to content

Commit

Permalink
5.0.0-dev.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Macacoazul01 committed Aug 2, 2024
1 parent 4ad1380 commit e7dd425
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`.
Expand Down
10 changes: 9 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ class _MyAppState extends State<MyApp> {
color: Colors.red[900],
),
),
monthPickerDialogSettings:
const MonthPickerDialogSettings(
headerSettings: PickerHeaderSettings(
headerCurrentPageTextStyle: TextStyle(fontSize: 14),
headerSelectedIntervalTextStyle:
TextStyle(fontSize: 16),
),
),
).then((DateTime? date) {
if (date != null) {
setState(() {
Expand Down Expand Up @@ -177,7 +185,7 @@ class _MyAppState extends State<MyApp> {
fontWeight: FontWeight.bold,
fontSize: 20,
),
headerPageTextStyle: const TextStyle(
headerCurrentPageTextStyle: const TextStyle(
color: Colors.black,
),
previousIcon: Icons.arrow_back,
Expand Down
6 changes: 6 additions & 0 deletions lib/src/helpers/settings/dialog_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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.
Expand Down
11 changes: 4 additions & 7 deletions lib/src/helpers/settings/header_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down Expand Up @@ -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.
///
Expand Down
2 changes: 2 additions & 0 deletions lib/src/month_picker_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ class MonthPickerDialogState extends State<MonthPickerDialog> {
data: widget.controller.theme
.copyWith(dialogBackgroundColor: Colors.transparent),
child: Dialog(
insetPadding: widget
.controller.monthPickerDialogSettings.dialogSettings.insetPadding,
shape: RoundedRectangleBorder(
side: widget.controller.monthPickerDialogSettings.dialogSettings
.dialogBorderSide,
Expand Down
6 changes: 3 additions & 3 deletions lib/src/month_picker_widgets/header/header_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
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: 5.0.0-dev.1
version: 5.0.0-dev.2
homepage: https://github.com/hmkrivoj/month_picker_dialog

environment:
Expand Down

0 comments on commit e7dd425

Please sign in to comment.