Skip to content

Commit

Permalink
chore: replace deprecated textScaleFactor (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
nank1ro authored Nov 24, 2023
1 parent 695e113 commit 94072f3
Show file tree
Hide file tree
Showing 4 changed files with 16 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 @@
## 1.1.2

- **BREAKING** Remove the deprecated `textScaleFactor` in favor of `textScaler`.

## 1.1.1

- `.separatedBy()` now returns a list by default.
Expand Down
20 changes: 10 additions & 10 deletions lib/src/sizes_ext.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ extension Sizes on BuildContext {
systemGestureInsets: _systemGestureInsets,
viewPadding: _viewPadding,
devicePixelRatio: _devicePixelRatio,
textScaleFactor: _textScaleFactor,
textScaler: _textScaler,
maybeDevicePixelRatio: _maybeDevicePixelRatio,
maybeHeight: _maybeHeight,
maybePadding: _maybePadding,
maybeSystemGestureInsets: _maybeSystemGestureInsets,
maybeTextScaleFactor: _maybeTextScaleFactor,
maybeTextScaler: _maybeTextScaler,
maybeViewInsets: _maybeViewInsets,
maybeViewPadding: _maybeViewPadding,
maybeWidth: _maybeWidth,
Expand All @@ -39,8 +39,8 @@ extension Sizes on BuildContext {
double get _devicePixelRatio => MediaQuery.devicePixelRatioOf(this);
double? get _maybeDevicePixelRatio =>
MediaQuery.maybeDevicePixelRatioOf(this);
double get _textScaleFactor => MediaQuery.textScaleFactorOf(this);
double? get _maybeTextScaleFactor => MediaQuery.maybeTextScaleFactorOf(this);
TextScaler get _textScaler => MediaQuery.textScalerOf(this);
TextScaler? get _maybeTextScaler => MediaQuery.maybeTextScalerOf(this);
}

class _Sizes {
Expand All @@ -52,15 +52,15 @@ class _Sizes {
required this.systemGestureInsets,
required this.viewPadding,
required this.devicePixelRatio,
required this.textScaleFactor,
required this.textScaler,
required this.maybeWidth,
required this.maybeHeight,
required this.maybePadding,
required this.maybeViewInsets,
required this.maybeSystemGestureInsets,
required this.maybeViewPadding,
required this.maybeDevicePixelRatio,
required this.maybeTextScaleFactor,
required this.maybeTextScaler,
});

/// See [Size.width].
Expand Down Expand Up @@ -105,11 +105,11 @@ class _Sizes {
/// See [MediaQueryData.devicePixelRatio].
final double? maybeDevicePixelRatio;

/// See [MediaQueryData.textScaleFactor].
final double textScaleFactor;
/// See [MediaQueryData.textScaler].
final TextScaler textScaler;

/// See [MediaQueryData.textScaleFactor].
final double? maybeTextScaleFactor;
/// See [MediaQueryData.textScaler].
final TextScaler? maybeTextScaler;
}

/// Converts a [num] into an [EdgeInsets]
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: awesome_flutter_extensions
description: >
A Flutter Extension to remove boilerplate when accessing
ancestor context properties
version: 1.1.1
version: 1.1.2
homepage: https://bestofcode.dev
repository: https://github.com/nank1ro/awesome_flutter_extensions

Expand Down
2 changes: 1 addition & 1 deletion test/misellaneous_ext_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void main() {
final widgets = <Widget>[
const Text('1'),
const Text('2'),
const Text('3')
const Text('3'),
];

//Create a separator widget
Expand Down

0 comments on commit 94072f3

Please sign in to comment.