Skip to content

Commit df0c80c

Browse files
author
李卓原
committed
去掉第一次初始化失败时的断言错误
1 parent 60bdec3 commit df0c80c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/screen_util.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import 'package:flutter/material.dart';
1010

1111
class ScreenUtil {
1212
static const Size defaultSize = Size(360, 690);
13-
static ScreenUtil _instance = ScreenUtil._();
13+
static late ScreenUtil _instance;
1414

1515
/// UI设计中手机尺寸 , dp
1616
/// Size of the phone in UI Design , dp
@@ -42,7 +42,7 @@ class ScreenUtil {
4242
Size designSize = defaultSize,
4343
bool allowFontScaling = false,
4444
}) {
45-
_instance
45+
_instance = ScreenUtil._()
4646
..uiSize = designSize
4747
..allowFontScaling = allowFontScaling
4848
.._orientation = orientation;

lib/screenutil_init.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ class ScreenUtilInit extends StatelessWidget {
3131
designSize: designSize,
3232
allowFontScaling: allowFontScaling,
3333
);
34+
return builder();
3435
}
35-
return builder();
36+
return Container();
3637
},
3738
);
3839
});

0 commit comments

Comments
 (0)