李卓原

v5.9.0

1 -# 5.9.0-beta 1 +# 5.9.0
2 - ScreenUtilInit won't rebuild the whole widget tree 2 - ScreenUtilInit won't rebuild the whole widget tree
3 - Add `fontSizeResolver` to specify how font size should be scaled 3 - Add `fontSizeResolver` to specify how font size should be scaled
4 - Add `diameter` & `diagonal` factors 4 - Add `diameter` & `diagonal` factors
5 - `useInheritedMediaQuery` has not effect, and will be removed in next release 5 - `useInheritedMediaQuery` has not effect, and will be removed in next release
6 - Fix `ensureScreenSize` in web platform 6 - Fix `ensureScreenSize` in web platform
  7 +- add deviceType
7 8
8 # 5.8.4 9 # 5.8.4
9 - bug fix 10 - bug fix
@@ -3,11 +3,12 @@ @@ -3,11 +3,12 @@
3 export "FLUTTER_ROOT=/Users/lizhuoyuan/fvm/versions/stable" 3 export "FLUTTER_ROOT=/Users/lizhuoyuan/fvm/versions/stable"
4 export "FLUTTER_APPLICATION_PATH=/Users/lizhuoyuan/Development/Project/flutter_screenutil/example" 4 export "FLUTTER_APPLICATION_PATH=/Users/lizhuoyuan/Development/Project/flutter_screenutil/example"
5 export "COCOAPODS_PARALLEL_CODE_SIGN=true" 5 export "COCOAPODS_PARALLEL_CODE_SIGN=true"
6 -export "FLUTTER_TARGET=lib/main.dart" 6 +export "FLUTTER_TARGET=/Users/lizhuoyuan/Development/Project/flutter_screenutil/example/lib/main.dart"
7 export "FLUTTER_BUILD_DIR=build" 7 export "FLUTTER_BUILD_DIR=build"
8 export "FLUTTER_BUILD_NAME=1.0.0" 8 export "FLUTTER_BUILD_NAME=1.0.0"
9 export "FLUTTER_BUILD_NUMBER=1" 9 export "FLUTTER_BUILD_NUMBER=1"
  10 +export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC9jZGJlZGE3ODhhMjkzZmEyOTY2NWRjM2ZhM2Q2ZTYzYmQyMjFjYjBkLw=="
10 export "DART_OBFUSCATION=false" 11 export "DART_OBFUSCATION=false"
11 export "TRACK_WIDGET_CREATION=true" 12 export "TRACK_WIDGET_CREATION=true"
12 export "TREE_SHAKE_ICONS=false" 13 export "TREE_SHAKE_ICONS=false"
13 -export "PACKAGE_CONFIG=.dart_tool/package_config.json" 14 +export "PACKAGE_CONFIG=/Users/lizhuoyuan/Development/Project/flutter_screenutil/example/.dart_tool/package_config.json"
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 * email: zhuoyuan93@gmail.com 3 * email: zhuoyuan93@gmail.com
4 */ 4 */
5 5
  6 +import 'dart:io';
6 import 'dart:math' show min, max; 7 import 'dart:math' show min, max;
7 import 'dart:ui' as ui show FlutterView; 8 import 'dart:ui' as ui show FlutterView;
8 9
@@ -240,6 +241,37 @@ class ScreenUtil { @@ -240,6 +241,37 @@ class ScreenUtil {
240 double setSp(num fontSize) => 241 double setSp(num fontSize) =>
241 fontSizeResolver?.call(fontSize, _instance) ?? fontSize * scaleText; 242 fontSizeResolver?.call(fontSize, _instance) ?? fontSize * scaleText;
242 243
  244 + DeviceType deviceType() {
  245 + DeviceType deviceType;
  246 + switch (Platform.operatingSystem) {
  247 + case 'android':
  248 + case 'ios':
  249 + deviceType = DeviceType.mobile;
  250 + if ((orientation == Orientation.portrait && screenWidth < 600) ||
  251 + (orientation == Orientation.landscape && screenHeight < 600)) {
  252 + deviceType = DeviceType.mobile;
  253 + } else {
  254 + deviceType = DeviceType.tablet;
  255 + }
  256 + break;
  257 + case 'linux':
  258 + deviceType = DeviceType.linux;
  259 + break;
  260 + case 'macos':
  261 + deviceType = DeviceType.mac;
  262 + break;
  263 + case 'windows':
  264 + deviceType = DeviceType.windows;
  265 + break;
  266 + case 'fuchsia':
  267 + deviceType = DeviceType.fuchsia;
  268 + break;
  269 + default:
  270 + deviceType = DeviceType.web;
  271 + }
  272 + return deviceType;
  273 + }
  274 +
243 SizedBox setVerticalSpacing(num height) => 275 SizedBox setVerticalSpacing(num height) =>
244 SizedBox(height: setHeight(height)); 276 SizedBox(height: setHeight(height));
245 277
@@ -275,3 +307,5 @@ extension on MediaQueryData? { @@ -275,3 +307,5 @@ extension on MediaQueryData? {
275 return this; 307 return this;
276 } 308 }
277 } 309 }
  310 +
  311 +enum DeviceType { mobile, tablet, web, mac, windows, linux, fuchsia }
1 name: flutter_screenutil 1 name: flutter_screenutil
2 description: A flutter plugin for adapting screen and font size.Guaranteed to look good on different models 2 description: A flutter plugin for adapting screen and font size.Guaranteed to look good on different models
3 -version: 5.9.0-beta 3 +version: 5.9.0
4 homepage: https://github.com/OpenFlutter/flutter_screenutil 4 homepage: https://github.com/OpenFlutter/flutter_screenutil
5 5
6 environment: 6 environment: