LiZhuoyuan

代码优化

1 #!/bin/sh 1 #!/bin/sh
2 # This is a generated file; do not edit or check into version control. 2 # This is a generated file; do not edit or check into version control.
3 -export "FLUTTER_ROOT=/Users/lizhuoyuan/Development/flutter"  
4 -export "FLUTTER_APPLICATION_PATH=/Users/lizhuoyuan/Development/Project/flutter_screenutil/example"  
5 -export "FLUTTER_TARGET=lib/main.dart" 3 +export "FLUTTER_ROOT=D:\Develop\flutter"
  4 +export "FLUTTER_APPLICATION_PATH=D:\Develop\Project\flutter_screenutil\example"
  5 +export "COCOAPODS_PARALLEL_CODE_SIGN=true"
  6 +export "FLUTTER_TARGET=lib\main.dart"
6 export "FLUTTER_BUILD_DIR=build" 7 export "FLUTTER_BUILD_DIR=build"
7 -export "SYMROOT=${SOURCE_ROOT}/../build/ios" 8 +export "SYMROOT=${SOURCE_ROOT}/../build\ios"
8 export "FLUTTER_BUILD_NAME=1.0.0" 9 export "FLUTTER_BUILD_NAME=1.0.0"
9 export "FLUTTER_BUILD_NUMBER=1" 10 export "FLUTTER_BUILD_NUMBER=1"
10 export "DART_OBFUSCATION=false" 11 export "DART_OBFUSCATION=false"
@@ -16,19 +16,18 @@ class ScreenUtilInit extends StatelessWidget { @@ -16,19 +16,18 @@ class ScreenUtilInit extends StatelessWidget {
16 @override 16 @override
17 Widget build(BuildContext context) { 17 Widget build(BuildContext context) {
18 return LayoutBuilder(builder: (_, BoxConstraints constraints) { 18 return LayoutBuilder(builder: (_, BoxConstraints constraints) {
19 - return OrientationBuilder(  
20 - builder: (_, Orientation orientation) {  
21 - if (constraints.maxWidth != 0) {  
22 - ScreenUtil.init(  
23 - constraints,  
24 - orientation: orientation,  
25 - designSize: designSize,  
26 - );  
27 - return builder();  
28 - }  
29 - return Container();  
30 - },  
31 - ); 19 + if (constraints.maxWidth != 0) {
  20 + final Orientation orientation = constraints.maxWidth > constraints.maxHeight
  21 + ? Orientation.landscape
  22 + : Orientation.portrait;
  23 + ScreenUtil.init(
  24 + constraints,
  25 + orientation: orientation,
  26 + designSize: designSize,
  27 + );
  28 + return builder();
  29 + }
  30 + return Container();
32 }); 31 });
33 } 32 }
34 } 33 }