@@ -141,8 +141,9 @@ class ScreenUtil {
141
141
bool minTextAdapt = false ,
142
142
FontSizeResolver ? fontSizeResolver,
143
143
}) {
144
+ final view = View .maybeOf (context);
144
145
return configure (
145
- data: MediaQuery . maybeOf (context) ,
146
+ data: view != null ? MediaQueryData . fromView (view) : null ,
146
147
designSize: designSize,
147
148
splitScreenMode: splitScreenMode,
148
149
minTextAdapt: minTextAdapt,
@@ -158,8 +159,8 @@ class ScreenUtil {
158
159
FontSizeResolver ? fontSizeResolver,
159
160
}) {
160
161
return ScreenUtil .ensureScreenSize ().then ((_) {
161
- return configure (
162
- data : MediaQuery . maybeOf ( context) ,
162
+ return init (
163
+ context,
163
164
designSize: designSize,
164
165
minTextAdapt: minTextAdapt,
165
166
splitScreenMode: splitScreenMode,
@@ -251,8 +252,11 @@ class ScreenUtil {
251
252
if (kIsWeb) {
252
253
deviceType = DeviceType .web;
253
254
} else {
254
- bool isMobile = defaultTargetPlatform == TargetPlatform .iOS || defaultTargetPlatform == TargetPlatform .android;
255
- bool isTablet = (orientation == Orientation .portrait && screenWidth >= 600 ) || (orientation == Orientation .landscape && screenHeight >= 600 );
255
+ bool isMobile = defaultTargetPlatform == TargetPlatform .iOS ||
256
+ defaultTargetPlatform == TargetPlatform .android;
257
+ bool isTablet =
258
+ (orientation == Orientation .portrait && screenWidth >= 600 ) ||
259
+ (orientation == Orientation .landscape && screenHeight >= 600 );
256
260
257
261
if (isMobile) {
258
262
deviceType = isTablet ? DeviceType .tablet : DeviceType .mobile;
0 commit comments