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
李卓原
2018-11-19 10:55:04 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e9229082e2a50d23a6bc4174577cfa997e40bffc
e9229082
1 parent
9e2f2e95
优化示例和图片
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
266 deletions
demo_en.png
demo_zh.png
example/lib/main.dart
example/lib/main_zh.dart
example/pubspec.lock
demo_en.png
View file @
e922908
163 KB
|
W:
|
H:
67.8 KB
|
W:
|
H:
2-up
Swipe
Onion skin
demo_zh.png
View file @
e922908
162 KB
|
W:
|
H:
67.6 KB
|
W:
|
H:
2-up
Swipe
Onion skin
example/lib/main.dart
View file @
e922908
...
...
@@ -67,7 +67,7 @@ class _MyHomePageState extends State<MyHomePage> {
'My width:
${ScreenUtil().setWidth(375)}
dp'
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
ScreenUtil
().
setSp
(
12
,
false
)),
fontSize:
ScreenUtil
().
setSp
(
24
,
false
)),
),
),
Container
(
...
...
@@ -77,7 +77,7 @@ class _MyHomePageState extends State<MyHomePage> {
child:
Text
(
'My width:
${ScreenUtil().setWidth(375)}
dp'
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
ScreenUtil
().
setSp
(
12
,
false
))),
fontSize:
ScreenUtil
().
setSp
(
24
,
false
))),
),
],
),
...
...
@@ -110,16 +110,16 @@ class _MyHomePageState extends State<MyHomePage> {
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
Text
(
'My font size is
1
4px on the design draft and will not change with the system.'
,
'My font size is
2
4px on the design draft and will not change with the system.'
,
style:
TextStyle
(
color:
Colors
.
black
,
fontSize:
ScreenUtil
().
setSp
(
1
4
,
false
),
fontSize:
ScreenUtil
().
setSp
(
2
4
,
false
),
)),
Text
(
'My font size is
1
4px on the design draft and will change with the system.'
,
'My font size is
2
4px on the design draft and will change with the system.'
,
style:
TextStyle
(
color:
Colors
.
black
,
fontSize:
ScreenUtil
().
setSp
(
1
4
),
fontSize:
ScreenUtil
().
setSp
(
2
4
),
)),
],
)
...
...
example/lib/main_zh.dart
View file @
e922908
...
...
@@ -28,7 +28,6 @@ class MyHomePage extends StatefulWidget {
}
class
_MyHomePageState
extends
State
<
MyHomePage
>
{
@override
Widget
build
(
BuildContext
context
)
{
//设置适配尺寸 (填入设计稿中设备的屏幕尺寸) 假如设计稿是按iPhone6的尺寸设计的(iPhone6 750*1334)
...
...
@@ -46,8 +45,7 @@ class _MyHomePageState extends State<MyHomePage> {
print
(
'宽度和字体相对于设计稿放大的比例:
${ScreenUtil().scaleWidth * ScreenUtil.pixelRatio}
'
);
print
(
'高度相对于设计稿放大的比例:
${ScreenUtil().scaleHeight * ScreenUtil.pixelRatio}
'
);
print
(
'高度相对于设计稿放大的比例:
${ScreenUtil().scaleHeight * ScreenUtil.pixelRatio}
'
);
print
(
'系统的字体缩放比例:
${ScreenUtil.textScaleFactory}
'
);
return
new
Scaffold
(
...
...
@@ -68,7 +66,7 @@ class _MyHomePageState extends State<MyHomePage> {
'我的宽度:
${ScreenUtil().setWidth(375)}
dp'
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
ScreenUtil
().
setSp
(
12
,
false
),
fontSize:
ScreenUtil
().
setSp
(
24
,
false
),
),
),
),
...
...
@@ -79,7 +77,7 @@ class _MyHomePageState extends State<MyHomePage> {
child:
Text
(
'我的宽度:
${ScreenUtil().setWidth(375)}
dp'
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
ScreenUtil
().
setSp
(
12
,
false
),
fontSize:
ScreenUtil
().
setSp
(
24
,
false
),
)),
),
],
...
...
@@ -112,13 +110,13 @@ class _MyHomePageState extends State<MyHomePage> {
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
Text
(
'我的文字大小在设计稿上是
14
px,不会随着系统的文字缩放比例变化'
,
Text
(
'我的文字大小在设计稿上是
25
px,不会随着系统的文字缩放比例变化'
,
style:
TextStyle
(
color:
Colors
.
black
,
fontSize:
ScreenUtil
().
setSp
(
14
,
false
))),
Text
(
'我的文字大小在设计稿上是14px,会随着系统的文字缩放比例变化'
,
fontSize:
ScreenUtil
().
setSp
(
24
,
false
))),
Text
(
'我的文字大小在设计稿上是25px,会随着系统的文字缩放比例变化'
,
style:
TextStyle
(
color:
Colors
.
black
,
fontSize:
ScreenUtil
().
setSp
(
1
4
))),
color:
Colors
.
black
,
fontSize:
ScreenUtil
().
setSp
(
2
4
))),
],
)
],
...
...
example/pubspec.lock
View file @
e922908
# Generated by pub
# See https://www.dartlang.org/tools/pub/glossary#lockfile
packages:
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "0.32.4"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
async:
dependency: transitive
description:
...
...
@@ -43,27 +29,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.14.5"
cupertino_icons:
dependency: "direct main"
description:
...
...
@@ -82,89 +47,12 @@ packages:
path: ".."
relative: true
source: path
version: "0.4.
0
"
version: "0.4.
1
"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
front_end:
dependency: transitive
description:
name: front_end
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.7"
html:
dependency: transitive
description:
name: html
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.3+3"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.11.3+17"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.3"
io:
dependency: transitive
description:
name: io
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.3"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.1+1"
json_rpc_2:
dependency: transitive
description:
name: json_rpc_2
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.9"
kernel:
dependency: transitive
description:
name: kernel
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.4"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "0.11.3+2"
matcher:
dependency: transitive
description:
...
...
@@ -179,41 +67,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.6+2"
multi_server_socket:
dependency: transitive
description:
name: multi_server_socket
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
node_preamble:
dependency: transitive
description:
name: node_preamble
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.4"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
package_resolver:
dependency: transitive
description:
name: package_resolver
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
path:
dependency: transitive
description:
...
...
@@ -221,81 +74,18 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.2"
plugin:
dependency: transitive
description:
name: plugin
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0+3"
pool:
dependency: transitive
description:
name: pool
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.6"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.2"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0+1"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.3+3"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
shelf_static:
dependency: transitive
description:
name: shelf_static
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.8"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.2+4"
version: "2.0.1"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_map_stack_trace:
dependency: transitive
description:
name: source_map_stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.5"
source_maps:
dependency: transitive
description:
name: source_maps
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.7"
source_span:
dependency: transitive
description:
...
...
@@ -331,13 +121,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
test:
test
_api
:
dependency: transitive
description:
name: test
name: test
_api
url: "https://pub.dartlang.org"
source: hosted
version: "
1.3.0
"
version: "
0.2.1
"
typed_data:
dependency: transitive
description:
...
...
@@ -345,13 +135,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
utf:
dependency: transitive
description:
name: utf
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.0+5"
vector_math:
dependency: transitive
description:
...
...
@@ -359,33 +142,5 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
vm_service_client:
dependency: transitive
description:
name: vm_service_client
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.6"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.7+10"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.9"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.15"
sdks:
dart: ">=2.0.0
-dev.68.0
<3.0.0"
dart: ">=2.0.0 <3.0.0"
...
...
Please
register
or
login
to post a comment