Showing
13 changed files
with
444 additions
and
232 deletions
@@ -6,9 +6,20 @@ | @@ -6,9 +6,20 @@ | ||
6 | </configurations> | 6 | </configurations> |
7 | </component> | 7 | </component> |
8 | <component name="ChangeListManager"> | 8 | <component name="ChangeListManager"> |
9 | - <list default="true" id="4b1e7c8a-90e5-4705-b34f-bcaa595e12fe" name="Default" comment="example"> | 9 | + <list default="true" id="4b1e7c8a-90e5-4705-b34f-bcaa595e12fe" name="Default" comment="添加文字适配"> |
10 | + <change afterPath="$PROJECT_DIR$/demo_en.png" afterDir="false" /> | ||
11 | + <change afterPath="$PROJECT_DIR$/demo_zh.png" afterDir="false" /> | ||
12 | + <change afterPath="$PROJECT_DIR$/example/lib/main_zh.dart" afterDir="false" /> | ||
10 | <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> | 13 | <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> |
14 | + <change beforePath="$PROJECT_DIR$/CHANGELOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" /> | ||
15 | + <change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" /> | ||
16 | + <change beforePath="$PROJECT_DIR$/README_CN.md" beforeDir="false" afterPath="$PROJECT_DIR$/README_CN.md" afterDir="false" /> | ||
17 | + <change beforePath="$PROJECT_DIR$/demo.PNG" beforeDir="false" /> | ||
18 | + <change beforePath="$PROJECT_DIR$/effect.png" beforeDir="false" /> | ||
19 | + <change beforePath="$PROJECT_DIR$/example/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/example/README.md" afterDir="false" /> | ||
11 | <change beforePath="$PROJECT_DIR$/example/lib/main.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/main.dart" afterDir="false" /> | 20 | <change beforePath="$PROJECT_DIR$/example/lib/main.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/main.dart" afterDir="false" /> |
21 | + <change beforePath="$PROJECT_DIR$/lib/flutter_screenutil.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/flutter_screenutil.dart" afterDir="false" /> | ||
22 | + <change beforePath="$PROJECT_DIR$/pubspec.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/pubspec.yaml" afterDir="false" /> | ||
12 | </list> | 23 | </list> |
13 | <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> | 24 | <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> |
14 | <option name="TRACKING_ENABLED" value="true" /> | 25 | <option name="TRACKING_ENABLED" value="true" /> |
@@ -22,8 +33,8 @@ | @@ -22,8 +33,8 @@ | ||
22 | <file leaf-file-name="main.dart" pinned="false" current-in-tab="true"> | 33 | <file leaf-file-name="main.dart" pinned="false" current-in-tab="true"> |
23 | <entry file="file://$PROJECT_DIR$/example/lib/main.dart"> | 34 | <entry file="file://$PROJECT_DIR$/example/lib/main.dart"> |
24 | <provider selected="true" editor-type-id="text-editor"> | 35 | <provider selected="true" editor-type-id="text-editor"> |
25 | - <state relative-caret-position="-2004"> | ||
26 | - <caret line="5" column="37" lean-forward="true" selection-start-line="5" selection-start-column="37" selection-end-line="5" selection-end-column="37" /> | 36 | + <state relative-caret-position="285"> |
37 | + <caret line="29" column="2" selection-start-line="29" selection-start-column="2" selection-end-line="29" selection-end-column="2" /> | ||
27 | <folding> | 38 | <folding> |
28 | <element signature="e#0#39#0" expanded="true" /> | 39 | <element signature="e#0#39#0" expanded="true" /> |
29 | </folding> | 40 | </folding> |
@@ -40,20 +51,32 @@ | @@ -40,20 +51,32 @@ | ||
40 | </provider> | 51 | </provider> |
41 | </entry> | 52 | </entry> |
42 | </file> | 53 | </file> |
43 | - <file leaf-file-name="README.md" pinned="false" current-in-tab="false"> | ||
44 | - <entry file="file://$PROJECT_DIR$/README.md"> | 54 | + <file leaf-file-name="main_zh.dart" pinned="false" current-in-tab="false"> |
55 | + <entry file="file://$PROJECT_DIR$/example/lib/main_zh.dart"> | ||
45 | <provider selected="true" editor-type-id="text-editor"> | 56 | <provider selected="true" editor-type-id="text-editor"> |
46 | - <state relative-caret-position="445"> | ||
47 | - <caret line="124" column="3" lean-forward="true" selection-start-line="124" selection-start-column="3" selection-end-line="124" selection-end-column="3" /> | 57 | + <state relative-caret-position="69"> |
58 | + <caret line="29" selection-start-line="29" selection-end-line="29" /> | ||
59 | + <folding> | ||
60 | + <element signature="e#0#39#0" expanded="true" /> | ||
61 | + </folding> | ||
48 | </state> | 62 | </state> |
49 | </provider> | 63 | </provider> |
50 | </entry> | 64 | </entry> |
51 | </file> | 65 | </file> |
52 | - <file leaf-file-name="CHANGELOG.md" pinned="false" current-in-tab="false"> | ||
53 | - <entry file="file://$PROJECT_DIR$/CHANGELOG.md"> | 66 | + <file leaf-file-name="flutter_screenutil.dart" pinned="false" current-in-tab="false"> |
67 | + <entry file="file://$PROJECT_DIR$/lib/flutter_screenutil.dart"> | ||
68 | + <provider selected="true" editor-type-id="text-editor"> | ||
69 | + <state relative-caret-position="194"> | ||
70 | + <caret line="69" column="17" lean-forward="true" selection-start-line="69" selection-start-column="17" selection-end-line="69" selection-end-column="17" /> | ||
71 | + </state> | ||
72 | + </provider> | ||
73 | + </entry> | ||
74 | + </file> | ||
75 | + <file leaf-file-name="README.md" pinned="false" current-in-tab="false"> | ||
76 | + <entry file="file://$PROJECT_DIR$/README.md"> | ||
54 | <provider selected="true" editor-type-id="text-editor"> | 77 | <provider selected="true" editor-type-id="text-editor"> |
55 | - <state relative-caret-position="162"> | ||
56 | - <caret line="6" lean-forward="true" selection-start-line="6" selection-end-line="6" /> | 78 | + <state relative-caret-position="42"> |
79 | + <caret line="89" column="10" lean-forward="true" selection-start-line="89" selection-start-column="10" selection-end-line="89" selection-end-column="10" /> | ||
57 | </state> | 80 | </state> |
58 | </provider> | 81 | </provider> |
59 | </entry> | 82 | </entry> |
@@ -61,8 +84,26 @@ | @@ -61,8 +84,26 @@ | ||
61 | <file leaf-file-name="README_CN.md" pinned="false" current-in-tab="false"> | 84 | <file leaf-file-name="README_CN.md" pinned="false" current-in-tab="false"> |
62 | <entry file="file://$PROJECT_DIR$/README_CN.md"> | 85 | <entry file="file://$PROJECT_DIR$/README_CN.md"> |
63 | <provider selected="true" editor-type-id="text-editor"> | 86 | <provider selected="true" editor-type-id="text-editor"> |
64 | - <state relative-caret-position="135"> | ||
65 | - <caret line="5" lean-forward="true" selection-start-line="5" selection-end-line="5" /> | 87 | + <state relative-caret-position="183"> |
88 | + <caret line="47" column="24" lean-forward="true" selection-start-line="47" selection-start-column="24" selection-end-line="47" selection-end-column="24" /> | ||
89 | + </state> | ||
90 | + </provider> | ||
91 | + </entry> | ||
92 | + </file> | ||
93 | + <file leaf-file-name="README.md" pinned="false" current-in-tab="false"> | ||
94 | + <entry file="file://$PROJECT_DIR$/example/README.md"> | ||
95 | + <provider selected="true" editor-type-id="text-editor"> | ||
96 | + <state relative-caret-position="54"> | ||
97 | + <caret line="2" column="23" lean-forward="true" selection-start-line="2" selection-start-column="23" selection-end-line="2" selection-end-column="23" /> | ||
98 | + </state> | ||
99 | + </provider> | ||
100 | + </entry> | ||
101 | + </file> | ||
102 | + <file leaf-file-name="CHANGELOG.md" pinned="false" current-in-tab="false"> | ||
103 | + <entry file="file://$PROJECT_DIR$/CHANGELOG.md"> | ||
104 | + <provider selected="true" editor-type-id="text-editor"> | ||
105 | + <state relative-caret-position="54"> | ||
106 | + <caret line="2" column="37" lean-forward="true" selection-start-line="2" selection-start-column="37" selection-end-line="2" selection-end-column="37" /> | ||
66 | </state> | 107 | </state> |
67 | </provider> | 108 | </provider> |
68 | </entry> | 109 | </entry> |
@@ -94,20 +135,23 @@ | @@ -94,20 +135,23 @@ | ||
94 | <list> | 135 | <list> |
95 | <option value="$PROJECT_DIR$/example/lib/flutter_screenutil.dart" /> | 136 | <option value="$PROJECT_DIR$/example/lib/flutter_screenutil.dart" /> |
96 | <option value="$USER_HOME$/AppData/Roaming/Pub/Cache/git/flutter_screenUtil-62d8b7d3a3cc4323eca1682166d7aee2890b1468/lib/flutter_screenutil.dart" /> | 137 | <option value="$USER_HOME$/AppData/Roaming/Pub/Cache/git/flutter_screenUtil-62d8b7d3a3cc4323eca1682166d7aee2890b1468/lib/flutter_screenutil.dart" /> |
97 | - <option value="$PROJECT_DIR$/lib/flutter_screenutil.dart" /> | ||
98 | <option value="$PROJECT_DIR$/example/pubspec.yaml" /> | 138 | <option value="$PROJECT_DIR$/example/pubspec.yaml" /> |
99 | <option value="$PROJECT_DIR$/example/test/widget_test.dart" /> | 139 | <option value="$PROJECT_DIR$/example/test/widget_test.dart" /> |
100 | <option value="$PROJECT_DIR$/LICENSE" /> | 140 | <option value="$PROJECT_DIR$/LICENSE" /> |
101 | <option value="$PROJECT_DIR$/README-EN.md" /> | 141 | <option value="$PROJECT_DIR$/README-EN.md" /> |
142 | + <option value="$PROJECT_DIR$/CHANGELOG.md" /> | ||
143 | + <option value="$PROJECT_DIR$/lib/flutter_screenutil.dart" /> | ||
144 | + <option value="$PROJECT_DIR$/example/lib/main_en.dart" /> | ||
145 | + <option value="$PROJECT_DIR$/example/README.md" /> | ||
146 | + <option value="$PROJECT_DIR$/README.md" /> | ||
102 | <option value="$PROJECT_DIR$/README_CN.md" /> | 147 | <option value="$PROJECT_DIR$/README_CN.md" /> |
103 | <option value="$PROJECT_DIR$/pubspec.yaml" /> | 148 | <option value="$PROJECT_DIR$/pubspec.yaml" /> |
104 | - <option value="$PROJECT_DIR$/README.md" /> | ||
105 | - <option value="$PROJECT_DIR$/CHANGELOG.md" /> | 149 | + <option value="$PROJECT_DIR$/example/lib/main_zh.dart" /> |
106 | <option value="$PROJECT_DIR$/example/lib/main.dart" /> | 150 | <option value="$PROJECT_DIR$/example/lib/main.dart" /> |
107 | </list> | 151 | </list> |
108 | </option> | 152 | </option> |
109 | </component> | 153 | </component> |
110 | - <component name="ProjectFrameBounds" extendedState="6"> | 154 | + <component name="ProjectFrameBounds"> |
111 | <option name="x" value="-9" /> | 155 | <option name="x" value="-9" /> |
112 | <option name="width" value="1540" /> | 156 | <option name="width" value="1540" /> |
113 | <option name="height" value="1045" /> | 157 | <option name="height" value="1045" /> |
@@ -143,6 +187,11 @@ | @@ -143,6 +187,11 @@ | ||
143 | </path> | 187 | </path> |
144 | <path> | 188 | <path> |
145 | <item name="flutter_ScreenUtil" type="b2602c69:ProjectViewProjectNode" /> | 189 | <item name="flutter_ScreenUtil" type="b2602c69:ProjectViewProjectNode" /> |
190 | + <item name="flutter_ScreenUtil" type="462c0819:PsiDirectoryNode" /> | ||
191 | + <item name="lib" type="462c0819:PsiDirectoryNode" /> | ||
192 | + </path> | ||
193 | + <path> | ||
194 | + <item name="flutter_ScreenUtil" type="b2602c69:ProjectViewProjectNode" /> | ||
146 | <item name="External Libraries" type="cb654da1:ExternalLibrariesNode" /> | 195 | <item name="External Libraries" type="cb654da1:ExternalLibrariesNode" /> |
147 | </path> | 196 | </path> |
148 | </expand> | 197 | </expand> |
@@ -168,117 +217,6 @@ | @@ -168,117 +217,6 @@ | ||
168 | <recent name="F:\screenutil" /> | 217 | <recent name="F:\screenutil" /> |
169 | </key> | 218 | </key> |
170 | </component> | 219 | </component> |
171 | - <component name="RestoreUpdateTree" date="Moments ago" ActionInfo="_Update"> | ||
172 | - <UpdatedFiles> | ||
173 | - <FILE-GROUP> | ||
174 | - <option name="myUpdateName" value="Updated from server" /> | ||
175 | - <option name="myStatusName" value="Changed on server" /> | ||
176 | - <option name="mySupportsDeletion" value="false" /> | ||
177 | - <option name="myCanBeAbsent" value="false" /> | ||
178 | - <option name="myId" value="CHANGED_ON_SERVER" /> | ||
179 | - <FILE-GROUP> | ||
180 | - <option name="myUpdateName" value="Updated" /> | ||
181 | - <option name="myStatusName" value="Changed" /> | ||
182 | - <option name="mySupportsDeletion" value="false" /> | ||
183 | - <option name="myCanBeAbsent" value="false" /> | ||
184 | - <option name="myId" value="UPDATED" /> | ||
185 | - <PATH vcs="Git" revision="">$PROJECT_DIR$/README.md</PATH> | ||
186 | - <PATH vcs="Git" revision="">$PROJECT_DIR$/README_CN.md</PATH> | ||
187 | - </FILE-GROUP> | ||
188 | - <FILE-GROUP> | ||
189 | - <option name="myUpdateName" value="Created" /> | ||
190 | - <option name="myStatusName" value="Created" /> | ||
191 | - <option name="mySupportsDeletion" value="false" /> | ||
192 | - <option name="myCanBeAbsent" value="false" /> | ||
193 | - <option name="myId" value="CREATED" /> | ||
194 | - </FILE-GROUP> | ||
195 | - <FILE-GROUP> | ||
196 | - <option name="myUpdateName" value="Deleted" /> | ||
197 | - <option name="myStatusName" value="Deleted" /> | ||
198 | - <option name="mySupportsDeletion" value="false" /> | ||
199 | - <option name="myCanBeAbsent" value="true" /> | ||
200 | - <option name="myId" value="REMOVED_FROM_REPOSITORY" /> | ||
201 | - </FILE-GROUP> | ||
202 | - <FILE-GROUP> | ||
203 | - <option name="myUpdateName" value="Restored" /> | ||
204 | - <option name="myStatusName" value="Will be restored" /> | ||
205 | - <option name="mySupportsDeletion" value="false" /> | ||
206 | - <option name="myCanBeAbsent" value="false" /> | ||
207 | - <option name="myId" value="RESTORED" /> | ||
208 | - </FILE-GROUP> | ||
209 | - </FILE-GROUP> | ||
210 | - <FILE-GROUP> | ||
211 | - <option name="myUpdateName" value="Modified" /> | ||
212 | - <option name="myStatusName" value="Modified" /> | ||
213 | - <option name="mySupportsDeletion" value="false" /> | ||
214 | - <option name="myCanBeAbsent" value="false" /> | ||
215 | - <option name="myId" value="MODIFIED" /> | ||
216 | - </FILE-GROUP> | ||
217 | - <FILE-GROUP> | ||
218 | - <option name="myUpdateName" value="Skipped" /> | ||
219 | - <option name="myStatusName" value="Skipped" /> | ||
220 | - <option name="mySupportsDeletion" value="false" /> | ||
221 | - <option name="myCanBeAbsent" value="false" /> | ||
222 | - <option name="myId" value="SKIPPED" /> | ||
223 | - </FILE-GROUP> | ||
224 | - <FILE-GROUP> | ||
225 | - <option name="myUpdateName" value="Merged with conflicts" /> | ||
226 | - <option name="myStatusName" value="Will be merged with conflicts" /> | ||
227 | - <option name="mySupportsDeletion" value="false" /> | ||
228 | - <option name="myCanBeAbsent" value="false" /> | ||
229 | - <option name="myId" value="MERGED_WITH_CONFLICTS" /> | ||
230 | - </FILE-GROUP> | ||
231 | - <FILE-GROUP> | ||
232 | - <option name="myUpdateName" value="Merged with tree conflicts" /> | ||
233 | - <option name="myStatusName" value="Merged with tree conflicts" /> | ||
234 | - <option name="mySupportsDeletion" value="false" /> | ||
235 | - <option name="myCanBeAbsent" value="false" /> | ||
236 | - <option name="myId" value="MERGED_WITH_TREE_CONFLICT" /> | ||
237 | - </FILE-GROUP> | ||
238 | - <FILE-GROUP> | ||
239 | - <option name="myUpdateName" value="Merged with property conflicts" /> | ||
240 | - <option name="myStatusName" value="Will be merged with property conflicts" /> | ||
241 | - <option name="mySupportsDeletion" value="false" /> | ||
242 | - <option name="myCanBeAbsent" value="false" /> | ||
243 | - <option name="myId" value="MERGED_WITH_PROPERTY_CONFLICT" /> | ||
244 | - </FILE-GROUP> | ||
245 | - <FILE-GROUP> | ||
246 | - <option name="myUpdateName" value="Merged" /> | ||
247 | - <option name="myStatusName" value="Will be merged" /> | ||
248 | - <option name="mySupportsDeletion" value="false" /> | ||
249 | - <option name="myCanBeAbsent" value="false" /> | ||
250 | - <option name="myId" value="MERGED" /> | ||
251 | - </FILE-GROUP> | ||
252 | - <FILE-GROUP> | ||
253 | - <option name="myUpdateName" value="Not in repository" /> | ||
254 | - <option name="myStatusName" value="Not in repository" /> | ||
255 | - <option name="mySupportsDeletion" value="true" /> | ||
256 | - <option name="myCanBeAbsent" value="false" /> | ||
257 | - <option name="myId" value="UNKNOWN" /> | ||
258 | - </FILE-GROUP> | ||
259 | - <FILE-GROUP> | ||
260 | - <option name="myUpdateName" value="Locally added" /> | ||
261 | - <option name="myStatusName" value="Locally added" /> | ||
262 | - <option name="mySupportsDeletion" value="false" /> | ||
263 | - <option name="myCanBeAbsent" value="false" /> | ||
264 | - <option name="myId" value="LOCALLY_ADDED" /> | ||
265 | - </FILE-GROUP> | ||
266 | - <FILE-GROUP> | ||
267 | - <option name="myUpdateName" value="Locally removed" /> | ||
268 | - <option name="myStatusName" value="Locally removed" /> | ||
269 | - <option name="mySupportsDeletion" value="false" /> | ||
270 | - <option name="myCanBeAbsent" value="false" /> | ||
271 | - <option name="myId" value="LOCALLY_REMOVED" /> | ||
272 | - </FILE-GROUP> | ||
273 | - <FILE-GROUP> | ||
274 | - <option name="myUpdateName" value="Switched" /> | ||
275 | - <option name="myStatusName" value="Switched" /> | ||
276 | - <option name="mySupportsDeletion" value="false" /> | ||
277 | - <option name="myCanBeAbsent" value="false" /> | ||
278 | - <option name="myId" value="SWITCHED" /> | ||
279 | - </FILE-GROUP> | ||
280 | - </UpdatedFiles> | ||
281 | - </component> | ||
282 | <component name="RunDashboard"> | 220 | <component name="RunDashboard"> |
283 | <option name="ruleStates"> | 221 | <option name="ruleStates"> |
284 | <list> | 222 | <list> |
@@ -291,13 +229,16 @@ | @@ -291,13 +229,16 @@ | ||
291 | </list> | 229 | </list> |
292 | </option> | 230 | </option> |
293 | </component> | 231 | </component> |
294 | - <component name="RunManager"> | 232 | + <component name="RunManager" selected="Flutter.main.dart"> |
295 | <configuration default="true" type="Application" factoryName="Application"> | 233 | <configuration default="true" type="Application" factoryName="Application"> |
296 | <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> | 234 | <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> |
297 | </configuration> | 235 | </configuration> |
298 | <configuration name="main.dart" type="FlutterRunConfigurationType" factoryName="Flutter" temporary="true" nameIsGenerated="true"> | 236 | <configuration name="main.dart" type="FlutterRunConfigurationType" factoryName="Flutter" temporary="true" nameIsGenerated="true"> |
299 | <option name="filePath" value="$PROJECT_DIR$/example/lib/main.dart" /> | 237 | <option name="filePath" value="$PROJECT_DIR$/example/lib/main.dart" /> |
300 | </configuration> | 238 | </configuration> |
239 | + <configuration name="main_zh.dart" type="FlutterRunConfigurationType" factoryName="Flutter" temporary="true" nameIsGenerated="true"> | ||
240 | + <option name="filePath" value="$PROJECT_DIR$/example/lib/main_zh.dart" /> | ||
241 | + </configuration> | ||
301 | <configuration default="true" type="TestNG" factoryName="TestNG"> | 242 | <configuration default="true" type="TestNG" factoryName="TestNG"> |
302 | <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> | 243 | <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> |
303 | <option name="ALTERNATIVE_JRE_PATH" /> | 244 | <option name="ALTERNATIVE_JRE_PATH" /> |
@@ -353,9 +294,14 @@ | @@ -353,9 +294,14 @@ | ||
353 | <configuration name="<template>" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" default="true" selected="false"> | 294 | <configuration name="<template>" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" default="true" selected="false"> |
354 | <option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" /> | 295 | <option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" /> |
355 | </configuration> | 296 | </configuration> |
297 | + <list> | ||
298 | + <item itemvalue="Flutter.main.dart" /> | ||
299 | + <item itemvalue="Flutter.main_zh.dart" /> | ||
300 | + </list> | ||
356 | <recent_temporary> | 301 | <recent_temporary> |
357 | <list> | 302 | <list> |
358 | <item itemvalue="Flutter.main.dart" /> | 303 | <item itemvalue="Flutter.main.dart" /> |
304 | + <item itemvalue="Flutter.main_zh.dart" /> | ||
359 | </list> | 305 | </list> |
360 | </recent_temporary> | 306 | </recent_temporary> |
361 | </component> | 307 | </component> |
@@ -541,24 +487,33 @@ | @@ -541,24 +487,33 @@ | ||
541 | <option name="localTasksCounter" value="25" /> | 487 | <option name="localTasksCounter" value="25" /> |
542 | <servers /> | 488 | <servers /> |
543 | </component> | 489 | </component> |
490 | + <component name="TodoView" selected-index="4"> | ||
491 | + <todo-panel id="selected-file"> | ||
492 | + <is-autoscroll-to-source value="true" /> | ||
493 | + </todo-panel> | ||
494 | + <todo-panel id="all"> | ||
495 | + <are-packages-shown value="true" /> | ||
496 | + <is-autoscroll-to-source value="true" /> | ||
497 | + </todo-panel> | ||
498 | + </component> | ||
544 | <component name="ToolWindowManager"> | 499 | <component name="ToolWindowManager"> |
545 | - <frame x="-8" y="-8" width="1936" height="1056" extended-state="6" /> | 500 | + <frame x="-9" y="0" width="1540" height="1045" extended-state="0" /> |
546 | <editor active="true" /> | 501 | <editor active="true" /> |
547 | <layout> | 502 | <layout> |
548 | - <window_info anchor="bottom" id="TODO" order="6" /> | ||
549 | - <window_info active="true" anchor="bottom" id="Messages" order="8" sideWeight="0.49573562" visible="true" weight="0.3293348" /> | 503 | + <window_info active="true" anchor="bottom" id="TODO" order="6" visible="true" weight="0.3289183" /> |
550 | <window_info anchor="right" id="Palette	" order="4" /> | 504 | <window_info anchor="right" id="Palette	" order="4" /> |
551 | <window_info id="Image Layers" order="3" /> | 505 | <window_info id="Image Layers" order="3" /> |
552 | <window_info anchor="right" id="Capture Analysis" order="4" /> | 506 | <window_info anchor="right" id="Capture Analysis" order="4" /> |
553 | <window_info anchor="bottom" id="Event Log" order="8" sideWeight="0.5042644" side_tool="true" weight="0.3297062" /> | 507 | <window_info anchor="bottom" id="Event Log" order="8" sideWeight="0.5042644" side_tool="true" weight="0.3297062" /> |
554 | <window_info anchor="bottom" id="Dart Analysis" order="8" weight="0.3297062" /> | 508 | <window_info anchor="bottom" id="Dart Analysis" order="8" weight="0.3297062" /> |
555 | - <window_info anchor="bottom" id="Run" order="2" weight="0.3293348" /> | 509 | + <window_info anchor="bottom" id="Run" order="2" weight="0.3289183" /> |
556 | <window_info anchor="bottom" id="Version Control" order="8" weight="0.32861805" /> | 510 | <window_info anchor="bottom" id="Version Control" order="8" weight="0.32861805" /> |
557 | <window_info anchor="bottom" id="Terminal" order="8" sideWeight="0.49573562" weight="0.32824427" /> | 511 | <window_info anchor="bottom" id="Terminal" order="8" sideWeight="0.49573562" weight="0.32824427" /> |
558 | <window_info anchor="right" id="Flutter Outline" order="4" /> | 512 | <window_info anchor="right" id="Flutter Outline" order="4" /> |
559 | <window_info id="Capture Tool" order="3" /> | 513 | <window_info id="Capture Tool" order="3" /> |
560 | <window_info id="Designer" order="3" /> | 514 | <window_info id="Designer" order="3" /> |
561 | - <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25" /> | 515 | + <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.31689188" /> |
516 | + <window_info anchor="bottom" id="Find" order="1" weight="0.3289183" /> | ||
562 | <window_info id="Structure" order="1" side_tool="true" weight="0.25" /> | 517 | <window_info id="Structure" order="1" side_tool="true" weight="0.25" /> |
563 | <window_info anchor="right" id="Fabric" order="4" /> | 518 | <window_info anchor="right" id="Fabric" order="4" /> |
564 | <window_info anchor="right" id="Theme Preview" order="4" /> | 519 | <window_info anchor="right" id="Theme Preview" order="4" /> |
@@ -570,10 +525,10 @@ | @@ -570,10 +525,10 @@ | ||
570 | <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> | 525 | <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> |
571 | <window_info id="Build Variants" order="3" side_tool="true" /> | 526 | <window_info id="Build Variants" order="3" side_tool="true" /> |
572 | <window_info anchor="bottom" id="Android Profiler" order="8" show_stripe_button="false" /> | 527 | <window_info anchor="bottom" id="Android Profiler" order="8" show_stripe_button="false" /> |
573 | - <window_info anchor="bottom" id="Find" order="1" /> | ||
574 | <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> | 528 | <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> |
575 | <window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> | 529 | <window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> |
576 | <window_info anchor="bottom" id="Logcat" order="8" /> | 530 | <window_info anchor="bottom" id="Logcat" order="8" /> |
531 | + <window_info active="true" anchor="bottom" id="Messages" order="8" sideWeight="0.49573562" visible="true" weight="0.3293348" /> | ||
577 | <window_info anchor="bottom" id="Message" order="0" /> | 532 | <window_info anchor="bottom" id="Message" order="0" /> |
578 | <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> | 533 | <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> |
579 | <window_info anchor="right" id="Device File Explorer" order="4" side_tool="true" /> | 534 | <window_info anchor="right" id="Device File Explorer" order="4" side_tool="true" /> |
@@ -595,7 +550,8 @@ | @@ -595,7 +550,8 @@ | ||
595 | <MESSAGE value="0.2.2" /> | 550 | <MESSAGE value="0.2.2" /> |
596 | <MESSAGE value="readme" /> | 551 | <MESSAGE value="readme" /> |
597 | <MESSAGE value="example" /> | 552 | <MESSAGE value="example" /> |
598 | - <option name="LAST_COMMIT_MESSAGE" value="example" /> | 553 | + <MESSAGE value="添加文字适配" /> |
554 | + <option name="LAST_COMMIT_MESSAGE" value="添加文字适配" /> | ||
599 | </component> | 555 | </component> |
600 | <component name="XDebuggerManager"> | 556 | <component name="XDebuggerManager"> |
601 | <breakpoint-manager> | 557 | <breakpoint-manager> |
@@ -603,21 +559,6 @@ | @@ -603,21 +559,6 @@ | ||
603 | </breakpoint-manager> | 559 | </breakpoint-manager> |
604 | </component> | 560 | </component> |
605 | <component name="editorHistoryManager"> | 561 | <component name="editorHistoryManager"> |
606 | - <entry file="file://$PROJECT_DIR$/example/lib/flutter_screenutil.dart" /> | ||
607 | - <entry file="file://$PROJECT_DIR$/README.md"> | ||
608 | - <provider selected="true" editor-type-id="text-editor"> | ||
609 | - <state relative-caret-position="2457"> | ||
610 | - <caret line="91" column="29" lean-forward="true" selection-start-line="91" selection-start-column="29" selection-end-line="91" selection-end-column="29" /> | ||
611 | - </state> | ||
612 | - </provider> | ||
613 | - </entry> | ||
614 | - <entry file="file://$PROJECT_DIR$/README_CN.md"> | ||
615 | - <provider selected="true" editor-type-id="text-editor"> | ||
616 | - <state relative-caret-position="3240"> | ||
617 | - <caret line="120" column="6" selection-start-line="120" selection-start-column="6" selection-end-line="120" selection-end-column="6" /> | ||
618 | - </state> | ||
619 | - </provider> | ||
620 | - </entry> | ||
621 | <entry file="file://$PROJECT_DIR$/example/pubspec.yaml"> | 562 | <entry file="file://$PROJECT_DIR$/example/pubspec.yaml"> |
622 | <provider selected="true" editor-type-id="text-editor"> | 563 | <provider selected="true" editor-type-id="text-editor"> |
623 | <state relative-caret-position="432"> | 564 | <state relative-caret-position="432"> |
@@ -842,13 +783,6 @@ | @@ -842,13 +783,6 @@ | ||
842 | </state> | 783 | </state> |
843 | </provider> | 784 | </provider> |
844 | </entry> | 785 | </entry> |
845 | - <entry file="file://D:/flutter/packages/flutter/lib/src/widgets/media_query.dart"> | ||
846 | - <provider selected="true" editor-type-id="text-editor"> | ||
847 | - <state relative-caret-position="250"> | ||
848 | - <caret line="61" column="88" selection-start-line="61" selection-start-column="72" selection-end-line="61" selection-end-column="88" /> | ||
849 | - </state> | ||
850 | - </provider> | ||
851 | - </entry> | ||
852 | <entry file="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.flutter-io.cn/common_utils-1.0.2/lib/src/screen_util.dart"> | 786 | <entry file="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.flutter-io.cn/common_utils-1.0.2/lib/src/screen_util.dart"> |
853 | <provider selected="true" editor-type-id="text-editor"> | 787 | <provider selected="true" editor-type-id="text-editor"> |
854 | <state relative-caret-position="570"> | 788 | <state relative-caret-position="570"> |
@@ -857,13 +791,6 @@ | @@ -857,13 +791,6 @@ | ||
857 | </provider> | 791 | </provider> |
858 | </entry> | 792 | </entry> |
859 | <entry file="file://$PROJECT_DIR$/example/lib/flutter_screenutil.dart" /> | 793 | <entry file="file://$PROJECT_DIR$/example/lib/flutter_screenutil.dart" /> |
860 | - <entry file="file://$PROJECT_DIR$/lib/flutter_screenutil.dart"> | ||
861 | - <provider selected="true" editor-type-id="text-editor"> | ||
862 | - <state relative-caret-position="697"> | ||
863 | - <caret line="70" column="26" selection-start-line="70" selection-start-column="26" selection-end-line="70" selection-end-column="26" /> | ||
864 | - </state> | ||
865 | - </provider> | ||
866 | - </entry> | ||
867 | <entry file="file://$PROJECT_DIR$/example/pubspec.yaml"> | 794 | <entry file="file://$PROJECT_DIR$/example/pubspec.yaml"> |
868 | <provider selected="true" editor-type-id="text-editor"> | 795 | <provider selected="true" editor-type-id="text-editor"> |
869 | <state relative-caret-position="270"> | 796 | <state relative-caret-position="270"> |
@@ -884,43 +811,79 @@ | @@ -884,43 +811,79 @@ | ||
884 | </state> | 811 | </state> |
885 | </provider> | 812 | </provider> |
886 | </entry> | 813 | </entry> |
887 | - <entry file="file://$PROJECT_DIR$/effect.png"> | 814 | + <entry file="file://$PROJECT_DIR$/demo_en.png"> |
888 | <provider selected="true" editor-type-id="images"> | 815 | <provider selected="true" editor-type-id="images"> |
889 | <state /> | 816 | <state /> |
890 | </provider> | 817 | </provider> |
891 | </entry> | 818 | </entry> |
892 | - <entry file="file://$PROJECT_DIR$/pubspec.yaml"> | 819 | + <entry file="file://$PROJECT_DIR$/demo.PNG"> |
820 | + <provider selected="true" editor-type-id="images"> | ||
821 | + <state /> | ||
822 | + </provider> | ||
823 | + </entry> | ||
824 | + <entry file="file://D:/flutter/packages/flutter/lib/src/widgets/media_query.dart"> | ||
825 | + <provider selected="true" editor-type-id="text-editor"> | ||
826 | + <state relative-caret-position="140"> | ||
827 | + <caret line="86" column="5" lean-forward="true" selection-start-line="86" selection-start-column="5" selection-end-line="86" selection-end-column="5" /> | ||
828 | + </state> | ||
829 | + </provider> | ||
830 | + </entry> | ||
831 | + <entry file="file://$PROJECT_DIR$/CHANGELOG.md"> | ||
893 | <provider selected="true" editor-type-id="text-editor"> | 832 | <provider selected="true" editor-type-id="text-editor"> |
894 | <state relative-caret-position="54"> | 833 | <state relative-caret-position="54"> |
895 | - <caret line="2" column="14" lean-forward="true" selection-start-line="2" selection-start-column="14" selection-end-line="2" selection-end-column="14" /> | 834 | + <caret line="2" column="37" lean-forward="true" selection-start-line="2" selection-start-column="37" selection-end-line="2" selection-end-column="37" /> |
896 | </state> | 835 | </state> |
897 | </provider> | 836 | </provider> |
898 | </entry> | 837 | </entry> |
899 | - <entry file="file://$PROJECT_DIR$/README_CN.md"> | 838 | + <entry file="file://$PROJECT_DIR$/example/README.md"> |
839 | + <provider selected="true" editor-type-id="text-editor"> | ||
840 | + <state relative-caret-position="54"> | ||
841 | + <caret line="2" column="23" lean-forward="true" selection-start-line="2" selection-start-column="23" selection-end-line="2" selection-end-column="23" /> | ||
842 | + </state> | ||
843 | + </provider> | ||
844 | + </entry> | ||
845 | + <entry file="file://$PROJECT_DIR$/lib/flutter_screenutil.dart"> | ||
900 | <provider selected="true" editor-type-id="text-editor"> | 846 | <provider selected="true" editor-type-id="text-editor"> |
901 | - <state relative-caret-position="135"> | ||
902 | - <caret line="5" lean-forward="true" selection-start-line="5" selection-end-line="5" /> | 847 | + <state relative-caret-position="194"> |
848 | + <caret line="69" column="17" lean-forward="true" selection-start-line="69" selection-start-column="17" selection-end-line="69" selection-end-column="17" /> | ||
903 | </state> | 849 | </state> |
904 | </provider> | 850 | </provider> |
905 | </entry> | 851 | </entry> |
906 | <entry file="file://$PROJECT_DIR$/README.md"> | 852 | <entry file="file://$PROJECT_DIR$/README.md"> |
907 | <provider selected="true" editor-type-id="text-editor"> | 853 | <provider selected="true" editor-type-id="text-editor"> |
908 | - <state relative-caret-position="445"> | ||
909 | - <caret line="124" column="3" lean-forward="true" selection-start-line="124" selection-start-column="3" selection-end-line="124" selection-end-column="3" /> | 854 | + <state relative-caret-position="42"> |
855 | + <caret line="89" column="10" lean-forward="true" selection-start-line="89" selection-start-column="10" selection-end-line="89" selection-end-column="10" /> | ||
910 | </state> | 856 | </state> |
911 | </provider> | 857 | </provider> |
912 | </entry> | 858 | </entry> |
913 | - <entry file="file://$PROJECT_DIR$/CHANGELOG.md"> | 859 | + <entry file="file://$PROJECT_DIR$/README_CN.md"> |
914 | <provider selected="true" editor-type-id="text-editor"> | 860 | <provider selected="true" editor-type-id="text-editor"> |
915 | - <state relative-caret-position="162"> | ||
916 | - <caret line="6" lean-forward="true" selection-start-line="6" selection-end-line="6" /> | 861 | + <state relative-caret-position="183"> |
862 | + <caret line="47" column="24" lean-forward="true" selection-start-line="47" selection-start-column="24" selection-end-line="47" selection-end-column="24" /> | ||
863 | + </state> | ||
864 | + </provider> | ||
865 | + </entry> | ||
866 | + <entry file="file://$PROJECT_DIR$/pubspec.yaml"> | ||
867 | + <provider selected="true" editor-type-id="text-editor"> | ||
868 | + <state relative-caret-position="54"> | ||
869 | + <caret line="2" column="14" lean-forward="true" selection-start-line="2" selection-start-column="14" selection-end-line="2" selection-end-column="14" /> | ||
870 | + </state> | ||
871 | + </provider> | ||
872 | + </entry> | ||
873 | + <entry file="file://$PROJECT_DIR$/example/lib/main_zh.dart"> | ||
874 | + <provider selected="true" editor-type-id="text-editor"> | ||
875 | + <state relative-caret-position="69"> | ||
876 | + <caret line="29" selection-start-line="29" selection-end-line="29" /> | ||
877 | + <folding> | ||
878 | + <element signature="e#0#39#0" expanded="true" /> | ||
879 | + </folding> | ||
917 | </state> | 880 | </state> |
918 | </provider> | 881 | </provider> |
919 | </entry> | 882 | </entry> |
920 | <entry file="file://$PROJECT_DIR$/example/lib/main.dart"> | 883 | <entry file="file://$PROJECT_DIR$/example/lib/main.dart"> |
921 | <provider selected="true" editor-type-id="text-editor"> | 884 | <provider selected="true" editor-type-id="text-editor"> |
922 | - <state relative-caret-position="-2004"> | ||
923 | - <caret line="5" column="37" lean-forward="true" selection-start-line="5" selection-start-column="37" selection-end-line="5" selection-end-column="37" /> | 885 | + <state relative-caret-position="285"> |
886 | + <caret line="29" column="2" selection-start-line="29" selection-start-column="2" selection-end-line="29" selection-end-column="2" /> | ||
924 | <folding> | 887 | <folding> |
925 | <element signature="e#0#39#0" expanded="true" /> | 888 | <element signature="e#0#39#0" expanded="true" /> |
926 | </folding> | 889 | </folding> |
@@ -37,7 +37,7 @@ ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context); | @@ -37,7 +37,7 @@ ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context); | ||
37 | 37 | ||
38 | ### Use: | 38 | ### Use: |
39 | 39 | ||
40 | -Fit size: | 40 | +Adapt screen size: |
41 | ``` | 41 | ``` |
42 | Pass the px size of the design draft: | 42 | Pass the px size of the design draft: |
43 | 43 | ||
@@ -52,6 +52,22 @@ Container( | @@ -52,6 +52,22 @@ Container( | ||
52 | ), | 52 | ), |
53 | ``` | 53 | ``` |
54 | 54 | ||
55 | +Adapter font: | ||
56 | +``` | ||
57 | + ScreenUtil().setSp(28) //Incoming font size,the unit is pixel, fonts will scale to respect Text Size accessibility settings | ||
58 | + ScreenUtil().setSp(28,false) //Incoming font size,the unit is pixel,fonts will not scale to respect Text Size accessibility settings | ||
59 | + | ||
60 | +for example: | ||
61 | + Text( | ||
62 | + 'My font size is 28px and will not change with the system.', | ||
63 | + style: TextStyle( | ||
64 | + color: Colors.black, | ||
65 | + fontSize: ScreenUtil().setSp(28, false) | ||
66 | + ) | ||
67 | + ), | ||
68 | + | ||
69 | +``` | ||
70 | + | ||
55 | Other related apis: | 71 | Other related apis: |
56 | ``` | 72 | ``` |
57 | ScreenUtil.pixelRatio //Device pixel density | 73 | ScreenUtil.pixelRatio //Device pixel density |
@@ -73,15 +89,21 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -73,15 +89,21 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
73 | 89 | ||
74 | @override | 90 | @override |
75 | Widget build(BuildContext context) { | 91 | Widget build(BuildContext context) { |
76 | - //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) | 92 | + //设置适配尺寸 (填入设计稿中设备的屏幕尺寸) 假如设计稿是按iPhone6的尺寸设计的(iPhone6 750*1334) |
77 | ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context); | 93 | ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context); |
78 | print('Device width:${ScreenUtil.screenWidth}'); //Device width | 94 | print('Device width:${ScreenUtil.screenWidth}'); //Device width |
79 | print('Device height:${ScreenUtil.screenHeight}'); //Device height | 95 | print('Device height:${ScreenUtil.screenHeight}'); //Device height |
80 | - print('Device pixel density:${ScreenUtil.pixelRatio}'); //Device pixel density | ||
81 | - print('Bottom safe zone distance:${ScreenUtil.bottomBarHeight}'); //Bottom safe zone distance,suitable for buttons with full screen | ||
82 | - print('Status bar height:${ScreenUtil.statusBarHeight}px'); //Status bar height , Notch will be higher Unit px | ||
83 | - print('The width is enlarged relative to the design draft:${ScreenUtil().scaleWidth}'); //The width is enlarged relative to the design draft | ||
84 | - print('Height relative to the magnification of the design draft:${ScreenUtil().scaleHeight}'); //Height relative to the magnification of the design draft | 96 | + print( |
97 | + 'Device pixel density:${ScreenUtil.pixelRatio}'); //Device pixel density | ||
98 | + print( | ||
99 | + 'Bottom safe zone distance:${ScreenUtil.bottomBarHeight}'); //Bottom safe zone distance,suitable for buttons with full screen | ||
100 | + print( | ||
101 | + 'Status bar height:${ScreenUtil.statusBarHeight}px'); //Status bar height , Notch will be higher Unit px | ||
102 | + print( | ||
103 | + 'Width is enlarged relative to the design draft:${ScreenUtil().scaleWidth}'); //The width is enlarged relative to the design draft | ||
104 | + print( | ||
105 | + 'Height is enlarged relative to the design draft:${ScreenUtil().scaleHeight}'); //The height is enlarged relative to the design draft | ||
106 | + print('System font scaling:${ScreenUtil.textScaleFactory}'); | ||
85 | 107 | ||
86 | return new Scaffold( | 108 | return new Scaffold( |
87 | appBar: new AppBar( | 109 | appBar: new AppBar( |
@@ -89,6 +111,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -89,6 +111,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
89 | ), | 111 | ), |
90 | body: new Center( | 112 | body: new Center( |
91 | child: Column( | 113 | child: Column( |
114 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
92 | children: <Widget>[ | 115 | children: <Widget>[ |
93 | Row( | 116 | Row( |
94 | children: <Widget>[ | 117 | children: <Widget>[ |
@@ -98,7 +121,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -98,7 +121,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
98 | color: Colors.red, | 121 | color: Colors.red, |
99 | child: Text( | 122 | child: Text( |
100 | 'My width:${ScreenUtil().setWidth(375)}dp', | 123 | 'My width:${ScreenUtil().setWidth(375)}dp', |
101 | - style: TextStyle(color: Colors.white), | 124 | + style: TextStyle( |
125 | + color: Colors.white, | ||
126 | + fontSize: ScreenUtil().setSp(28, false)), | ||
102 | ), | 127 | ), |
103 | ), | 128 | ), |
104 | Container( | 129 | Container( |
@@ -106,7 +131,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -106,7 +131,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
106 | height: ScreenUtil().setHeight(200), | 131 | height: ScreenUtil().setHeight(200), |
107 | color: Colors.blue, | 132 | color: Colors.blue, |
108 | child: Text('My width:${ScreenUtil().setWidth(375)}dp', | 133 | child: Text('My width:${ScreenUtil().setWidth(375)}dp', |
109 | - style: TextStyle(color: Colors.white)), | 134 | + style: TextStyle( |
135 | + color: Colors.white, | ||
136 | + fontSize: ScreenUtil().setSp(28, false))), | ||
110 | ), | 137 | ), |
111 | ], | 138 | ], |
112 | ), | 139 | ), |
@@ -115,8 +142,31 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -115,8 +142,31 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
115 | Text('Device pixel density:${ScreenUtil.pixelRatio}'), | 142 | Text('Device pixel density:${ScreenUtil.pixelRatio}'), |
116 | Text('Bottom safe zone distance:${ScreenUtil.bottomBarHeight}px'), | 143 | Text('Bottom safe zone distance:${ScreenUtil.bottomBarHeight}px'), |
117 | Text('Status bar height:${ScreenUtil.statusBarHeight}px'), | 144 | Text('Status bar height:${ScreenUtil.statusBarHeight}px'), |
118 | - Text('The width is enlarged relative to the design draft:${ScreenUtil().scaleWidth}'), | ||
119 | - Text('Height relative to the magnification of the design draft:${ScreenUtil().scaleHeight}'), | 145 | + Text( |
146 | + 'Width is enlarged relative to the design draft:${ScreenUtil().scaleWidth}', | ||
147 | + textAlign: TextAlign.center, | ||
148 | + ), | ||
149 | + Text( | ||
150 | + 'Height is enlarged relative to the design draft:${ScreenUtil().scaleHeight}', | ||
151 | + textAlign: TextAlign.center, | ||
152 | + ), | ||
153 | + SizedBox( | ||
154 | + height: ScreenUtil().setHeight(200), | ||
155 | + ), | ||
156 | + Text('System font scaling:${ScreenUtil.textScaleFactory}'), | ||
157 | + Column( | ||
158 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
159 | + children: <Widget>[ | ||
160 | + Text( | ||
161 | + 'My font size is 28px and will not change with the system.', | ||
162 | + style: TextStyle( | ||
163 | + color: Colors.black, | ||
164 | + fontSize: ScreenUtil().setSp(28, false))), | ||
165 | + Text('My font size is 28px and will change with the system.', | ||
166 | + style: TextStyle( | ||
167 | + color: Colors.black, fontSize: ScreenUtil().setSp(28))), | ||
168 | + ], | ||
169 | + ) | ||
120 | ], | 170 | ], |
121 | ), | 171 | ), |
122 | ), | 172 | ), |
@@ -126,9 +176,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -126,9 +176,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
126 | 176 | ||
127 | ### example: | 177 | ### example: |
128 | 178 | ||
129 | -[example demo](https://github.com/OpenFlutter/flutter_ScreenUtil/blob/master/example) | 179 | +[example demo](https://github.com/OpenFlutter/flutter_ScreenUtil/blob/master/example/lib/main_zh.dart) |
130 | 180 | ||
131 | effect: | 181 | effect: |
132 | 182 | ||
133 | - | 183 | + |
134 | 184 |
@@ -45,6 +45,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -45,6 +45,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
45 | //传入设计稿的px尺寸: | 45 | //传入设计稿的px尺寸: |
46 | 适配后的宽度width: ScreenUtil().setWidth(540), | 46 | 适配后的宽度width: ScreenUtil().setWidth(540), |
47 | 适配后的高度height: ScreenUtil().setHeight(200), | 47 | 适配后的高度height: ScreenUtil().setHeight(200), |
48 | +高度也根据setWidth来做适配可以保证不变形 | ||
48 | 49 | ||
49 | 例如: | 50 | 例如: |
50 | Container( | 51 | Container( |
@@ -53,6 +54,22 @@ Container( | @@ -53,6 +54,22 @@ Container( | ||
53 | ), | 54 | ), |
54 | ``` | 55 | ``` |
55 | 56 | ||
57 | +适配字体: | ||
58 | +``` | ||
59 | + ScreenUtil().setSp(28) //传入字体大小,根据系统的“字体大小”辅助选项来进行缩放 | ||
60 | + ScreenUtil().setSp(28,false) //传入字体大小,不会根据系统的“字体大小”辅助选项来进行缩放 | ||
61 | + | ||
62 | +for example: | ||
63 | + Text( | ||
64 | + 'My font size is 28px and will not change with the system.', | ||
65 | + style: TextStyle( | ||
66 | + color: Colors.black, | ||
67 | + fontSize: ScreenUtil().setSp(28, false) | ||
68 | + ) | ||
69 | + ), | ||
70 | + | ||
71 | +``` | ||
72 | + | ||
56 | 其他相关api: | 73 | 其他相关api: |
57 | ``` | 74 | ``` |
58 | ScreenUtil.pixelRatio //设备的像素密度 | 75 | ScreenUtil.pixelRatio //设备的像素密度 |
@@ -60,6 +77,7 @@ Container( | @@ -60,6 +77,7 @@ Container( | ||
60 | ScreenUtil.screenHeight //设备高度 | 77 | ScreenUtil.screenHeight //设备高度 |
61 | ScreenUtil.bottomBarHeight //底部安全区距离,适用于全面屏下面有按键的 | 78 | ScreenUtil.bottomBarHeight //底部安全区距离,适用于全面屏下面有按键的 |
62 | ScreenUtil.statusBarHeight //状态栏高度 刘海屏会更高 单位px | 79 | ScreenUtil.statusBarHeight //状态栏高度 刘海屏会更高 单位px |
80 | + ScreenUtil.textScaleFactory //系统字体缩放比例 | ||
63 | 81 | ||
64 | ScreenUtil().scaleWidth //宽度相对于设计稿放大的倍数 | 82 | ScreenUtil().scaleWidth //宽度相对于设计稿放大的倍数 |
65 | ScreenUtil().scaleHeight //高度相对于设计稿放大的倍数 | 83 | ScreenUtil().scaleHeight //高度相对于设计稿放大的倍数 |
@@ -76,13 +94,18 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -76,13 +94,18 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
76 | Widget build(BuildContext context) { | 94 | Widget build(BuildContext context) { |
77 | //设置适配尺寸 (填入设计稿中设备的屏幕尺寸) 假如设计稿是按iPhone6的尺寸设计的(iPhone6 750*1334) | 95 | //设置适配尺寸 (填入设计稿中设备的屏幕尺寸) 假如设计稿是按iPhone6的尺寸设计的(iPhone6 750*1334) |
78 | ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context); | 96 | ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context); |
79 | - print('设备宽度:${ScreenUtil.screenWidth}'); //设备宽度 | ||
80 | - print('设备高度:${ScreenUtil.screenHeight}'); //设备高度 | ||
81 | - print('设备的像素密度:${ScreenUtil.pixelRatio}'); //设备的像素密度 | ||
82 | - print('底部安全区距离:${ScreenUtil.bottomBarHeight}'); //底部安全区距离,适用于全面屏下面有按键的 | ||
83 | - print('状态栏高度:${ScreenUtil.statusBarHeight}px'); //状态栏高度 刘海屏会更高 | ||
84 | - print('宽度相对于设计稿放大的倍数:${ScreenUtil().scaleWidth}'); //宽度相对于设计稿放大的倍数 | ||
85 | - print('高度相对于设计稿放大的倍数:${ScreenUtil().scaleHeight}'); //高度相对于设计稿放大的倍数 | 97 | + print('设备宽度:${ScreenUtil.screenWidth}'); //Device width |
98 | + print('设备高度:${ScreenUtil.screenHeight}'); //Device height | ||
99 | + print('设备的像素密度:${ScreenUtil.pixelRatio}'); //Device pixel density | ||
100 | + print( | ||
101 | + '底部安全区距离:${ScreenUtil.bottomBarHeight}'); //Bottom safe zone distance,suitable for buttons with full screen | ||
102 | + print( | ||
103 | + '状态栏高度:${ScreenUtil.statusBarHeight}px'); //Status bar height , Notch will be higher Unit px | ||
104 | + print( | ||
105 | + '宽度相对于设计稿放大的倍数:${ScreenUtil().scaleWidth}'); //The width is enlarged relative to the design draft | ||
106 | + print( | ||
107 | + '高度相对于设计稿放大的倍数:${ScreenUtil().scaleHeight}'); //The height is enlarged relative to the design draft | ||
108 | + print('系统的字体缩放比例:${ScreenUtil.textScaleFactory}'); | ||
86 | 109 | ||
87 | return new Scaffold( | 110 | return new Scaffold( |
88 | appBar: new AppBar( | 111 | appBar: new AppBar( |
@@ -90,6 +113,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -90,6 +113,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
90 | ), | 113 | ), |
91 | body: new Center( | 114 | body: new Center( |
92 | child: Column( | 115 | child: Column( |
116 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
93 | children: <Widget>[ | 117 | children: <Widget>[ |
94 | Row( | 118 | Row( |
95 | children: <Widget>[ | 119 | children: <Widget>[ |
@@ -98,26 +122,53 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -98,26 +122,53 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
98 | height: ScreenUtil().setHeight(200), | 122 | height: ScreenUtil().setHeight(200), |
99 | color: Colors.red, | 123 | color: Colors.red, |
100 | child: Text( | 124 | child: Text( |
101 | - '我的宽度${ScreenUtil().setWidth(375)}dp', | ||
102 | - style: TextStyle(color: Colors.white), | 125 | + 'My width:${ScreenUtil().setWidth(375)}dp', |
126 | + style: TextStyle( | ||
127 | + color: Colors.white, | ||
128 | + fontSize: ScreenUtil().setSp(28, false)), | ||
103 | ), | 129 | ), |
104 | ), | 130 | ), |
105 | Container( | 131 | Container( |
106 | width: ScreenUtil().setWidth(375), | 132 | width: ScreenUtil().setWidth(375), |
107 | height: ScreenUtil().setHeight(200), | 133 | height: ScreenUtil().setHeight(200), |
108 | color: Colors.blue, | 134 | color: Colors.blue, |
109 | - child: Text('我的宽度${ScreenUtil().setWidth(375)}dp', | ||
110 | - style: TextStyle(color: Colors.white)), | 135 | + child: Text('My width:${ScreenUtil().setWidth(375)}dp', |
136 | + style: TextStyle( | ||
137 | + color: Colors.white, | ||
138 | + fontSize: ScreenUtil().setSp(28, false))), | ||
111 | ), | 139 | ), |
112 | ], | 140 | ], |
113 | ), | 141 | ), |
114 | - Text('设备的屏幕宽度:${ScreenUtil.screenWidth}px'), | ||
115 | - Text('设备的屏幕高度:${ScreenUtil.screenHeight}px'), | ||
116 | - Text('设备的像素密度:${ScreenUtil.pixelRatio}'), | ||
117 | - Text('底部安全区距离:${ScreenUtil.bottomBarHeight}px'), | ||
118 | - Text('状态栏高度:${ScreenUtil.statusBarHeight}px'), | ||
119 | - Text('宽度相对于设计稿放大的倍数:${ScreenUtil().scaleWidth}'), | ||
120 | - Text('高度相对于设计稿放大的倍数:${ScreenUtil().scaleHeight}'), | 142 | + Text('Device width:${ScreenUtil.screenWidth}px'), |
143 | + Text('Device height:${ScreenUtil.screenHeight}px'), | ||
144 | + Text('Device pixel density:${ScreenUtil.pixelRatio}'), | ||
145 | + Text('Bottom safe zone distance:${ScreenUtil.bottomBarHeight}px'), | ||
146 | + Text('Status bar height:${ScreenUtil.statusBarHeight}px'), | ||
147 | + Text( | ||
148 | + 'Width is enlarged relative to the design draft:${ScreenUtil().scaleWidth}', | ||
149 | + textAlign: TextAlign.center, | ||
150 | + ), | ||
151 | + Text( | ||
152 | + 'Height is enlarged relative to the design draft:${ScreenUtil().scaleHeight}', | ||
153 | + textAlign: TextAlign.center, | ||
154 | + ), | ||
155 | + SizedBox( | ||
156 | + height: ScreenUtil().setHeight(200), | ||
157 | + ), | ||
158 | + Text('System font scaling:${ScreenUtil.textScaleFactory}'), | ||
159 | + Column( | ||
160 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
161 | + children: <Widget>[ | ||
162 | + Text( | ||
163 | + '我的文字大小是28px,不会随着系统的文字大小变化', | ||
164 | + style: TextStyle( | ||
165 | + color: Colors.black, | ||
166 | + fontSize: ScreenUtil().setSp(28, false))), | ||
167 | + Text('我的文字大小是28px,会随着系统的文字大小变化', | ||
168 | + style: TextStyle( | ||
169 | + color: Colors.black, fontSize: ScreenUtil().setSp(28))), | ||
170 | + ], | ||
171 | + ) | ||
121 | ], | 172 | ], |
122 | ), | 173 | ), |
123 | ), | 174 | ), |
@@ -127,9 +178,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -127,9 +178,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
127 | 178 | ||
128 | ### 使用示例: | 179 | ### 使用示例: |
129 | 180 | ||
130 | -[example demo](/example) | 181 | +[example demo](/example/lib/main_zh.dart) |
131 | 182 | ||
132 | 效果: | 183 | 效果: |
133 | 184 | ||
134 | - | 185 | + |
135 | 186 |
demo.PNG
deleted
100644 → 0
66.4 KB
demo_en.png
0 → 100644

79.9 KB
demo_zh.png
0 → 100644

85.3 KB
effect.png
deleted
100644 → 0

47 KB
@@ -28,22 +28,22 @@ class MyHomePage extends StatefulWidget { | @@ -28,22 +28,22 @@ class MyHomePage extends StatefulWidget { | ||
28 | 28 | ||
29 | class _MyHomePageState extends State<MyHomePage> { | 29 | class _MyHomePageState extends State<MyHomePage> { |
30 | @override | 30 | @override |
31 | - void initState() { | ||
32 | - // TODO: implement initState | ||
33 | - super.initState(); | ||
34 | - } | ||
35 | - | ||
36 | - @override | ||
37 | Widget build(BuildContext context) { | 31 | Widget build(BuildContext context) { |
38 | //设置适配尺寸 (填入设计稿中设备的屏幕尺寸) 假如设计稿是按iPhone6的尺寸设计的(iPhone6 750*1334) | 32 | //设置适配尺寸 (填入设计稿中设备的屏幕尺寸) 假如设计稿是按iPhone6的尺寸设计的(iPhone6 750*1334) |
39 | ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context); | 33 | ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context); |
40 | - print('设备宽度:${ScreenUtil.screenWidth}'); //Device width | ||
41 | - print('设备高度:${ScreenUtil.screenHeight}'); //Device height | ||
42 | - print('设备的像素密度:${ScreenUtil.pixelRatio}'); //Device pixel density | ||
43 | - print('底部安全区距离:${ScreenUtil.bottomBarHeight}'); //Bottom safe zone distance,suitable for buttons with full screen | ||
44 | - print('状态栏高度:${ScreenUtil.statusBarHeight}px'); //Status bar height , Notch will be higher Unit px | ||
45 | - print('宽度相对于设计稿放大的倍数:${ScreenUtil().scaleWidth}'); //The width is enlarged relative to the design draft | ||
46 | - print('高度相对于设计稿放大的倍数:${ScreenUtil().scaleHeight}'); //The height is enlarged relative to the design draft | 34 | + print('Device width:${ScreenUtil.screenWidth}'); //Device width |
35 | + print('Device height:${ScreenUtil.screenHeight}'); //Device height | ||
36 | + print( | ||
37 | + 'Device pixel density:${ScreenUtil.pixelRatio}'); //Device pixel density | ||
38 | + print( | ||
39 | + 'Bottom safe zone distance:${ScreenUtil.bottomBarHeight}'); //Bottom safe zone distance,suitable for buttons with full screen | ||
40 | + print( | ||
41 | + 'Status bar height:${ScreenUtil.statusBarHeight}px'); //Status bar height , Notch will be higher Unit px | ||
42 | + print( | ||
43 | + 'Width is enlarged relative to the design draft:${ScreenUtil().scaleWidth}'); //The width is enlarged relative to the design draft | ||
44 | + print( | ||
45 | + 'Height is enlarged relative to the design draft:${ScreenUtil().scaleHeight}'); //The height is enlarged relative to the design draft | ||
46 | + print('System font scaling:${ScreenUtil.textScaleFactory}'); | ||
47 | 47 | ||
48 | return new Scaffold( | 48 | return new Scaffold( |
49 | appBar: new AppBar( | 49 | appBar: new AppBar( |
@@ -51,6 +51,7 @@ class _MyHomePageState extends State<MyHomePage> { | @@ -51,6 +51,7 @@ class _MyHomePageState extends State<MyHomePage> { | ||
51 | ), | 51 | ), |
52 | body: new Center( | 52 | body: new Center( |
53 | child: Column( | 53 | child: Column( |
54 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
54 | children: <Widget>[ | 55 | children: <Widget>[ |
55 | Row( | 56 | Row( |
56 | children: <Widget>[ | 57 | children: <Widget>[ |
@@ -60,7 +61,9 @@ class _MyHomePageState extends State<MyHomePage> { | @@ -60,7 +61,9 @@ class _MyHomePageState extends State<MyHomePage> { | ||
60 | color: Colors.red, | 61 | color: Colors.red, |
61 | child: Text( | 62 | child: Text( |
62 | 'My width:${ScreenUtil().setWidth(375)}dp', | 63 | 'My width:${ScreenUtil().setWidth(375)}dp', |
63 | - style: TextStyle(color: Colors.white), | 64 | + style: TextStyle( |
65 | + color: Colors.white, | ||
66 | + fontSize: ScreenUtil().setSp(28, false)), | ||
64 | ), | 67 | ), |
65 | ), | 68 | ), |
66 | Container( | 69 | Container( |
@@ -68,7 +71,9 @@ class _MyHomePageState extends State<MyHomePage> { | @@ -68,7 +71,9 @@ class _MyHomePageState extends State<MyHomePage> { | ||
68 | height: ScreenUtil().setHeight(200), | 71 | height: ScreenUtil().setHeight(200), |
69 | color: Colors.blue, | 72 | color: Colors.blue, |
70 | child: Text('My width:${ScreenUtil().setWidth(375)}dp', | 73 | child: Text('My width:${ScreenUtil().setWidth(375)}dp', |
71 | - style: TextStyle(color: Colors.white)), | 74 | + style: TextStyle( |
75 | + color: Colors.white, | ||
76 | + fontSize: ScreenUtil().setSp(28, false))), | ||
72 | ), | 77 | ), |
73 | ], | 78 | ], |
74 | ), | 79 | ), |
@@ -85,8 +90,24 @@ class _MyHomePageState extends State<MyHomePage> { | @@ -85,8 +90,24 @@ class _MyHomePageState extends State<MyHomePage> { | ||
85 | 'Height is enlarged relative to the design draft:${ScreenUtil().scaleHeight}', | 90 | 'Height is enlarged relative to the design draft:${ScreenUtil().scaleHeight}', |
86 | textAlign: TextAlign.center, | 91 | textAlign: TextAlign.center, |
87 | ), | 92 | ), |
93 | + SizedBox( | ||
94 | + height: ScreenUtil().setHeight(200), | ||
95 | + ), | ||
96 | + Text('System font scaling:${ScreenUtil.textScaleFactory}'), | ||
97 | + Column( | ||
98 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
99 | + children: <Widget>[ | ||
100 | + Text( | ||
101 | + 'My font size is 28px and will not change with the system.', | ||
102 | + style: TextStyle( | ||
103 | + color: Colors.black, | ||
104 | + fontSize: ScreenUtil().setSp(28, false))), | ||
105 | + Text('My font size is 28px and will change with the system.', | ||
106 | + style: TextStyle( | ||
107 | + color: Colors.black, fontSize: ScreenUtil().setSp(28))), | ||
108 | + ], | ||
109 | + ) | ||
88 | ], | 110 | ], |
89 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
90 | ), | 111 | ), |
91 | ), | 112 | ), |
92 | ); | 113 | ); |
example/lib/main_zh.dart
0 → 100644
1 | +import 'package:flutter/material.dart'; | ||
2 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
3 | + | ||
4 | +void main() => runApp(new MyApp()); | ||
5 | + | ||
6 | +class MyApp extends StatelessWidget { | ||
7 | + // This widget is the root of your application. | ||
8 | + @override | ||
9 | + Widget build(BuildContext context) { | ||
10 | + return new MaterialApp( | ||
11 | + title: 'Flutter Demo', | ||
12 | + theme: new ThemeData( | ||
13 | + primarySwatch: Colors.blue, | ||
14 | + ), | ||
15 | + home: new MyHomePage(title: 'Flutter Demo Home Page'), | ||
16 | + ); | ||
17 | + } | ||
18 | +} | ||
19 | + | ||
20 | +class MyHomePage extends StatefulWidget { | ||
21 | + MyHomePage({Key key, this.title}) : super(key: key); | ||
22 | + | ||
23 | + final String title; | ||
24 | + | ||
25 | + @override | ||
26 | + _MyHomePageState createState() => new _MyHomePageState(); | ||
27 | +} | ||
28 | + | ||
29 | +class _MyHomePageState extends State<MyHomePage> { | ||
30 | + @override | ||
31 | + Widget build(BuildContext context) { | ||
32 | + //设置适配尺寸 (填入设计稿中设备的屏幕尺寸) 假如设计稿是按iPhone6的尺寸设计的(iPhone6 750*1334) | ||
33 | + ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context); | ||
34 | + print('设备宽度:${ScreenUtil.screenWidth}'); //Device width | ||
35 | + print('设备高度:${ScreenUtil.screenHeight}'); //Device height | ||
36 | + print('设备的像素密度:${ScreenUtil.pixelRatio}'); //Device pixel density | ||
37 | + print( | ||
38 | + '底部安全区距离:${ScreenUtil.bottomBarHeight}'); //Bottom safe zone distance,suitable for buttons with full screen | ||
39 | + print( | ||
40 | + '状态栏高度:${ScreenUtil.statusBarHeight}px'); //Status bar height , Notch will be higher Unit px | ||
41 | + print( | ||
42 | + '宽度相对于设计稿放大的倍数:${ScreenUtil().scaleWidth}'); //The width is enlarged relative to the design draft | ||
43 | + print( | ||
44 | + '高度相对于设计稿放大的倍数:${ScreenUtil().scaleHeight}'); //The height is enlarged relative to the design draft | ||
45 | + print('系统的字体缩放比例:${ScreenUtil.textScaleFactory}'); | ||
46 | + | ||
47 | + return new Scaffold( | ||
48 | + appBar: new AppBar( | ||
49 | + title: new Text(widget.title), | ||
50 | + ), | ||
51 | + body: new Center( | ||
52 | + child: Column( | ||
53 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
54 | + children: <Widget>[ | ||
55 | + Row( | ||
56 | + children: <Widget>[ | ||
57 | + Container( | ||
58 | + width: ScreenUtil().setWidth(375), | ||
59 | + height: ScreenUtil().setHeight(200), | ||
60 | + color: Colors.red, | ||
61 | + child: Text( | ||
62 | + '我的宽度:${ScreenUtil().setWidth(375)}dp', | ||
63 | + style: TextStyle( | ||
64 | + color: Colors.white, | ||
65 | + fontSize: ScreenUtil().setSp(28, false)), | ||
66 | + ), | ||
67 | + ), | ||
68 | + Container( | ||
69 | + width: ScreenUtil().setWidth(375), | ||
70 | + height: ScreenUtil().setHeight(200), | ||
71 | + color: Colors.blue, | ||
72 | + child: Text('我的宽度:${ScreenUtil().setWidth(375)}dp', | ||
73 | + style: TextStyle( | ||
74 | + color: Colors.white, | ||
75 | + fontSize: ScreenUtil().setSp(28, false))), | ||
76 | + ), | ||
77 | + ], | ||
78 | + ), | ||
79 | + Text('设备宽度:${ScreenUtil.screenWidth}px'), | ||
80 | + Text('设备高度:${ScreenUtil.screenHeight}px'), | ||
81 | + Text('设备的像素密度:${ScreenUtil.pixelRatio}'), | ||
82 | + Text('底部安全区距离:${ScreenUtil.bottomBarHeight}px'), | ||
83 | + Text('状态栏高度:${ScreenUtil.statusBarHeight}px'), | ||
84 | + Text( | ||
85 | + '宽度相对于设计稿放大的倍数:${ScreenUtil().scaleWidth}', | ||
86 | + textAlign: TextAlign.center, | ||
87 | + ), | ||
88 | + Text( | ||
89 | + '高度相对于设计稿放大的倍数:${ScreenUtil().scaleHeight}', | ||
90 | + textAlign: TextAlign.center, | ||
91 | + ), | ||
92 | + SizedBox( | ||
93 | + height: ScreenUtil().setHeight(200), | ||
94 | + ), | ||
95 | + Text('系统的字体缩放比例:${ScreenUtil.textScaleFactory}'), | ||
96 | + Column( | ||
97 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
98 | + children: <Widget>[ | ||
99 | + Text('我的文字大小是28px,不会随着系统的文字大小变化', | ||
100 | + style: TextStyle( | ||
101 | + color: Colors.black, | ||
102 | + fontSize: ScreenUtil().setSp(28, false))), | ||
103 | + Text('我的文字大小是28px,会随着系统的文字大小变化', | ||
104 | + style: TextStyle( | ||
105 | + color: Colors.black, fontSize: ScreenUtil().setSp(28))), | ||
106 | + ], | ||
107 | + ) | ||
108 | + ], | ||
109 | + ), | ||
110 | + ), | ||
111 | + ); | ||
112 | + } | ||
113 | +} |
@@ -10,7 +10,6 @@ class ScreenUtil { | @@ -10,7 +10,6 @@ class ScreenUtil { | ||
10 | 10 | ||
11 | //设计稿的设备尺寸修改 | 11 | //设计稿的设备尺寸修改 |
12 | int _designWidth; | 12 | int _designWidth; |
13 | - | ||
14 | int _designHeight; | 13 | int _designHeight; |
15 | 14 | ||
16 | static MediaQueryData _mediaQueryData; | 15 | static MediaQueryData _mediaQueryData; |
@@ -21,6 +20,8 @@ class ScreenUtil { | @@ -21,6 +20,8 @@ class ScreenUtil { | ||
21 | 20 | ||
22 | static double _bottomBarHeight; | 21 | static double _bottomBarHeight; |
23 | 22 | ||
23 | + static double _textScaleFactor; | ||
24 | + | ||
24 | ScreenUtil({int width, int height}) { | 25 | ScreenUtil({int width, int height}) { |
25 | _designWidth = width; | 26 | _designWidth = width; |
26 | _designHeight = height; | 27 | _designHeight = height; |
@@ -38,10 +39,14 @@ class ScreenUtil { | @@ -38,10 +39,14 @@ class ScreenUtil { | ||
38 | _screenHeight = mediaQuery.size.height; | 39 | _screenHeight = mediaQuery.size.height; |
39 | _statusBarHeight = mediaQuery.padding.top; | 40 | _statusBarHeight = mediaQuery.padding.top; |
40 | _bottomBarHeight = _mediaQueryData.padding.bottom; | 41 | _bottomBarHeight = _mediaQueryData.padding.bottom; |
42 | + _textScaleFactor = mediaQuery.textScaleFactor; | ||
41 | } | 43 | } |
42 | 44 | ||
43 | static MediaQueryData get mediaQueryData => _mediaQueryData; | 45 | static MediaQueryData get mediaQueryData => _mediaQueryData; |
44 | 46 | ||
47 | + ///每个逻辑像素的字体像素数,字体的缩放比例 | ||
48 | + static double get textScaleFactory => _textScaleFactor; | ||
49 | + | ||
45 | ///设备的像素密度 | 50 | ///设备的像素密度 |
46 | static double get pixelRatio => _pixelRatio; | 51 | static double get pixelRatio => _pixelRatio; |
47 | 52 | ||
@@ -71,4 +76,12 @@ class ScreenUtil { | @@ -71,4 +76,12 @@ class ScreenUtil { | ||
71 | /// 或者形状有差异时,高度适配建议使用此方法 | 76 | /// 或者形状有差异时,高度适配建议使用此方法 |
72 | /// 高度适配主要针对想根据设计稿的一屏展示一样的效果 | 77 | /// 高度适配主要针对想根据设计稿的一屏展示一样的效果 |
73 | setHeight(int height) => height * scaleHeight; | 78 | setHeight(int height) => height * scaleHeight; |
79 | + | ||
80 | + ///字体大小适配方法 | ||
81 | + ///@param fontSize 传入设计稿上字体的px , | ||
82 | + ///@param allowFontScaling 控制字体是否要根据系统的“字体大小”辅助选项来进行缩放。默认值为true。 | ||
83 | + ///@param allowFontScaling Specifies whether fonts should scale to respect Text Size accessibility settings. The default is true. | ||
84 | + setSp(int fontSize, [allowFontScaling = true]) => allowFontScaling | ||
85 | + ? setWidth(fontSize) * _textScaleFactor | ||
86 | + : setWidth(fontSize); | ||
74 | } | 87 | } |
1 | name: flutter_screenutil | 1 | name: flutter_screenutil |
2 | -description: A flutter plugin for screen adaptation | ||
3 | -version: 0.2.3 | 2 | +description: A flutter plugin for adapting screen and font size.Guaranteed to look good on different models |
3 | +version: 0.3.0 | ||
4 | author: LiZhuoyuan <zhuoyuan93@gmail.com> | 4 | author: LiZhuoyuan <zhuoyuan93@gmail.com> |
5 | homepage: https://github.com/OpenFlutter/flutter_ScreenUtil | 5 | homepage: https://github.com/OpenFlutter/flutter_ScreenUtil |
6 | 6 |
-
Please register or login to post a comment