@@ -149,8 +149,8 @@ const double _kMaxRegularTextScaleFactor = 1.4;
149
149
// Accessibility mode on iOS is determined by the text scale factor that the
150
150
// user has selected.
151
151
bool _isInAccessibilityMode (BuildContext context) {
152
- final MediaQueryData ? data = MediaQuery .maybeOf (context);
153
- return data != null && data.textScaleFactor > _kMaxRegularTextScaleFactor;
152
+ final double ? factor = MediaQuery .maybeTextScaleFactorOf (context);
153
+ return factor != null && factor > _kMaxRegularTextScaleFactor;
154
154
}
155
155
156
156
/// An iOS-style alert dialog.
@@ -257,7 +257,7 @@ class CupertinoAlertDialog extends StatelessWidget {
257
257
final Curve insetAnimationCurve;
258
258
259
259
Widget _buildContent (BuildContext context) {
260
- final double textScaleFactor = MediaQuery .of (context).textScaleFactor ;
260
+ final double textScaleFactor = MediaQuery .textScaleFactorOf (context);
261
261
262
262
final List <Widget > children = < Widget > [
263
263
if (title != null || content != null )
@@ -317,7 +317,7 @@ class CupertinoAlertDialog extends StatelessWidget {
317
317
Widget build (BuildContext context) {
318
318
final CupertinoLocalizations localizations = CupertinoLocalizations .of (context);
319
319
final bool isInAccessibilityMode = _isInAccessibilityMode (context);
320
- final double textScaleFactor = MediaQuery .of (context).textScaleFactor ;
320
+ final double textScaleFactor = MediaQuery .textScaleFactorOf (context);
321
321
return CupertinoUserInterfaceLevel (
322
322
data: CupertinoUserInterfaceLevelData .elevated,
323
323
child: MediaQuery (
@@ -331,7 +331,7 @@ class CupertinoAlertDialog extends StatelessWidget {
331
331
child: LayoutBuilder (
332
332
builder: (BuildContext context, BoxConstraints constraints) {
333
333
return AnimatedPadding (
334
- padding: MediaQuery .of (context).viewInsets +
334
+ padding: MediaQuery .viewInsetsOf (context) +
335
335
const EdgeInsets .symmetric (horizontal: 40.0 , vertical: 24.0 ),
336
336
duration: insetAnimationDuration,
337
337
curve: insetAnimationCurve,
@@ -611,12 +611,12 @@ class CupertinoActionSheet extends StatelessWidget {
611
611
if (cancelButton != null ) _buildCancelButton (),
612
612
];
613
613
614
- final Orientation orientation = MediaQuery .of (context).orientation ;
614
+ final Orientation orientation = MediaQuery .orientationOf (context);
615
615
final double actionSheetWidth;
616
616
if (orientation == Orientation .portrait) {
617
- actionSheetWidth = MediaQuery .of (context).size .width - (_kActionSheetEdgeHorizontalPadding * 2 );
617
+ actionSheetWidth = MediaQuery .sizeOf (context).width - (_kActionSheetEdgeHorizontalPadding * 2 );
618
618
} else {
619
- actionSheetWidth = MediaQuery .of (context).size .height - (_kActionSheetEdgeHorizontalPadding * 2 );
619
+ actionSheetWidth = MediaQuery .sizeOf (context).height - (_kActionSheetEdgeHorizontalPadding * 2 );
620
620
}
621
621
622
622
return SafeArea (
@@ -797,7 +797,7 @@ class _CupertinoDialogRenderWidget extends RenderObjectWidget {
797
797
@override
798
798
RenderObject createRenderObject (BuildContext context) {
799
799
return _RenderCupertinoDialog (
800
- dividerThickness: _kDividerThickness / MediaQuery .of (context).devicePixelRatio ,
800
+ dividerThickness: _kDividerThickness / MediaQuery .devicePixelRatioOf (context),
801
801
isInAccessibilityMode: _isInAccessibilityMode (context) && ! isActionSheet,
802
802
dividerColor: CupertinoDynamicColor .resolve (dividerColor, context),
803
803
isActionSheet: isActionSheet,
@@ -1464,7 +1464,7 @@ class _CupertinoAlertActionSection extends StatelessWidget {
1464
1464
1465
1465
@override
1466
1466
Widget build (BuildContext context) {
1467
- final double devicePixelRatio = MediaQuery .of (context).devicePixelRatio ;
1467
+ final double devicePixelRatio = MediaQuery .devicePixelRatioOf (context);
1468
1468
1469
1469
final List <Widget > interactiveButtons = < Widget > [];
1470
1470
for (int i = 0 ; i < children.length; i += 1 ) {
0 commit comments