@@ -39,7 +39,7 @@ class ScreenUtilInit extends StatefulWidget {
39
39
this .designSize = ScreenUtil .defaultSize,
40
40
this .splitScreenMode = false ,
41
41
this .minTextAdapt = false ,
42
- this .useInheritedMediaQuery = true ,
42
+ this .useInheritedMediaQuery = false ,
43
43
this .scaleByHeight = false })
44
44
: super (key: key);
45
45
@@ -76,15 +76,17 @@ class _ScreenUtilInitState extends State<ScreenUtilInit>
76
76
wrappedInMediaQuery = true ;
77
77
return data;
78
78
}
79
+ } else {
80
+ final data = MediaQuery .maybeOf (context);
81
+
82
+ if (data != null ) {
83
+ return data;
84
+ }
79
85
}
80
86
81
87
return MediaQueryData .fromView (View .of (context));
82
88
}
83
89
84
- Widget get child {
85
- return widget.builder.call (context, widget.child);
86
- }
87
-
88
90
_updateTree (Element el) {
89
91
el.markNeedsBuild ();
90
92
el.visitChildren (_updateTree);
@@ -148,7 +150,7 @@ class _ScreenUtilInitState extends State<ScreenUtilInit>
148
150
widget.designSize.height
149
151
: deviceSize.width,
150
152
height: deviceSize.height,
151
- child: child,
153
+ child: widget. builder (__context, widget. child) ,
152
154
),
153
155
));
154
156
},
@@ -176,7 +178,7 @@ class _ScreenUtilInitState extends State<ScreenUtilInit>
176
178
widget.designSize.height
177
179
: deviceSize.width,
178
180
height: deviceSize.height,
179
- child: child,
181
+ child: widget. builder (_context, widget. child) ,
180
182
),
181
183
));
182
184
}
0 commit comments