Skip to content

Commit

Permalink
updated deprecations + pub
Browse files Browse the repository at this point in the history
  • Loading branch information
Macacoazul01 committed Dec 9, 2023
1 parent 02b8a5e commit e33d3bf
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.3.0 - 2023-11-03
- Removed deprecated `textScaleFactor` inside the package (the name of the parameter stays the same)
- Bumped dart to `3.0.0`,provider to `6.1.1`, intl to `0.18.1` and flutter_lints to `3.0.1`

## 2.2.1 - 2023-11-03
- Added `textScaleFactor` property to allow controlling the scale of the texts in the widget [77](https://github.com/hmkrivoj/month_picker_dialog/pull/77).
- Wrap portrait mode dialog in IntrinsicWidth to prevent oversized content [76](https://github.com/hmkrivoj/month_picker_dialog/pull/76).
Expand Down
3 changes: 1 addition & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:month_picker_dialog/month_picker_dialog.dart';
Expand Down Expand Up @@ -55,7 +54,7 @@ class _MyAppState extends State<MyApp> {
borderRadius: BorderRadius.all(
Radius.circular(20),
),
side: BorderSide(color: Colors.blue)
side: BorderSide(color: Colors.blue),
),
),
),
Expand Down
7 changes: 5 additions & 2 deletions lib/src/month_picker_widgets/button_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,25 @@ class PickerButtonBar extends StatelessWidget {
Widget build(BuildContext context) {
final MaterialLocalizations localizations =
MaterialLocalizations.of(context);
final TextScaler? scaler = controller.textScaleFactor != null
? TextScaler.linear(controller.textScaleFactor!)
: null;
return ButtonBar(
children: <Widget>[
TextButton(
onPressed: () => controller.cancelFunction(context),
child: controller.cancelWidget ??
Text(
localizations.cancelButtonLabel,
textScaleFactor: controller.textScaleFactor,
textScaler: scaler,
),
),
TextButton(
onPressed: () => controller.okFunction(context),
child: controller.confirmWidget ??
Text(
localizations.okButtonLabel,
textScaleFactor: controller.textScaleFactor,
textScaler: scaler,
),
)
],
Expand Down
12 changes: 8 additions & 4 deletions lib/src/month_picker_widgets/header/header_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class HeaderRow extends StatelessWidget {
final Color? arrowcolors =
controller.headerTextColor ?? theme.primaryIconTheme.color;

final TextScaler? scaler = controller.textScaleFactor != null
? TextScaler.linear(controller.textScaleFactor!)
: null;

final YearUpDownPageProvider yearProvider =
Provider.of<YearUpDownPageProvider>(context);
final MonthUpDownPageProvider monthProvider =
Expand All @@ -43,7 +47,7 @@ class HeaderRow extends StatelessWidget {
DateFormat.y(localeString)
.format(DateTime(monthProvider.pageLimit.upLimit)),
style: headline5,
textScaleFactor: controller.textScaleFactor,
textScaler: scaler,
),
),
HeaderArrows(
Expand All @@ -61,18 +65,18 @@ class HeaderRow extends StatelessWidget {
DateFormat.y(localeString)
.format(DateTime(yearProvider.pageLimit.upLimit)),
style: headline5,
textScaleFactor: controller.textScaleFactor,
textScaler: scaler,
),
Text(
'-',
style: headline5,
textScaleFactor: controller.textScaleFactor,
textScaler: scaler,
),
Text(
DateFormat.y(localeString)
.format(DateTime(yearProvider.pageLimit.downLimit)),
style: headline5,
textScaleFactor: controller.textScaleFactor,
textScaler: scaler,
),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class HeaderSelectedDate extends StatelessWidget {
: DateFormat.yMMM(localeString)
.format(controller.selectedDate)
.toLowerCase(),
textScaleFactor: controller.textScaleFactor,
textScaler: controller.textScaleFactor != null
? TextScaler.linear(controller.textScaleFactor!)
: null,
style: controller.headerTextColor == null
? theme.primaryTextTheme.titleMedium
: theme.primaryTextTheme.titleMedium!
Expand Down
4 changes: 3 additions & 1 deletion lib/src/month_selector/month_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ class MonthButton extends StatelessWidget {
DateFormat.MMM(localeString).format(date))!
: DateFormat.MMM(localeString).format(date).toLowerCase(),
style: monthStyle.textStyle?.resolve({}),
textScaleFactor: controller.textScaleFactor,
textScaler: controller.textScaleFactor != null
? TextScaler.linear(controller.textScaleFactor!)
: null,
),
),
);
Expand Down
4 changes: 3 additions & 1 deletion lib/src/year_selector/year_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ class YearButton extends StatelessWidget {
child: Text(
DateFormat.y(localeString).format(DateTime(year)),
style: yearStyle.textStyle?.resolve({}),
textScaleFactor: controller.textScaleFactor,
textScaler: controller.textScaleFactor != null
? TextScaler.linear(controller.textScaleFactor!)
: null,
),
),
);
Expand Down
10 changes: 5 additions & 5 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: month_picker_dialog
description: Internationalized dialog for picking a single month from an infinite list of years.
version: 2.2.1
version: 2.3.0
homepage: https://github.com/hmkrivoj/month_picker_dialog

environment:
sdk: '>=2.19.2 <4.0.0'
sdk: '>=3.0.0 <4.0.0'

dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
provider: ^6.0.5
intl: ^0.18.0
provider: ^6.1.1
intl: ^0.18.1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: 2.0.1
flutter_lints: ^3.0.1
flutter:

0 comments on commit e33d3bf

Please sign in to comment.