Skip to content

Commit

Permalink
v5.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
李卓原 committed Aug 21, 2023
1 parent 7c8d2cc commit 5e6d317
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# 5.9.0-beta
# 5.9.0
- ScreenUtilInit won't rebuild the whole widget tree
- Add `fontSizeResolver` to specify how font size should be scaled
- Add `diameter` & `diagonal` factors
- `useInheritedMediaQuery` has not effect, and will be removed in next release
- Fix `ensureScreenSize` in web platform
- add deviceType

# 5.8.4
- bug fix
Expand Down
5 changes: 3 additions & 2 deletions example/ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
export "FLUTTER_ROOT=/Users/lizhuoyuan/fvm/versions/stable"
export "FLUTTER_APPLICATION_PATH=/Users/lizhuoyuan/Development/Project/flutter_screenutil/example"
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_TARGET=/Users/lizhuoyuan/Development/Project/flutter_screenutil/example/lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC9jZGJlZGE3ODhhMjkzZmEyOTY2NWRjM2ZhM2Q2ZTYzYmQyMjFjYjBkLw=="
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=.dart_tool/package_config.json"
export "PACKAGE_CONFIG=/Users/lizhuoyuan/Development/Project/flutter_screenutil/example/.dart_tool/package_config.json"
34 changes: 34 additions & 0 deletions lib/src/screen_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* email: [email protected]
*/

import 'dart:io';
import 'dart:math' show min, max;
import 'dart:ui' as ui show FlutterView;

Expand Down Expand Up @@ -240,6 +241,37 @@ class ScreenUtil {
double setSp(num fontSize) =>
fontSizeResolver?.call(fontSize, _instance) ?? fontSize * scaleText;

DeviceType deviceType() {
DeviceType deviceType;
switch (Platform.operatingSystem) {
case 'android':
case 'ios':
deviceType = DeviceType.mobile;
if ((orientation == Orientation.portrait && screenWidth < 600) ||
(orientation == Orientation.landscape && screenHeight < 600)) {
deviceType = DeviceType.mobile;
} else {
deviceType = DeviceType.tablet;
}
break;
case 'linux':
deviceType = DeviceType.linux;
break;
case 'macos':
deviceType = DeviceType.mac;
break;
case 'windows':
deviceType = DeviceType.windows;
break;
case 'fuchsia':
deviceType = DeviceType.fuchsia;
break;
default:
deviceType = DeviceType.web;
}
return deviceType;
}

SizedBox setVerticalSpacing(num height) =>
SizedBox(height: setHeight(height));

Expand Down Expand Up @@ -275,3 +307,5 @@ extension on MediaQueryData? {
return this;
}
}

enum DeviceType { mobile, tablet, web, mac, windows, linux, fuchsia }
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_screenutil
description: A flutter plugin for adapting screen and font size.Guaranteed to look good on different models
version: 5.9.0-beta
version: 5.9.0
homepage: https://github.com/OpenFlutter/flutter_screenutil

environment:
Expand Down

0 comments on commit 5e6d317

Please sign in to comment.