diff --git a/lib/month_picker_dialog.dart b/lib/month_picker_dialog.dart index 63bdc28..a2edefb 100644 --- a/lib/month_picker_dialog.dart +++ b/lib/month_picker_dialog.dart @@ -85,37 +85,40 @@ Future showMonthPicker({ bool forceSelectedDate = false, int animationMilliseconds = 450, bool hideHeaderRow = false, + double? textScaleFactor, }) async { assert(forceSelectedDate == dismissible || !forceSelectedDate, 'forceSelectedDate can only be used with dismissible = true'); final ThemeData theme = Theme.of(context); final MonthpickerController controller = MonthpickerController( - initialDate: initialDate, - firstDate: firstDate, - lastDate: lastDate, - locale: locale, - selectableMonthPredicate: selectableMonthPredicate, - monthStylePredicate: monthStylePredicate, - yearStylePredicate: yearStylePredicate, - capitalizeFirstLetter: capitalizeFirstLetter, - headerColor: headerColor, - headerTextColor: headerTextColor, - selectedMonthBackgroundColor: selectedMonthBackgroundColor, - selectedMonthTextColor: selectedMonthTextColor, - unselectedMonthTextColor: unselectedMonthTextColor, - selectedMonthPadding: selectedMonthPadding, - backgroundColor: backgroundColor, - confirmWidget: confirmWidget, - cancelWidget: cancelWidget, - customHeight: customHeight, - customWidth: customWidth, - yearFirst: yearFirst, - roundedCornersRadius: roundedCornersRadius, - forceSelectedDate: forceSelectedDate, - animationMilliseconds: animationMilliseconds, - hideHeaderRow: hideHeaderRow, - theme: theme, - useMaterial3: theme.useMaterial3); + initialDate: initialDate, + firstDate: firstDate, + lastDate: lastDate, + locale: locale, + selectableMonthPredicate: selectableMonthPredicate, + monthStylePredicate: monthStylePredicate, + yearStylePredicate: yearStylePredicate, + capitalizeFirstLetter: capitalizeFirstLetter, + headerColor: headerColor, + headerTextColor: headerTextColor, + selectedMonthBackgroundColor: selectedMonthBackgroundColor, + selectedMonthTextColor: selectedMonthTextColor, + unselectedMonthTextColor: unselectedMonthTextColor, + selectedMonthPadding: selectedMonthPadding, + backgroundColor: backgroundColor, + confirmWidget: confirmWidget, + cancelWidget: cancelWidget, + customHeight: customHeight, + customWidth: customWidth, + yearFirst: yearFirst, + roundedCornersRadius: roundedCornersRadius, + forceSelectedDate: forceSelectedDate, + animationMilliseconds: animationMilliseconds, + hideHeaderRow: hideHeaderRow, + theme: theme, + useMaterial3: theme.useMaterial3, + textScaleFactor: textScaleFactor + ); final DateTime? dialogDate = await showDialog( context: context, barrierDismissible: dismissible, diff --git a/lib/src/helpers/controller.dart b/lib/src/helpers/controller.dart index a97afcf..5278bb1 100644 --- a/lib/src/helpers/controller.dart +++ b/lib/src/helpers/controller.dart @@ -33,6 +33,7 @@ class MonthpickerController { required this.hideHeaderRow, required this.theme, required this.useMaterial3, + required this.textScaleFactor, }); //User defined variables @@ -57,6 +58,7 @@ class MonthpickerController { final double? customHeight, customWidth; final double roundedCornersRadius, selectedMonthPadding; final int animationMilliseconds; + final double? textScaleFactor; //local variables final GlobalKey yearSelectorState = GlobalKey(); diff --git a/lib/src/month_picker_widgets/button_bar.dart b/lib/src/month_picker_widgets/button_bar.dart index e365685..5538426 100644 --- a/lib/src/month_picker_widgets/button_bar.dart +++ b/lib/src/month_picker_widgets/button_bar.dart @@ -16,12 +16,19 @@ class PickerButtonBar extends StatelessWidget { children: [ TextButton( onPressed: () => controller.cancelFunction(context), - child: - controller.cancelWidget ?? Text(localizations.cancelButtonLabel), + child: controller.cancelWidget ?? + Text( + localizations.cancelButtonLabel, + textScaleFactor: controller.textScaleFactor, + ), ), TextButton( onPressed: () => controller.okFunction(context), - child: controller.confirmWidget ?? Text(localizations.okButtonLabel), + child: controller.confirmWidget ?? + Text( + localizations.okButtonLabel, + textScaleFactor: controller.textScaleFactor, + ), ) ], ); diff --git a/lib/src/month_picker_widgets/header/header_row.dart b/lib/src/month_picker_widgets/header/header_row.dart index 5cea383..aba0e1c 100644 --- a/lib/src/month_picker_widgets/header/header_row.dart +++ b/lib/src/month_picker_widgets/header/header_row.dart @@ -43,6 +43,7 @@ class HeaderRow extends StatelessWidget { DateFormat.y(localeString) .format(DateTime(monthProvider.pageLimit.upLimit)), style: headline5, + textScaleFactor: controller.textScaleFactor, ), ), HeaderArrows( @@ -60,15 +61,18 @@ class HeaderRow extends StatelessWidget { DateFormat.y(localeString) .format(DateTime(yearProvider.pageLimit.upLimit)), style: headline5, + textScaleFactor: controller.textScaleFactor, ), Text( '-', style: headline5, + textScaleFactor: controller.textScaleFactor, ), Text( DateFormat.y(localeString) .format(DateTime(yearProvider.pageLimit.downLimit)), style: headline5, + textScaleFactor: controller.textScaleFactor, ), ], ), diff --git a/lib/src/month_picker_widgets/header/header_selected_date.dart b/lib/src/month_picker_widgets/header/header_selected_date.dart index d9c0ebc..5b85885 100644 --- a/lib/src/month_picker_widgets/header/header_selected_date.dart +++ b/lib/src/month_picker_widgets/header/header_selected_date.dart @@ -21,6 +21,7 @@ class HeaderSelectedDate extends StatelessWidget { : DateFormat.yMMM(localeString) .format(controller.selectedDate) .toLowerCase(), + textScaleFactor: controller.textScaleFactor, style: controller.headerTextColor == null ? theme.primaryTextTheme.titleMedium : theme.primaryTextTheme.titleMedium! diff --git a/lib/src/month_selector/month_button.dart b/lib/src/month_selector/month_button.dart index 942a540..5e7808e 100644 --- a/lib/src/month_selector/month_button.dart +++ b/lib/src/month_selector/month_button.dart @@ -97,6 +97,7 @@ class MonthButton extends StatelessWidget { DateFormat.MMM(localeString).format(date))! : DateFormat.MMM(localeString).format(date).toLowerCase(), style: monthStyle.textStyle?.resolve({}), + textScaleFactor: controller.textScaleFactor, ), ), ); diff --git a/lib/src/year_selector/year_button.dart b/lib/src/year_selector/year_button.dart index e276d27..cf48578 100644 --- a/lib/src/year_selector/year_button.dart +++ b/lib/src/year_selector/year_button.dart @@ -92,6 +92,7 @@ class YearButton extends StatelessWidget { child: Text( DateFormat.y(localeString).format(DateTime(year)), style: yearStyle.textStyle?.resolve({}), + textScaleFactor: controller.textScaleFactor, ), ), ); diff --git a/pubspec.yaml b/pubspec.yaml index 640dbce..e923b91 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: 2.1.0 +version: 2.1.1 homepage: https://github.com/hmkrivoj/month_picker_dialog environment: