Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
flutter_screenutil
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
李卓原
2021-04-26 10:58:15 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
bbd9abed1464c8a382fbfd96d640e57dbb3ef800
bbd9abed
1 parent
f4c797e0
update readme
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
13 deletions
README.md
README_PT.md
example/lib/main_zh.dart
README.md
View file @
bbd9abe
...
...
@@ -46,7 +46,7 @@ void main() => runApp(MyApp());
class
MyApp
extends
StatelessWidget
{
@override
Widget
build
(
BuildContext
context
)
{
//Set the fit size (
fill in the screen size of the device in the design,
in dp)
//Set the fit size (
Find your UI design, look at the dimensions of the device screen and fill it in,unit
in dp)
return
ScreenUtilInit
(
designSize:
Size
(
360
,
690
),
builder:
()
=>
MaterialApp
(
...
...
README_PT.md
View file @
bbd9abe
...
...
@@ -50,7 +50,7 @@ void main() => runApp(MyApp());
class
MyApp
extends
StatelessWidget
{
@override
Widget
build
(
BuildContext
context
)
{
//Set the fit size (
fill in the screen size of the device in the design,
in dp)
//Set the fit size (
Find your UI design, look at the dimensions of the device screen and fill it in,unit
in dp)
return
ScreenUtilInit
(
designSize:
Size
(
360
,
690
),
builder:
()
=>
MaterialApp
(
...
...
@@ -96,7 +96,7 @@ class HomePage extends StatefulWidget {
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
//Set the fit size (
fill in the screen size of the device in the design) If the design is based on the size of the 360*690(
dp)
//Set the fit size (
Find your UI design, look at the dimensions of the device screen and fill it in,unit in
dp)
ScreenUtil.init(
BoxConstraints(
maxWidth: MediaQuery.of(context).size.width,
...
...
example/lib/main_zh.dart
View file @
bbd9abe
...
...
@@ -31,11 +31,11 @@ class _HomePageState extends State<HomePage> {
Widget
build
(
BuildContext
context
)
{
//Set the fit size (fill in the screen size of the device in the design) If the design is based on the size of the 360*690
ScreenUtil
.
init
(
BoxConstraints
(
maxWidth:
MediaQuery
.
of
(
context
).
size
.
width
,
maxHeight:
MediaQuery
.
of
(
context
).
size
.
height
),
designSize:
Size
(
360
,
690
),
orientation:
Orientation
.
portrait
);
BoxConstraints
(
maxWidth:
MediaQuery
.
of
(
context
).
size
.
width
,
maxHeight:
MediaQuery
.
of
(
context
).
size
.
height
),
designSize:
Size
(
360
,
690
),
);
printScreenInformation
();
return
Scaffold
(
appBar:
AppBar
(
...
...
@@ -66,9 +66,7 @@ class _HomePageState extends State<HomePage> {
child:
Text
(
'我的设计稿宽度: 180dp
\n
'
'我的设计稿高度: 200dp'
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
ScreenUtil
().
setSp
(
12
))),
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
ScreenUtil
().
setSp
(
12
))),
),
],
),
...
...
@@ -136,8 +134,7 @@ class _HomePageState extends State<HomePage> {
print
(
'状态栏高度:
${ScreenUtil().statusBarHeight}
dp'
);
print
(
'实际宽度和字体(dp)与设计稿(dp)的比例:
${ScreenUtil().scaleWidth}
'
);
print
(
'实际高度(dp)与设计稿(dp)的比例:
${ScreenUtil().scaleHeight}
'
);
print
(
'高度相对于设计稿放大的比例:
${ScreenUtil().scaleHeight}
'
);
print
(
'高度相对于设计稿放大的比例:
${ScreenUtil().scaleHeight}
'
);
print
(
'系统的字体缩放比例:
${ScreenUtil().textScaleFactor}
'
);
print
(
'屏幕宽度的0.5:
${0.5.sw}
dp'
);
print
(
'屏幕高度的0.5:
${0.5.sh}
dp'
);
...
...
Please
register
or
login
to post a comment