李卓原

5.0.4 readme

# 5.0.4
- add setContext() , the first initialization method requires calling
- fix # 310
- update ReadMe.md
# 5.0.3
... ...
... ... @@ -92,16 +92,26 @@ class MyApp extends StatelessWidget {
return ScreenUtilInit(
designSize: Size(360, 690),
minTextAdapt: true,
builder: () => MaterialApp(
...
theme: ThemeData(
primarySwatch: Colors.blue,
textTheme: TextTheme(
//To support the following, you need to use the first initialization method
button: TextStyle(fontSize: 45.sp)
),
),
),
splitScreenMode: true,
builder: () =>
MaterialApp(
//... other code
builder: (context, widget) {
//add this line
ScreenUtil.setContext(context);
return MediaQuery(
//Setting font does not change with system font size
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: widget,
);
},
theme: ThemeData(
textTheme: TextTheme(
//To support the following, you need to use the first initialization method
button: TextStyle(fontSize: 45.sp)
),
),
),
);
}
}
... ... @@ -156,6 +166,7 @@ class _HomePageState extends State<HomePage> {
maxWidth: MediaQuery.of(context).size.width,
maxHeight: MediaQuery.of(context).size.height),
designSize: Size(360, 690),
context: context,
minTextAdapt: true,
orientation: Orientation.portrait);
return Scaffold();
... ...
... ... @@ -63,18 +63,26 @@ class MyApp extends StatelessWidget {
return ScreenUtilInit(
designSize: Size(360, 690),
minTextAdapt: true,
builder: () => MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter_ScreenUtil',
theme: ThemeData(
primarySwatch: Colors.blue,
//要支持下面这个需要使用第一种初始化方式
textTheme: TextTheme(
button: TextStyle(fontSize: 45.sp)
),
),
home: HomePage(title: 'FlutterScreenUtil Demo'),
),
splitScreenMode: true,
builder: () =>
MaterialApp(
//... other code
builder: (context, widget) {
//add this line
ScreenUtil.setContext(context);
return MediaQuery(
//Setting font does not change with system font size
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: widget,
);
},
theme: ThemeData(
textTheme: TextTheme(
//要支持下面这个需要使用第一种初始化方式
button: TextStyle(fontSize: 45.sp)
),
),
),
);
}
}
... ... @@ -118,6 +126,7 @@ class _HomePageState extends State<HomePage> {
maxWidth: MediaQuery.of(context).size.width,
maxHeight: MediaQuery.of(context).size.height),
designSize: Size(360, 690),
context: context,
minTextAdapt: true,
orientation: Orientation.portrait);
return Scaffold();
... ...
... ... @@ -59,16 +59,26 @@ class MyApp extends StatelessWidget {
return ScreenUtilInit(
designSize: Size(360, 690),
minTextAdapt: true,
builder: () => MaterialApp(
...
theme: ThemeData(
primarySwatch: Colors.blue,
//To support the following, you need to use the first initialization method
textTheme: TextTheme(
button: TextStyle(fontSize: 45.sp)
),
),
),
splitScreenMode: true,
builder: () =>
MaterialApp(
//... other code
builder: (context, widget) {
//add this line
ScreenUtil.setContext(context);
return MediaQuery(
//Setting font does not change with system font size
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: widget,
);
},
theme: ThemeData(
textTheme: TextTheme(
//To support the following, you need to use the first initialization method
button: TextStyle(fontSize: 45.sp)
),
),
),
);
}
}
... ... @@ -108,6 +118,7 @@ class _HomePageState extends State<HomePage> {
maxWidth: MediaQuery.of(context).size.width,
maxHeight: MediaQuery.of(context).size.height),
designSize: Size(360, 690),
context: context,
orientation: Orientation.portrait);
return Scaffold();
}
... ...