diff --git a/experimental/material_3_demo/lib/main.dart b/experimental/material_3_demo/lib/main.dart index 5a0ec563b..cc6cd5565 100644 --- a/experimental/material_3_demo/lib/main.dart +++ b/experimental/material_3_demo/lib/main.dart @@ -31,8 +31,7 @@ class _AppState extends State { bool get useLightMode { switch (themeMode) { case ThemeMode.system: - return View.of(context).platformDispatcher.platformBrightness == - Brightness.light; + return MediaQuery.platformBrightnessOf(context) == Brightness.light; case ThemeMode.light: return true; case ThemeMode.dark: diff --git a/material_3_demo/lib/main.dart b/material_3_demo/lib/main.dart index 5a0ec563b..cc6cd5565 100644 --- a/material_3_demo/lib/main.dart +++ b/material_3_demo/lib/main.dart @@ -31,8 +31,7 @@ class _AppState extends State { bool get useLightMode { switch (themeMode) { case ThemeMode.system: - return View.of(context).platformDispatcher.platformBrightness == - Brightness.light; + return MediaQuery.platformBrightnessOf(context) == Brightness.light; case ThemeMode.light: return true; case ThemeMode.dark: