Skip to content

Commit

Permalink
Merge pull request OpenFlutter#211 from idootop/master
Browse files Browse the repository at this point in the history
  • Loading branch information
lizhuoyuan authored Feb 5, 2021
2 parents 7dcf623 + 170cbf1 commit 65459b0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MyApp extends StatelessWidget {
return ScreenUtilInit(
designSize: Size(360, 690),
allowFontScaling: false,
child: MaterialApp(
builder: () => MaterialApp(
...
),
);
Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class MyApp extends StatelessWidget {
return ScreenUtilInit(
designSize: Size(360, 690),
allowFontScaling: false,
child: MaterialApp(
builder: () => MaterialApp(
...
),
);
Expand Down
2 changes: 1 addition & 1 deletion README_PT.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class MyApp extends StatelessWidget {
return ScreenUtilInit(
designSize: Size(360, 690),
allowFontScaling: false,
child: MaterialApp(
builder: () => MaterialApp(
...
),
);
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class MyApp extends StatelessWidget {
return ScreenUtilInit(
designSize: Size(360, 690),
allowFontScaling: false,
child: MaterialApp(
builder: () => MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter_ScreenUtil',
theme: ThemeData(
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main_zh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class MyApp extends StatelessWidget {
return ScreenUtilInit(
designSize: Size(750, 1334),
allowFontScaling: false,
child: MaterialApp(
builder: () => MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter_ScreenUtil',
theme: ThemeData(
Expand Down
6 changes: 3 additions & 3 deletions lib/screenutil_init.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import 'screenutil.dart';
class ScreenUtilInit extends StatelessWidget {
/// A helper widget that initializes [ScreenUtil]
ScreenUtilInit({
required this.child,
required this.builder,
this.designSize = ScreenUtil.defaultSize,
this.allowFontScaling = false,
Key? key,
}) : super(key: key);

final Widget child;
final Widget Function() builder;

/// The [Size] of the device in the design draft, in dp
final Size designSize;
Expand All @@ -31,7 +31,7 @@ class ScreenUtilInit extends StatelessWidget {
allowFontScaling: allowFontScaling,
);
}
return child;
return builder();
},
);
}
Expand Down

0 comments on commit 65459b0

Please sign in to comment.