李卓原

去掉第一次初始化失败时的断言错误

@@ -10,7 +10,7 @@ import 'package:flutter/material.dart'; @@ -10,7 +10,7 @@ import 'package:flutter/material.dart';
10 10
11 class ScreenUtil { 11 class ScreenUtil {
12 static const Size defaultSize = Size(360, 690); 12 static const Size defaultSize = Size(360, 690);
13 - static ScreenUtil _instance = ScreenUtil._(); 13 + static late ScreenUtil _instance;
14 14
15 /// UI设计中手机尺寸 , dp 15 /// UI设计中手机尺寸 , dp
16 /// Size of the phone in UI Design , dp 16 /// Size of the phone in UI Design , dp
@@ -42,7 +42,7 @@ class ScreenUtil { @@ -42,7 +42,7 @@ class ScreenUtil {
42 Size designSize = defaultSize, 42 Size designSize = defaultSize,
43 bool allowFontScaling = false, 43 bool allowFontScaling = false,
44 }) { 44 }) {
45 - _instance 45 + _instance = ScreenUtil._()
46 ..uiSize = designSize 46 ..uiSize = designSize
47 ..allowFontScaling = allowFontScaling 47 ..allowFontScaling = allowFontScaling
48 .._orientation = orientation; 48 .._orientation = orientation;
@@ -31,8 +31,9 @@ class ScreenUtilInit extends StatelessWidget { @@ -31,8 +31,9 @@ class ScreenUtilInit extends StatelessWidget {
31 designSize: designSize, 31 designSize: designSize,
32 allowFontScaling: allowFontScaling, 32 allowFontScaling: allowFontScaling,
33 ); 33 );
34 - }  
35 return builder(); 34 return builder();
  35 + }
  36 + return Container();
36 }, 37 },
37 ); 38 );
38 }); 39 });