Skip to content

Commit

Permalink
Fixes compile errors due to using MediaQuery.of(context, nullOk)
Browse files Browse the repository at this point in the history
This constructor has been replaced by a new MediaQuery.maybeOf() constructor.

flutter/flutter#68736
  • Loading branch information
josh-burton committed Nov 3, 2020
1 parent e212e5f commit 2aa54e2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class StarterApp extends StatelessWidget {

@override
Widget build(BuildContext context) {
final isDark = MediaQuery.of(context, nullOk: true)?.platformBrightness ==
final isDark = MediaQuery.maybeOf(context)?.platformBrightness ==
Brightness.dark;
return MaterialApp(
title: 'Starter',
Expand Down
2 changes: 1 addition & 1 deletion device_preview/lib/src/views/device_preview_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class DevicePreviewTheme extends InheritedWidget {
}

// If toolbar position isn't supported, fallback to bottom.
final media = MediaQuery.of(context, nullOk: true) ??
final media = MediaQuery.maybeOf(context) ??
MediaQueryData.fromWindow(WidgetsBinding.instance.window);
if (!DevicePreviewTheme.isPositionAvailableForWidth(
result.toolBar.position, media.size.width)) {
Expand Down

0 comments on commit 2aa54e2

Please sign in to comment.