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
zhuoyuan
2019-06-22 18:26:52 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
261a80d71d62aa135e0578bb17050fdac8a59d3f
261a80d7
1 parent
686d84ea
将statusBarHeight和bottomBarHeight的单位更改为dp
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
74 additions
and
72 deletions
.packages
CHANGELOG.md
example/lib/main.dart
example/lib/main_zh.dart
example/pubspec.lock
lib/flutter_screenutil.dart
pubspec.lock
pubspec.yaml
.packages
View file @
261a80d
# Generated by pub on 2019-05-15 14:31:19.119581.
async:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.1.0/lib/
boolean_selector:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.4/lib/
charcode:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib/
collection:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.14.11/lib/
flutter:file:///D:/flutter/packages/flutter/lib/
flutter_test:file:///D:/flutter/packages/flutter_test/lib/
matcher:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.5/lib/
meta:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.1.6/lib/
path:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.6.2/lib/
pedantic:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/pedantic-1.5.0/lib/
quiver:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/quiver-2.0.2/lib/
sky_engine:file:///D:/flutter/bin/cache/pkg/sky_engine/lib/
source_span:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.5.5/lib/
stack_trace:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.3/lib/
stream_channel:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.0.0/lib/
string_scanner:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.4/lib/
term_glyph:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0/lib/
test_api:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.4/lib/
typed_data:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib/
vector_math:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.0.8/lib/
# Generated by pub on 2019-06-22 18:24:22.703599.
async:file:///D:/Develop/flutter/.pub-cache/hosted/pub.flutter-io.cn/async-2.1.0/lib/
boolean_selector:file:///D:/Develop/flutter/.pub-cache/hosted/pub.flutter-io.cn/boolean_selector-1.0.4/lib/
charcode:file:///D:/Develop/flutter/.pub-cache/hosted/pub.flutter-io.cn/charcode-1.1.2/lib/
collection:file:///D:/Develop/flutter/.pub-cache/hosted/pub.flutter-io.cn/collection-1.14.11/lib/
flutter:file:///D:/Develop/flutter/packages/flutter/lib/
flutter_test:file:///D:/Develop/flutter/packages/flutter_test/lib/
matcher:file:///D:/Develop/flutter/.pub-cache/hosted/pub.flutter-io.cn/matcher-0.12.5/lib/
meta:file:///D:/Develop/flutter/.pub-cache/hosted/pub.flutter-io.cn/meta-1.1.6/lib/
path:file:///D:/Develop/flutter/.pub-cache/hosted/pub.flutter-io.cn/path-1.6.2/lib/
pedantic:file:///D:/Develop/flutter/.pub-cache/hosted/pub.flutter-io.cn/pedantic-1.5.0/lib/
quiver:file:///D:/Develop/flutter/.pub-cache/hosted/pub.flutter-io.cn/quiver-2.0.2/lib/
sky_engine:file:///D:/Develop/flutter/bin/cache/pkg/sky_engine/lib/
source_span:file:///D:/Develop/flutter/.pub-cache/hosted/pub.flutter-io.cn/source_span-1.5.5/lib/
stack_trace:file:///D:/Develop/flutter/.pub-cache/hosted/pub.flutter-io.cn/stack_trace-1.9.3/lib/
stream_channel:file:///D:/Develop/flutter/.pub-cache/hosted/pub.flutter-io.cn/stream_channel-2.0.0/lib/
string_scanner:file:///D:/Develop/flutter/.pub-cache/hosted/pub.flutter-io.cn/string_scanner-1.0.4/lib/
term_glyph:file:///D:/Develop/flutter/.pub-cache/hosted/pub.flutter-io.cn/term_glyph-1.1.0/lib/
test_api:file:///D:/Develop/flutter/.pub-cache/hosted/pub.flutter-io.cn/test_api-0.2.4/lib/
typed_data:file:///D:/Develop/flutter/.pub-cache/hosted/pub.flutter-io.cn/typed_data-1.1.6/lib/
vector_math:file:///D:/Develop/flutter/.pub-cache/hosted/pub.flutter-io.cn/vector_math-2.0.8/lib/
flutter_screenutil:lib/
...
...
CHANGELOG.md
View file @
261a80d
## [0.0.1] -
first version
## [0.0.1] - first version
## [0.2.2] - Fixed bug when releasing
...
...
@@ -40,4 +40,6 @@ It is recommended to use `ScreenUtil.getInstance()` instead of `ScreenUtil()` ,
setWidth,setHeight,setSp.
for example:
you can use setWidth(100) or setWidth(100.0)
\ No newline at end of file
you can use setWidth(100) or setWidth(100.0)
## [0.5.3] - Change the units of statusBarHeight and bottomBarHeight to dp
\ No newline at end of file
...
...
example/lib/main.dart
View file @
261a80d
...
...
@@ -38,9 +38,9 @@ class _MyHomePageState extends State<MyHomePage> {
print
(
'Device pixel density:
${ScreenUtil.pixelRatio}
'
);
//Device pixel density
print
(
'Bottom safe zone distance
px
:
${ScreenUtil.bottomBarHeight}
'
);
//Bottom safe zone distance,suitable for buttons with full screen
'Bottom safe zone distance
dp
:
${ScreenUtil.bottomBarHeight}
'
);
//Bottom safe zone distance,suitable for buttons with full screen
print
(
'Status bar height px:
${ScreenUtil.statusBarHeight}
px
'
);
//Status bar height , Notch will be higher Unit px
'Status bar height px:
${ScreenUtil.statusBarHeight}
dp
'
);
//Status bar height , Notch will be higher Unit px
print
(
'Ratio of actual width dp to design draft px:
${ScreenUtil.getInstance().scaleWidth}
'
);
print
(
...
...
@@ -88,8 +88,8 @@ class _MyHomePageState extends State<MyHomePage> {
Text
(
'Device width:
${ScreenUtil.screenWidthDp}
dp'
),
Text
(
'Device height:
${ScreenUtil.screenHeightDp}
dp'
),
Text
(
'Device pixel density:
${ScreenUtil.pixelRatio}
'
),
Text
(
'Bottom safe zone distance:
${ScreenUtil.bottomBarHeight}
px'
),
Text
(
'Status bar height:
${ScreenUtil.statusBarHeight}
px'
),
Text
(
'Bottom safe zone distance:
${ScreenUtil.bottomBarHeight}
dp'
),
Text
(
'Status bar height:
${ScreenUtil.statusBarHeight}
dp'
),
Text
(
'Ratio of actual width dp to design draft px:
${ScreenUtil.getInstance().scaleWidth}
'
,
textAlign:
TextAlign
.
center
,
...
...
example/lib/main_zh.dart
View file @
261a80d
...
...
@@ -36,9 +36,9 @@ class _MyHomePageState extends State<MyHomePage> {
print
(
'设备高度:
${ScreenUtil.screenHeight}
'
);
//Device height
print
(
'设备的像素密度:
${ScreenUtil.pixelRatio}
'
);
//Device pixel density
print
(
'底部安全区距离:
${ScreenUtil.bottomBarHeight}
'
);
//Bottom safe zone distance,suitable for buttons with full screen
'底部安全区距离:
${ScreenUtil.bottomBarHeight}
dp
'
);
//Bottom safe zone distance,suitable for buttons with full screen
print
(
'状态栏高度:
${ScreenUtil.statusBarHeight}
px
'
);
//Status bar height , Notch will be higher Unit px
'状态栏高度:
${ScreenUtil.statusBarHeight}
dp
'
);
//Status bar height , Notch will be higher Unit px
print
(
'实际宽度的dp与设计稿px的比例:
${ScreenUtil.getInstance().scaleWidth}
'
);
print
(
'实际高度的dp与设计稿px的比例:
${ScreenUtil.getInstance().scaleHeight}
'
);
...
...
@@ -98,8 +98,8 @@ class _MyHomePageState extends State<MyHomePage> {
Text
(
'设备高度:
${ScreenUtil.screenHeightDp}
dp'
),
Text
(
'设计稿宽度:
${ScreenUtil.getInstance().width}
'
),
Text
(
'设备的像素密度:
${ScreenUtil.pixelRatio}
'
),
Text
(
'底部安全区距离:
${ScreenUtil.bottomBarHeight}
px'
),
Text
(
'状态栏高度:
${ScreenUtil.statusBarHeight}
px'
),
Text
(
'底部安全区距离:
${ScreenUtil.bottomBarHeight}
dp'
),
Text
(
'状态栏高度:
${ScreenUtil.statusBarHeight}
dp'
),
Text
(
'实际宽度的dp与设计稿px的比例:
${ScreenUtil.getInstance().scaleWidth}
'
,
textAlign:
TextAlign
.
center
,
...
...
example/pubspec.lock
View file @
261a80d
...
...
@@ -5,35 +5,35 @@ packages:
dependency: transitive
description:
name: async
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "2.1.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.0.4"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.1.2"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.14.11"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "0.1.2"
flutter:
...
...
@@ -47,7 +47,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.5.
2
"
version: "0.5.
3
"
flutter_test:
dependency: "direct dev"
description: flutter
...
...
@@ -57,35 +57,35 @@ packages:
dependency: transitive
description:
name: matcher
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "0.12.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.1.6"
path:
dependency: transitive
description:
name: path
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.6.2"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.5.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "2.0.2"
sky_engine:
...
...
@@ -97,56 +97,56 @@ packages:
dependency: transitive
description:
name: source_span
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.5.5"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.9.3"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "2.0.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.0.4"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.1.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "0.2.4"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.1.6"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "2.0.8"
sdks:
...
...
lib/flutter_screenutil.dart
View file @
261a80d
...
...
@@ -64,11 +64,11 @@ class ScreenUtil {
///当前设备高度 px
static
double
get
screenHeight
=>
_screenHeight
*
_pixelRatio
;
///状态栏高度 刘海屏会更高
static
double
get
statusBarHeight
=>
_statusBarHeight
*
_pixelRatio
;
///状态栏高度 dp 刘海屏会更高
static
double
get
statusBarHeight
=>
_statusBarHeight
;
///底部安全区距离
static
double
get
bottomBarHeight
=>
_bottomBarHeight
*
_pixelRatio
;
///底部安全区距离 dp
static
double
get
bottomBarHeight
=>
_bottomBarHeight
;
///实际的dp与设计稿px的比例
get
scaleWidth
=>
_screenWidth
/
instance
.
width
;
...
...
pubspec.lock
View file @
261a80d
...
...
@@ -5,28 +5,28 @@ packages:
dependency: transitive
description:
name: async
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "2.1.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.0.4"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.1.2"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.14.11"
flutter:
...
...
@@ -43,35 +43,35 @@ packages:
dependency: transitive
description:
name: matcher
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "0.12.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.1.6"
path:
dependency: transitive
description:
name: path
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.6.2"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.5.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "2.0.2"
sky_engine:
...
...
@@ -83,56 +83,56 @@ packages:
dependency: transitive
description:
name: source_span
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.5.5"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.9.3"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "2.0.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.0.4"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.1.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "0.2.4"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.1.6"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "2.0.8"
sdks:
...
...
pubspec.yaml
View file @
261a80d
name
:
flutter_screenutil
description
:
A flutter plugin for adapting screen and font size.Guaranteed to look good on different models
version
:
0.5.
2
version
:
0.5.
3
author
:
LiZhuoyuan <zhuoyuan93@gmail.com>
homepage
:
https://github.com/OpenFlutter/flutter_ScreenUtil
...
...
Please
register
or
login
to post a comment