Showing
3 changed files
with
9 additions
and
7 deletions
1 | +# Please use v2, v3 now has some bugs. | ||
2 | + | ||
1 | # flutter_screenutil | 3 | # flutter_screenutil |
2 | [](https://pub.dev/packages/flutter_screenutil) | 4 | [](https://pub.dev/packages/flutter_screenutil) |
3 | 5 |
1 | +# 请使用v2,v3现在有一些bug | ||
2 | + | ||
1 | # flutter_ScreenUtil | 3 | # flutter_ScreenUtil |
2 | 4 | ||
3 | [](https://pub.dartlang.org/packages/flutter_screenutil) | 5 | [](https://pub.dartlang.org/packages/flutter_screenutil) |
@@ -38,7 +38,7 @@ class ExampleWidget extends StatefulWidget { | @@ -38,7 +38,7 @@ class ExampleWidget extends StatefulWidget { | ||
38 | class _ExampleWidgetState extends State<ExampleWidget> { | 38 | class _ExampleWidgetState extends State<ExampleWidget> { |
39 | @override | 39 | @override |
40 | Widget build(BuildContext context) { | 40 | Widget build(BuildContext context) { |
41 | - // printScreenInformation(); | 41 | + printScreenInformation(); |
42 | return Scaffold( | 42 | return Scaffold( |
43 | appBar: AppBar( | 43 | appBar: AppBar( |
44 | title: Text(widget.title), | 44 | title: Text(widget.title), |
@@ -135,16 +135,13 @@ class _ExampleWidgetState extends State<ExampleWidget> { | @@ -135,16 +135,13 @@ class _ExampleWidgetState extends State<ExampleWidget> { | ||
135 | void printScreenInformation() { | 135 | void printScreenInformation() { |
136 | print('Device width dp:${ScreenUtil().screenWidth}'); //Device width | 136 | print('Device width dp:${ScreenUtil().screenWidth}'); //Device width |
137 | print('Device height dp:${ScreenUtil().screenHeight}'); //Device height | 137 | print('Device height dp:${ScreenUtil().screenHeight}'); //Device height |
138 | - print( | ||
139 | - 'Device pixel density:${ScreenUtil().pixelRatio}'); //Device pixel density | 138 | + print('Device pixel density:${ScreenUtil().pixelRatio}'); //Device pixel density |
140 | print( | 139 | print( |
141 | 'Bottom safe zone distance dp:${ScreenUtil().bottomBarHeight}'); //Bottom safe zone distance,suitable for buttons with full screen | 140 | 'Bottom safe zone distance dp:${ScreenUtil().bottomBarHeight}'); //Bottom safe zone distance,suitable for buttons with full screen |
142 | print( | 141 | print( |
143 | 'Status bar height px:${ScreenUtil().statusBarHeight}dp'); //Status bar height , Notch will be higher Unit px | 142 | 'Status bar height px:${ScreenUtil().statusBarHeight}dp'); //Status bar height , Notch will be higher Unit px |
144 | - print( | ||
145 | - 'Ratio of actual width dp to design draft px:${ScreenUtil().scaleWidth}'); | ||
146 | - print( | ||
147 | - 'Ratio of actual height dp to design draft px:${ScreenUtil().scaleHeight}'); | 143 | + print('Ratio of actual width dp to design draft px:${ScreenUtil().scaleWidth}'); |
144 | + print('Ratio of actual height dp to design draft px:${ScreenUtil().scaleHeight}'); | ||
148 | print( | 145 | print( |
149 | 'The ratio of font and width to the size of the design:${ScreenUtil().scaleWidth * ScreenUtil().pixelRatio}'); | 146 | 'The ratio of font and width to the size of the design:${ScreenUtil().scaleWidth * ScreenUtil().pixelRatio}'); |
150 | print( | 147 | print( |
@@ -154,3 +151,4 @@ class _ExampleWidgetState extends State<ExampleWidget> { | @@ -154,3 +151,4 @@ class _ExampleWidgetState extends State<ExampleWidget> { | ||
154 | print('0.5 times the screen height:${0.5.hp}'); | 151 | print('0.5 times the screen height:${0.5.hp}'); |
155 | } | 152 | } |
156 | } | 153 | } |
154 | + |
-
Please register or login to post a comment