Skip to content

Commit 4fb14b1

Browse files
author
李卓原
committed
4.0.0-beta readme
1 parent e5b00e5 commit 4fb14b1

File tree

7 files changed

+17
-155
lines changed

7 files changed

+17
-155
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ Column(
190190

191191
### Example:
192192

193-
[example demo](/example/lib/main.dart)
193+
[example demo](https://github.com/OpenFlutter/flutter_screenutil/blob/master/example/lib/main_zh.dart)
194194

195195
### Effect:
196196

README_CN.md

Lines changed: 1 addition & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -184,145 +184,12 @@ Column(
184184
)
185185
```
186186

187-
```dart
188-
import 'package:flutter/material.dart';
189-
import 'package:flutter_screenutil/flutter_screenutil.dart';
190-
191-
void main() => runApp(MyApp());
192-
193-
class MyApp extends StatelessWidget {
194-
@override
195-
Widget build(BuildContext context) {
196-
return LayoutBuilder(
197-
builder: (context, constraints) {
198-
//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 iPhone6 ​​(iPhone6 ​​750*1334)
199-
ScreenUtil.init(constraints, designSize: Size(750, 1334), allowFontScaling: false);
200-
201-
return MaterialApp(
202-
debugShowCheckedModeBanner: false,
203-
title: 'Flutter_ScreenUtil',
204-
theme: ThemeData(
205-
primarySwatch: Colors.blue,
206-
),
207-
home: HomePage(title: 'FlutterScreenUtil Demo'),
208-
);
209-
},
210-
);
211-
}
212-
}
213-
214-
class HomePage extends StatefulWidget {
215-
const HomePage({Key key, this.title}) : super(key: key);
216-
217-
final String title;
218-
219-
@override
220-
_HomePageState createState() => _HomePageState();
221-
}
222-
223-
class _HomePageState extends State<HomePage> {
224-
@override
225-
Widget build(BuildContext context) {
226-
printScreenInformation();
227-
return Scaffold(
228-
appBar: AppBar(
229-
title: Text(widget.title),
230-
),
231-
body: SingleChildScrollView(
232-
child: Column(
233-
crossAxisAlignment: CrossAxisAlignment.center,
234-
children: <Widget>[
235-
Row(
236-
children: <Widget>[
237-
Container(
238-
padding: EdgeInsets.all(ScreenUtil().setWidth(10)),
239-
width: ScreenUtil().setWidth(375),
240-
height: ScreenUtil().setHeight(200),
241-
color: Colors.red,
242-
child: Text(
243-
'我的宽度:${0.5.sw}dp \n'
244-
'我的高度:${ScreenUtil().setHeight(200)}dp',
245-
style: TextStyle(color: Colors.white, fontSize: ScreenUtil().setSp(24)),
246-
),
247-
),
248-
Container(
249-
padding: EdgeInsets.all(ScreenUtil().setWidth(10)),
250-
width: 375.w,
251-
height: 200.h,
252-
color: Colors.blue,
253-
child: Text(
254-
'我的宽度:${375.w}dp \n'
255-
'我的高度:${200.h}dp',
256-
style: TextStyle(color: Colors.white, fontSize: ScreenUtil().setSp(24))),
257-
),
258-
],
259-
),
260-
Text('设备宽度:${ScreenUtil().screenWidthPx}px'),
261-
Text('设备高度:${ScreenUtil().screenHeightPx}px'),
262-
Text('设备宽度:${ScreenUtil().screenWidth}dp'),
263-
Text('设备高度:${ScreenUtil().screenHeight}dp'),
264-
Text('设备的像素密度:${ScreenUtil().pixelRatio}'),
265-
Text('底部安全区距离:${ScreenUtil().bottomBarHeight}dp'),
266-
Text('状态栏高度:${ScreenUtil().statusBarHeight}dp'),
267-
Text(
268-
'实际宽度的dp与设计稿px的比例:${ScreenUtil().scaleWidth}',
269-
textAlign: TextAlign.center,
270-
),
271-
Text(
272-
'实际高度的dp与设计稿px的比例:${ScreenUtil().scaleHeight}',
273-
textAlign: TextAlign.center,
274-
),
275-
SizedBox(
276-
height: 100.h,
277-
),
278-
Text('系统的字体缩放比例:${ScreenUtil().textScaleFactor}'),
279-
Column(
280-
crossAxisAlignment: CrossAxisAlignment.start,
281-
children: <Widget>[
282-
Text(
283-
'我的文字大小在设计稿上是24px,不会随着系统的文字缩放比例变化',
284-
style: TextStyle(
285-
color: Colors.black,
286-
fontSize: 24.sp,
287-
),
288-
),
289-
Text(
290-
'我的文字大小在设计稿上是24px,会随着系统的文字缩放比例变化',
291-
style: TextStyle(
292-
color: Colors.black,
293-
fontSize: 24.ssp,
294-
),
295-
),
296-
],
297-
)
298-
],
299-
),
300-
),
301-
);
302-
}
303-
304-
void printScreenInformation() {
305-
print('设备宽度:${1.sw}');
306-
print('设备高度:${1.sh}');
307-
print('设备的像素密度:${ScreenUtil().pixelRatio}');
308-
print('底部安全区距离:${ScreenUtil().bottomBarHeight}dp');
309-
print('状态栏高度:${ScreenUtil().statusBarHeight}dp');
310-
print('实际宽度的dp与设计稿px的比例:${ScreenUtil().scaleWidth}');
311-
print('实际高度的dp与设计稿px的比例:${ScreenUtil().scaleHeight}');
312-
print('宽度和字体相对于设计稿放大的比例:${ScreenUtil().scaleWidth * ScreenUtil().pixelRatio}');
313-
print('高度相对于设计稿放大的比例:${ScreenUtil().scaleHeight * ScreenUtil().pixelRatio}');
314-
print('系统的字体缩放比例:${ScreenUtil().textScaleFactor}');
315-
print('屏幕宽度的0.5:${0.5.sw}');
316-
print('屏幕高度的0.5:${0.5.sh}');
317-
}
318-
}
319-
320187
```
321188
[widget test](https://github.com/OpenFlutter/flutter_screenutil/issues/115)
322189
323190
### 使用示例:
324191
325-
[example demo](https://github.com/OpenFlutter/flutter_ScreenUtil/blob/master/example/lib/main_zh.dart)
192+
[example demo](https://github.com/OpenFlutter/flutter_screenutil/blob/master/example/lib/main_zh.dart)
326193
327194
效果:
328195

README_PT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ class _HomePageState extends State<HomePage> {
333333

334334
### Exemplo:
335335

336-
[Demonstração](/example/lib/main_zh.dart)
336+
[Demonstração](https://github.com/OpenFlutter/flutter_screenutil/blob/master/example/lib/main_zh.dart)
337337

338338
Efeito:
339339

example/ios/Flutter/flutter_export_environment.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
# This is a generated file; do not edit or check into version control.
33
export "FLUTTER_ROOT=/Users/lizhuoyuan/Development/flutter"
44
export "FLUTTER_APPLICATION_PATH=/Users/lizhuoyuan/Development/Project/flutter_screenutil/example"
5-
export "FLUTTER_TARGET=/Users/lizhuoyuan/Development/Project/flutter_screenutil/example/lib/main.dart"
5+
export "FLUTTER_TARGET=lib/main.dart"
66
export "FLUTTER_BUILD_DIR=build"
77
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
8-
export "FLUTTER_FRAMEWORK_DIR=/Users/lizhuoyuan/Development/flutter/bin/cache/artifacts/engine/ios"
8+
export "OTHER_LDFLAGS=$(inherited) -framework Flutter"
9+
export "FLUTTER_FRAMEWORK_DIR=/Users/lizhuoyuan/Development/flutter/bin/cache/artifacts/engine/ios-release"
910
export "FLUTTER_BUILD_NAME=1.0.0"
1011
export "FLUTTER_BUILD_NUMBER=1"
11-
export "TRACK_WIDGET_CREATION=true"
12+
export "DART_OBFUSCATION=false"
13+
export "TRACK_WIDGET_CREATION=false"
14+
export "TREE_SHAKE_ICONS=true"
15+
export "PACKAGE_CONFIG=.packages"

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
/* Begin PBXBuildFile section */
1010
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
1111
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
12-
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
13-
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
14-
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
15-
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1612
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
1713
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
1814
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
@@ -28,8 +24,6 @@
2824
dstPath = "";
2925
dstSubfolderSpec = 10;
3026
files = (
31-
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
32-
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
3327
);
3428
name = "Embed Frameworks";
3529
runOnlyForDeploymentPostprocessing = 0;
@@ -40,13 +34,11 @@
4034
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
4135
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
4236
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
43-
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
4437
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
4538
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
4639
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
4740
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
4841
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
49-
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
5042
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
5143
97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
5244
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
@@ -60,8 +52,6 @@
6052
isa = PBXFrameworksBuildPhase;
6153
buildActionMask = 2147483647;
6254
files = (
63-
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
64-
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
6555
);
6656
runOnlyForDeploymentPostprocessing = 0;
6757
};
@@ -71,9 +61,7 @@
7161
9740EEB11CF90186004384FC /* Flutter */ = {
7262
isa = PBXGroup;
7363
children = (
74-
3B80C3931E831B6300D905FE /* App.framework */,
7564
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
76-
9740EEBA1CF902C7004384FC /* Flutter.framework */,
7765
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7866
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
7967
9740EEB31CF90195004384FC /* Generated.xcconfig */,
@@ -87,7 +75,6 @@
8775
9740EEB11CF90186004384FC /* Flutter */,
8876
97C146F01CF9000F007C117D /* Runner */,
8977
97C146EF1CF9000F007C117D /* Products */,
90-
CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
9178
);
9279
sourceTree = "<group>";
9380
};
@@ -165,6 +152,7 @@
165152
developmentRegion = English;
166153
hasScannedForEncodings = 0;
167154
knownRegions = (
155+
English,
168156
en,
169157
Base,
170158
);
@@ -206,7 +194,7 @@
206194
);
207195
runOnlyForDeploymentPostprocessing = 0;
208196
shellPath = /bin/sh;
209-
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
197+
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
210198
};
211199
9740EEB61CF901F6004384FC /* Run Script */ = {
212200
isa = PBXShellScriptBuildPhase;
@@ -259,7 +247,6 @@
259247
/* Begin XCBuildConfiguration section */
260248
97C147031CF9000F007C117D /* Debug */ = {
261249
isa = XCBuildConfiguration;
262-
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
263250
buildSettings = {
264251
ALWAYS_SEARCH_USER_PATHS = NO;
265252
CLANG_ANALYZER_NONNULL = YES;
@@ -313,7 +300,6 @@
313300
};
314301
97C147041CF9000F007C117D /* Release */ = {
315302
isa = XCBuildConfiguration;
316-
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
317303
buildSettings = {
318304
ALWAYS_SEARCH_USER_PATHS = NO;
319305
CLANG_ANALYZER_NONNULL = YES;
@@ -365,6 +351,7 @@
365351
buildSettings = {
366352
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
367353
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
354+
DEVELOPMENT_TEAM = "";
368355
ENABLE_BITCODE = NO;
369356
FRAMEWORK_SEARCH_PATHS = (
370357
"$(inherited)",
@@ -388,6 +375,7 @@
388375
buildSettings = {
389376
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
390377
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
378+
DEVELOPMENT_TEAM = E4T4EJGC8Z;
391379
ENABLE_BITCODE = NO;
392380
FRAMEWORK_SEARCH_PATHS = (
393381
"$(inherited)",

example/lib/main.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class MyApp extends StatelessWidget {
1616
title: 'Flutter_ScreenUtil',
1717
theme: ThemeData(
1818
primarySwatch: Colors.blue,
19+
textTheme: TextTheme(button: TextStyle(fontSize: 80.nsp)),
1920
),
2021
home: HomePage(title: 'FlutterScreenUtil Demo'),
2122
);
@@ -47,6 +48,7 @@ class _HomePageState extends State<HomePage> {
4748
child: Column(
4849
crossAxisAlignment: CrossAxisAlignment.center,
4950
children: <Widget>[
51+
TextButton(onPressed: null, child: Text('text')),
5052
Row(
5153
children: <Widget>[
5254
// Using Extensions

example/lib/main_zh.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class MyApp extends StatelessWidget {
1616
title: 'Flutter_ScreenUtil',
1717
theme: ThemeData(
1818
primarySwatch: Colors.blue,
19+
textTheme: TextTheme(button: TextStyle(fontSize: 80.nsp)),
1920
),
2021
home: HomePage(title: 'FlutterScreenUtil Demo'),
2122
);

0 commit comments

Comments
 (0)