Add a default MediaQuery value
Now MediaQuery.of always returns a non-null value. By default, you get the values associated with the current ui.Window. Fixes #2894
This commit is contained in:
@@ -82,7 +82,7 @@ class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final double statusBarHeight = (MediaQuery.of(context)?.padding ?? EdgeInsets.zero).top;
|
||||
final double statusBarHeight = MediaQuery.of(context).padding.top;
|
||||
return new Theme(
|
||||
data: new ThemeData(
|
||||
brightness: ThemeBrightness.light,
|
||||
|
||||
@@ -35,7 +35,7 @@ class TabsDemoState extends State<TabsDemo> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final double statusBarHeight = (MediaQuery.of(context)?.padding ?? EdgeInsets.zero).top;
|
||||
final double statusBarHeight = MediaQuery.of(context).padding.top;
|
||||
return new TabBarSelection<_Page>(
|
||||
values: _pages,
|
||||
onChanged: (_Page value) {
|
||||
|
||||
@@ -25,7 +25,7 @@ class GallerySection extends StatelessWidget {
|
||||
}
|
||||
|
||||
void showDemos(BuildContext context) {
|
||||
final double statusBarHeight = (MediaQuery.of(context)?.padding ?? EdgeInsets.zero).top;
|
||||
final double statusBarHeight = MediaQuery.of(context).padding.top;
|
||||
final ThemeData theme = new ThemeData(
|
||||
brightness: Theme.of(context).brightness,
|
||||
primarySwatch: colors
|
||||
|
||||
Reference in New Issue
Block a user