Skip to content

Commit 65459b0

Browse files
authored
Merge pull request #211 from idootop/master
fix #196, #209
2 parents 7dcf623 + 170cbf1 commit 65459b0

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class MyApp extends StatelessWidget {
5050
return ScreenUtilInit(
5151
designSize: Size(360, 690),
5252
allowFontScaling: false,
53-
child: MaterialApp(
53+
builder: () => MaterialApp(
5454
...
5555
),
5656
);

README_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class MyApp extends StatelessWidget {
5858
return ScreenUtilInit(
5959
designSize: Size(360, 690),
6060
allowFontScaling: false,
61-
child: MaterialApp(
61+
builder: () => MaterialApp(
6262
...
6363
),
6464
);

README_PT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class MyApp extends StatelessWidget {
5454
return ScreenUtilInit(
5555
designSize: Size(360, 690),
5656
allowFontScaling: false,
57-
child: MaterialApp(
57+
builder: () => MaterialApp(
5858
...
5959
),
6060
);

example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class MyApp extends StatelessWidget {
1010
return ScreenUtilInit(
1111
designSize: Size(360, 690),
1212
allowFontScaling: false,
13-
child: MaterialApp(
13+
builder: () => MaterialApp(
1414
debugShowCheckedModeBanner: false,
1515
title: 'Flutter_ScreenUtil',
1616
theme: ThemeData(

example/lib/main_zh.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class MyApp extends StatelessWidget {
1010
return ScreenUtilInit(
1111
designSize: Size(750, 1334),
1212
allowFontScaling: false,
13-
child: MaterialApp(
13+
builder: () => MaterialApp(
1414
debugShowCheckedModeBanner: false,
1515
title: 'Flutter_ScreenUtil',
1616
theme: ThemeData(

lib/screenutil_init.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import 'screenutil.dart';
55
class ScreenUtilInit extends StatelessWidget {
66
/// A helper widget that initializes [ScreenUtil]
77
ScreenUtilInit({
8-
required this.child,
8+
required this.builder,
99
this.designSize = ScreenUtil.defaultSize,
1010
this.allowFontScaling = false,
1111
Key? key,
1212
}) : super(key: key);
1313

14-
final Widget child;
14+
final Widget Function() builder;
1515

1616
/// The [Size] of the device in the design draft, in dp
1717
final Size designSize;
@@ -31,7 +31,7 @@ class ScreenUtilInit extends StatelessWidget {
3131
allowFontScaling: allowFontScaling,
3232
);
3333
}
34-
return child;
34+
return builder();
3535
},
3636
);
3737
}

0 commit comments

Comments
 (0)