diff --git a/lib/app_theme.dart b/lib/app_theme.dart index 1e146fd..7a8939b 100644 --- a/lib/app_theme.dart +++ b/lib/app_theme.dart @@ -83,8 +83,8 @@ final theme = ThemeData( scaffoldBackgroundColor: AppTheme.nearlyWhite, bottomNavigationBarTheme: BottomNavigationBarThemeData( backgroundColor: AppTheme.nearlyWhite, - unselectedLabelStyle: TextStyle(fontSize: ScreenAdaper.sp(20)), - selectedLabelStyle: TextStyle(fontSize: ScreenAdaper.sp(20)), + unselectedLabelStyle: TextStyle(fontSize: ScreenAdaper.height(20)), + selectedLabelStyle: TextStyle(fontSize: ScreenAdaper.height(20)), selectedItemColor: AppTheme.primaryColor), tabBarTheme: const TabBarTheme( indicator: BoxDecoration( @@ -97,16 +97,16 @@ final theme = ThemeData( backgroundColor: AppTheme.primaryColor, titleTextStyle: TextStyle( color: Colors.white, - fontSize: ScreenAdaper.sp(30), + fontSize: ScreenAdaper.height(30), fontWeight: FontWeight.bold), ), inputDecorationTheme: InputDecorationTheme( floatingLabelStyle: TextStyle( color: AppTheme.primaryColor, - fontSize: ScreenAdaper.sp(30), + fontSize: ScreenAdaper.height(30), ), labelStyle: TextStyle( - fontSize: ScreenAdaper.sp(25), + fontSize: ScreenAdaper.height(25), ), border: OutlineInputBorder( borderRadius: BorderRadius.circular(ScreenAdaper.sp(15))), diff --git a/lib/config.dart b/lib/config.dart index e1196b5..dffd048 100644 --- a/lib/config.dart +++ b/lib/config.dart @@ -1,10 +1,11 @@ /// Global config class GloablConfig { - // static const BASE_URL = "http://10.0.2.2:7001/api/"; - // static const BASE_URL = "http://144.123.43.138:3001/api/"; - // static const OSS_URL = "http://144.123.43.138:3001"; - static const BASE_URL = "http://192.168.60.220:8001/api/"; - static const OSS_URL = "http://192.168.60.220:8001"; + // static const BASE_URL = "http://10.0.2.2:8001/api/"; + // static const OSS_URL = "http://10.0.2.2:8001"; + static const BASE_URL = "http://144.123.43.138:3001/api/"; + static const OSS_URL = "http://144.123.43.138:3001"; + // static const BASE_URL = "http://192.168.60.220:8001/api/"; + // static const OSS_URL = "http://192.168.60.220:8001"; static const DOMAIN_NAME = "山矿通"; static const DEBUG = true; static const PRIVACY_POLICY = 'http://h5.heeru.xyz/privacyPolicy.html'; diff --git a/lib/screens/inventory_inout/components/change_button_roe.dart b/lib/screens/inventory_inout/components/change_button_roe.dart index 3e98012..814ae40 100644 --- a/lib/screens/inventory_inout/components/change_button_roe.dart +++ b/lib/screens/inventory_inout/components/change_button_roe.dart @@ -26,7 +26,7 @@ class ChangeButtonRow extends StatelessWidget { icon: Icon( Icons.arrow_back_ios_rounded, color: Colors.white, - size: ScreenAdaper.sp(30), + size: ScreenAdaper.height(30), )), )), const SizedBox( @@ -38,7 +38,7 @@ class ChangeButtonRow extends StatelessWidget { icon: Icon( Icons.arrow_forward_ios_rounded, color: Colors.white, - size: ScreenAdaper.sp(30), + size: ScreenAdaper.height(30), ))), ], ), diff --git a/lib/screens/inventory_inout/components/custom_app_bar.dart b/lib/screens/inventory_inout/components/custom_app_bar.dart index 86fff7f..68cb19b 100644 --- a/lib/screens/inventory_inout/components/custom_app_bar.dart +++ b/lib/screens/inventory_inout/components/custom_app_bar.dart @@ -28,7 +28,7 @@ class CustomAppBar extends StatelessWidget { fontWeight: FontWeight.w400, height: 0, letterSpacing: 2, - fontSize: ScreenAdaper.sp(25)), + fontSize: ScreenAdaper.height(25)), ), Obx( () => Text( @@ -38,7 +38,7 @@ class CustomAppBar extends StatelessWidget { fontWeight: FontWeight.bold, letterSpacing: 2, height: 0, - fontSize: ScreenAdaper.sp(30)), + fontSize: ScreenAdaper.height(30)), ), ) ], @@ -71,7 +71,7 @@ class CustomAppBar extends StatelessWidget { }, child: Container( height: ScreenAdaper.height(70), - width: ScreenAdaper.width(70), + width: ScreenAdaper.height(70), decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), color: AppTheme.primaryColorLight, @@ -87,7 +87,7 @@ class CustomAppBar extends StatelessWidget { ]), child: Icon( Icons.calendar_month_outlined, - size: ScreenAdaper.sp(40), + size: ScreenAdaper.height(40), color: Colors.white, ), ), diff --git a/lib/screens/inventory_inout/components/dates.dart b/lib/screens/inventory_inout/components/dates.dart index 4e46626..28d58b7 100644 --- a/lib/screens/inventory_inout/components/dates.dart +++ b/lib/screens/inventory_inout/components/dates.dart @@ -21,7 +21,7 @@ class Dates extends StatelessWidget { ? Colors.white : Colors.black, fontWeight: FontWeight.bold, - fontSize: ScreenAdaper.sp(18), + fontSize: ScreenAdaper.height(18), height: 0), ), ), @@ -34,7 +34,7 @@ class Dates extends StatelessWidget { ? Colors.white : Colors.black, fontWeight: FontWeight.bold, - fontSize: ScreenAdaper.sp(30), + fontSize: ScreenAdaper.height(30), height: 0), ), ), @@ -47,7 +47,7 @@ class Dates extends StatelessWidget { ? Colors.white : Colors.black, fontWeight: FontWeight.bold, - fontSize: ScreenAdaper.sp(16)), + fontSize: ScreenAdaper.height(16)), ), ) ], diff --git a/lib/screens/inventory_inout/components/inventory_inout_card.dart b/lib/screens/inventory_inout/components/inventory_inout_card.dart index 95a1efc..496f66b 100644 --- a/lib/screens/inventory_inout/components/inventory_inout_card.dart +++ b/lib/screens/inventory_inout/components/inventory_inout_card.dart @@ -85,7 +85,7 @@ class InventoryInoutCard extends StatelessWidget { // icon: Icon( // Icons.more_vert_rounded, // color: Colors.grey, - // size: ScreenAdaper.sp(24), + // size: ScreenAdaper.height(24), // ), // shape: OutlineInputBorder( // borderRadius: @@ -102,7 +102,7 @@ class InventoryInoutCard extends StatelessWidget { // Icon( // Icons.edit_note, // color: Colors.orange, - // size: ScreenAdaper.sp(14), + // size: ScreenAdaper.height(14), // ), // SizedBox( // width: @@ -120,7 +120,7 @@ class InventoryInoutCard extends StatelessWidget { // Icon( // Icons.delete_outline, // color: Colors.orange, - // size: ScreenAdaper.sp(14), + // size: ScreenAdaper.height(14), // ), // SizedBox( // width: @@ -138,7 +138,7 @@ class InventoryInoutCard extends StatelessWidget { // Icon( // Icons.done_all_outlined, // color: Colors.orange, - // size: ScreenAdaper.sp(14), + // size: ScreenAdaper.height(14), // ), // SizedBox( // width: @@ -173,7 +173,7 @@ class InventoryInoutCard extends StatelessWidget { style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold, - fontSize: ScreenAdaper.sp(25)), + fontSize: ScreenAdaper.height(25)), )), buildInOrOut() ], @@ -183,7 +183,7 @@ class InventoryInoutCard extends StatelessWidget { style: TextStyle( color: AppTheme.grey, fontWeight: FontWeight.bold, - fontSize: ScreenAdaper.sp(20)), + fontSize: ScreenAdaper.height(20)), ), SizedBox( height: ScreenAdaper.height(5), @@ -194,7 +194,8 @@ class InventoryInoutCard extends StatelessWidget { child: Text( '项目: ${controller.list[ind][index].project?.name}', style: TextStyle( - fontWeight: FontWeight.w600, fontSize: ScreenAdaper.sp(20)), + fontWeight: FontWeight.w600, + fontSize: ScreenAdaper.height(20)), ), ), ], @@ -208,13 +209,15 @@ class InventoryInoutCard extends StatelessWidget { child: Text( '数量: ${controller.list[ind][index].quantity} ${controller.list[ind][index].product?.unit?.label ?? '-'}', style: TextStyle( - fontWeight: FontWeight.w600, fontSize: ScreenAdaper.sp(20)), + fontWeight: FontWeight.w600, + fontSize: ScreenAdaper.height(25)), ), ), Text( controller.list[ind][index].agent ?? '-', style: TextStyle( - fontWeight: FontWeight.w600, fontSize: ScreenAdaper.sp(20)), + fontWeight: FontWeight.w600, + fontSize: ScreenAdaper.height(25)), ), ], ) @@ -228,10 +231,10 @@ class InventoryInoutCard extends StatelessWidget { child: ClipRRect( borderRadius: BorderRadius.circular(ScreenAdaper.sp(15)), child: FadeInCacheImage( - width: ScreenAdaper.width(100), - height: ScreenAdaper.width(100), + width: ScreenAdaper.height(100), + height: ScreenAdaper.height(100), url: controller.list[ind][index].files.isNotEmpty - ? '${GloablConfig.OSS_URL}${controller.list[ind][index].files[0]?.path}' + ? '${GloablConfig.OSS_URL}${controller.list[ind][index].files[0].path}' : ''), )); } @@ -248,7 +251,7 @@ class InventoryInoutCard extends StatelessWidget { return Container( alignment: Alignment.center, height: ScreenAdaper.height(40), - width: ScreenAdaper.width(40), + width: ScreenAdaper.height(40), decoration: BoxDecoration( shape: BoxShape.circle, gradient: LinearGradient( @@ -266,8 +269,10 @@ class InventoryInoutCard extends StatelessWidget { ]), child: Text( textInOut, - style: const TextStyle( - color: AppTheme.nearlyWhite, fontWeight: FontWeight.w600), + style: TextStyle( + fontSize: ScreenAdaper.sp(25), + color: AppTheme.nearlyWhite, + fontWeight: FontWeight.w600), ), ); } diff --git a/lib/screens/inventory_inout/components/inventory_inout_info.dart b/lib/screens/inventory_inout/components/inventory_inout_info.dart index c6618fa..23e8a4b 100644 --- a/lib/screens/inventory_inout/components/inventory_inout_info.dart +++ b/lib/screens/inventory_inout/components/inventory_inout_info.dart @@ -34,7 +34,8 @@ class InventoryInoutInfo extends StatelessWidget { Text( '出入库详情', style: TextStyle( - fontSize: ScreenAdaper.sp(25), color: AppTheme.nearlyWhite), + fontSize: ScreenAdaper.height(25), + color: AppTheme.nearlyWhite), ), ], ), @@ -160,10 +161,10 @@ class InventoryInoutInfo extends StatelessWidget { leading: Text( '${leading ?? ''}: ', style: TextStyle( - fontSize: ScreenAdaper.sp(25), fontWeight: FontWeight.w600), + fontSize: ScreenAdaper.height(25), fontWeight: FontWeight.w600), ), trailing: Text('${trailing ?? ''}', - style: TextStyle(fontSize: ScreenAdaper.sp(25)))); + style: TextStyle(fontSize: ScreenAdaper.height(25)))); } } diff --git a/lib/screens/inventory_inout/components/task_list.dart b/lib/screens/inventory_inout/components/task_list.dart index ad76e89..953a430 100644 --- a/lib/screens/inventory_inout/components/task_list.dart +++ b/lib/screens/inventory_inout/components/task_list.dart @@ -54,7 +54,7 @@ class Grid extends StatelessWidget { color: AppTheme.black, fontWeight: FontWeight.w600, letterSpacing: ScreenAdaper.width(2), - fontSize: ScreenAdaper.sp(30)), + fontSize: ScreenAdaper.height(30)), ), ) : GridView.builder( diff --git a/lib/screens/inventory_inout/components/today_button.dart b/lib/screens/inventory_inout/components/today_button.dart index c2c2847..5ccb9fe 100644 --- a/lib/screens/inventory_inout/components/today_button.dart +++ b/lib/screens/inventory_inout/components/today_button.dart @@ -31,9 +31,10 @@ class TodayButton extends StatelessWidget { colors: [AppTheme.primaryColorLight, AppTheme.primaryColor])), child: Text( TextEnum.backToTodayButtonText, + // '${ScreenAdaper.screenShortDistance()}', style: TextStyle( color: Colors.white, - fontSize: ScreenAdaper.sp(25), + fontSize: ScreenAdaper.height(25), fontWeight: FontWeight.bold, ), ), diff --git a/lib/screens/inventory_inout/components/upper_body.dart b/lib/screens/inventory_inout/components/upper_body.dart index 68da619..31d1ace 100644 --- a/lib/screens/inventory_inout/components/upper_body.dart +++ b/lib/screens/inventory_inout/components/upper_body.dart @@ -14,9 +14,6 @@ class UperBody extends StatelessWidget { Widget build(BuildContext context) { return Column( children: [ - const SizedBox( - height: defaultPadding, - ), CustomAppBar(), SizedBox( height: ScreenAdaper.height(150), diff --git a/lib/screens/inventory_inout/inventory_inout_controller.dart b/lib/screens/inventory_inout/inventory_inout_controller.dart index 6b6a419..3468c8a 100644 --- a/lib/screens/inventory_inout/inventory_inout_controller.dart +++ b/lib/screens/inventory_inout/inventory_inout_controller.dart @@ -43,6 +43,7 @@ class InventoryInoutController extends GetxController { /// 出库还是入库picker Future showInOrOutPickerDialog() async { + final moveDis = ScreenAdaper.screenShortDistance() / 10; showDialog( context: Get.overlayContext!, builder: (_) => Align( @@ -62,7 +63,7 @@ class InventoryInoutController extends GetxController { children: [ AnimatedPositioned( duration: const Duration(milliseconds: 100), - left: value * 80, + left: value * moveDis, child: ClipRRect( borderRadius: const BorderRadius.all(Radius.circular(30)), @@ -96,8 +97,9 @@ class InventoryInoutController extends GetxController { EdgeInsets.zero), ), child: Container( - height: ScreenAdaper.height(350), - width: ScreenAdaper.height(350), + height: + ScreenAdaper.screenShortDistance() / 3, + width: ScreenAdaper.screenShortDistance() / 3, alignment: Alignment.center, child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -105,7 +107,7 @@ class InventoryInoutController extends GetxController { Icon( Icons.add_circle_outline, color: AppTheme.nearlyWhite, - size: ScreenAdaper.sp(80), + size: ScreenAdaper.height(80), ), SizedBox( height: ScreenAdaper.height(10), @@ -115,7 +117,7 @@ class InventoryInoutController extends GetxController { style: TextStyle( decoration: TextDecoration.none, color: AppTheme.nearlyWhite, - fontSize: ScreenAdaper.sp(60), + fontSize: ScreenAdaper.height(60), letterSpacing: ScreenAdaper.width(5), fontWeight: FontWeight.w700, ), @@ -130,7 +132,7 @@ class InventoryInoutController extends GetxController { ), AnimatedPositioned( duration: const Duration(milliseconds: 100), - right: value * 80, + right: value * moveDis, child: ClipRRect( borderRadius: const BorderRadius.all(Radius.circular(30)), @@ -164,8 +166,9 @@ class InventoryInoutController extends GetxController { EdgeInsets.zero), ), child: Container( - height: ScreenAdaper.height(350), - width: ScreenAdaper.height(350), + height: + ScreenAdaper.screenShortDistance() / 3, + width: ScreenAdaper.screenShortDistance() / 3, alignment: Alignment.center, child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -173,7 +176,7 @@ class InventoryInoutController extends GetxController { Icon( Icons.remove_circle_outline, color: AppTheme.nearlyWhite, - size: ScreenAdaper.sp(80), + size: ScreenAdaper.height(80), ), SizedBox( height: ScreenAdaper.height(10), @@ -183,7 +186,7 @@ class InventoryInoutController extends GetxController { style: TextStyle( decoration: TextDecoration.none, color: AppTheme.nearlyWhite, - fontSize: ScreenAdaper.sp(60), + fontSize: ScreenAdaper.height(60), letterSpacing: ScreenAdaper.width(5), fontWeight: FontWeight.w700, ), @@ -205,47 +208,36 @@ class InventoryInoutController extends GetxController { /// 新建出入库dialog Future showInventoryInoutCreateDialog(int inOrOut) async { - final isTablet = Responsive.isTablet(Get.context!); - return isTablet - ? Get.generalDialog( - barrierLabel: "CreateInventoryInout", - barrierDismissible: true, - transitionDuration: const Duration(milliseconds: 400), - pageBuilder: (_, __, ___) { - return NewInventoryInout( - inOrOut: inOrOut, - ); - }, - transitionBuilder: (_, anim, __, child) { - Tween tween; - tween = Tween(begin: const Offset(0, -1), end: Offset.zero); - return SlideTransition( - position: tween.animate( - CurvedAnimation(parent: anim, curve: Curves.easeInOut), - ), - child: child, - ); - }, - ).then((value) { - if (value != null) { - getData(); - } - }) - : showModalBottomSheet( - elevation: 0, - isScrollControlled: true, - backgroundColor: Colors.white, - context: Get.overlayContext!, - builder: (context) { - return NewInventoryInout(inOrOut: inOrOut); - }, - ); + return Get.generalDialog( + barrierLabel: "CreateInventoryInout", + barrierDismissible: true, + transitionDuration: const Duration(milliseconds: 400), + pageBuilder: (_, __, ___) { + return NewInventoryInout( + inOrOut: inOrOut, + ); + }, + transitionBuilder: (_, anim, __, child) { + Tween tween; + tween = Tween(begin: const Offset(0, -1), end: Offset.zero); + return SlideTransition( + position: tween.animate( + CurvedAnimation(parent: anim, curve: Curves.easeInOut), + ), + child: child, + ); + }, + ).then((value) { + if (value != null) { + getData(); + } + }); } // 出入库详情dialog Future showInventoryInoutInfoDialog(int id) async { ModalUtil.showGeneralDialog( - width: ScreenAdaper.width(Get.width - 100), + width: ScreenAdaper.screenShortDistance() - ScreenAdaper.width(100), height: ScreenAdaper.height(Get.height - 100), content: InventoryInoutInfo(inventoryInoutId: id), offset: const Offset(0, -1)) diff --git a/lib/screens/landing/landing.dart b/lib/screens/landing/landing.dart index 1a5f223..ffe270d 100644 --- a/lib/screens/landing/landing.dart +++ b/lib/screens/landing/landing.dart @@ -17,7 +17,7 @@ class LandingPage extends StatelessWidget { child: Stack(children: [ const BackColors(), SafeArea( - top: false, + top: true, child: Obx(() => Scaffold( floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, diff --git a/lib/screens/login/login copy.dart b/lib/screens/login/login copy.dart index 4a88c23..6bd59cb 100644 --- a/lib/screens/login/login copy.dart +++ b/lib/screens/login/login copy.dart @@ -55,7 +55,7 @@ class LoginScreen extends StatelessWidget { fontWeight: FontWeight.w700, color: AppTheme.nearlyWhite, letterSpacing: ScreenAdaper.sp(5), - fontSize: ScreenAdaper.sp(70)), + fontSize: ScreenAdaper.height(70)), ) ], ), @@ -114,7 +114,7 @@ class LoginScreen extends StatelessWidget { textStyle: TextStyle( letterSpacing: 5, fontWeight: FontWeight.bold, - fontSize: ScreenAdaper.sp(25)), + fontSize: ScreenAdaper.height(25)), backgroundColor: AppTheme.primaryColor), onPressed: _controller.doLogin, child: const Text('登录'), @@ -135,7 +135,7 @@ class LoginScreen extends StatelessWidget { onFieldSubmitted: (value) { _controller.passwordFocusNode.requestFocus(); }, - style: TextStyle(fontSize: ScreenAdaper.sp(25)), + style: TextStyle(fontSize: ScreenAdaper.height(25)), onChanged: (value) {}, validator: (String? value) { if (value == null || value == '') { @@ -157,7 +157,7 @@ class LoginScreen extends StatelessWidget { onFieldSubmitted: (value) { _controller.doLogin(); }, - style: TextStyle(fontSize: ScreenAdaper.sp(25)), + style: TextStyle(fontSize: ScreenAdaper.height(25)), onChanged: (value) {}, validator: (String? value) { return (value ?? '').length >= 6 ? null : '密码长度至少6位'; @@ -174,7 +174,7 @@ class LoginScreen extends StatelessWidget { '忘记密码?', style: TextStyle( color: Colors.grey, - fontSize: ScreenAdaper.sp(20), + fontSize: ScreenAdaper.height(20), decoration: TextDecoration.underline, ), )), diff --git a/lib/screens/login/login.dart b/lib/screens/login/login.dart index 706acf4..39456d0 100644 --- a/lib/screens/login/login.dart +++ b/lib/screens/login/login.dart @@ -60,7 +60,7 @@ class LoginScreen extends StatelessWidget { ), ], letterSpacing: ScreenAdaper.width(5), - fontSize: ScreenAdaper.sp(70), + fontSize: ScreenAdaper.height(70), fontWeight: FontWeight.bold, foreground: Paint() ..style = PaintingStyle.stroke @@ -73,7 +73,7 @@ class LoginScreen extends StatelessWidget { fontWeight: FontWeight.w700, color: AppTheme.nearlyWhite.withOpacity(0.9), letterSpacing: ScreenAdaper.sp(5), - fontSize: ScreenAdaper.sp(70)), + fontSize: ScreenAdaper.height(70)), ), ], ) @@ -141,7 +141,7 @@ class LoginScreen extends StatelessWidget { textStyle: TextStyle( letterSpacing: 5, fontWeight: FontWeight.bold, - fontSize: ScreenAdaper.sp(25)), + fontSize: ScreenAdaper.height(25)), backgroundColor: AppTheme.primaryColor), onPressed: _controller.doLogin, child: const Text('登录'), @@ -178,20 +178,21 @@ class LoginScreen extends StatelessWidget { decoration: InputDecoration( prefixIcon: Icon( Icons.person_2_outlined, - size: ScreenAdaper.sp(40), + size: ScreenAdaper.height(40), ), - errorStyle: TextStyle(fontSize: ScreenAdaper.sp(20)), - contentPadding: EdgeInsets.symmetric( - horizontal: ScreenAdaper.width(30), - vertical: ScreenAdaper.height(10)), + errorStyle: TextStyle(fontSize: ScreenAdaper.height(20)), + // contentPadding: EdgeInsets.symmetric( + // horizontal: ScreenAdaper.width(30), + // vertical: ScreenAdaper.height(10)), hintText: '用户名', + hintStyle: TextStyle(fontSize: ScreenAdaper.height(25)), border: InputBorder.none, focusedBorder: InputBorder.none), onFieldSubmitted: (value) { _controller.passwordFocusNode.requestFocus(); }, autovalidateMode: AutovalidateMode.onUserInteraction, - style: TextStyle(fontSize: ScreenAdaper.sp(25)), + style: TextStyle(fontSize: ScreenAdaper.height(25)), onChanged: (value) { _controller.username = value; }, @@ -204,9 +205,9 @@ class LoginScreen extends StatelessWidget { decoration: InputDecoration( prefixIcon: Icon( Icons.lock_outlined, - size: ScreenAdaper.sp(40), + size: ScreenAdaper.height(40), ), - errorStyle: TextStyle(fontSize: ScreenAdaper.sp(20)), + errorStyle: TextStyle(fontSize: ScreenAdaper.height(20)), contentPadding: EdgeInsets.symmetric( horizontal: ScreenAdaper.width(30), vertical: ScreenAdaper.height(10)), @@ -218,7 +219,7 @@ class LoginScreen extends StatelessWidget { onFieldSubmitted: (value) { _controller.doLogin(); }, - style: TextStyle(fontSize: ScreenAdaper.sp(25)), + style: TextStyle(fontSize: ScreenAdaper.height(25)), onChanged: (value) { _controller.password = value; }, @@ -236,7 +237,7 @@ class LoginScreen extends StatelessWidget { '忘记密码?', style: TextStyle( color: Colors.grey, - fontSize: ScreenAdaper.sp(20), + fontSize: ScreenAdaper.height(20), decoration: TextDecoration.underline, ), )), diff --git a/lib/screens/mine/mine.dart b/lib/screens/mine/mine.dart index 525a1b6..23392f4 100644 --- a/lib/screens/mine/mine.dart +++ b/lib/screens/mine/mine.dart @@ -77,7 +77,7 @@ class _MinePageState extends State AuthStore.to.userInfo.value.nickname ?? '', style: TextStyle( letterSpacing: ScreenAdaper.width(5), - fontSize: ScreenAdaper.sp(30), + fontSize: ScreenAdaper.height(30), fontWeight: FontWeight.bold, foreground: Paint() ..style = PaintingStyle.stroke @@ -89,7 +89,7 @@ class _MinePageState extends State style: TextStyle( letterSpacing: ScreenAdaper.width(5), color: Colors.white, - fontSize: ScreenAdaper.sp(30), + fontSize: ScreenAdaper.height(30), fontWeight: FontWeight.bold), ), ], diff --git a/lib/screens/mine/settings/mine_settings.dart b/lib/screens/mine/settings/mine_settings.dart index ae93f31..a3d9911 100644 --- a/lib/screens/mine/settings/mine_settings.dart +++ b/lib/screens/mine/settings/mine_settings.dart @@ -39,7 +39,7 @@ class MineSettingsPage extends StatelessWidget { Text( '退出登录', style: TextStyle( - fontSize: ScreenAdaper.sp(20), + fontSize: ScreenAdaper.height(20), fontWeight: FontWeight.w600), ), ], @@ -65,7 +65,7 @@ class MineSettingsPage extends StatelessWidget { // children: [ // Text( // 'Delete acount', - // style: TextStyle(fontSize: ScreenAdaper.sp(18)), + // style: TextStyle(fontSize: ScreenAdaper.height(18)), // ), // ], // ))); diff --git a/lib/screens/mine/useinfo/userinfo.dart b/lib/screens/mine/useinfo/userinfo.dart index 356b7ff..7ac85a3 100644 --- a/lib/screens/mine/useinfo/userinfo.dart +++ b/lib/screens/mine/useinfo/userinfo.dart @@ -28,7 +28,7 @@ class UserInfoPage extends StatelessWidget { 'Save', style: TextStyle( color: const Color(0xFFB0F320), - fontSize: ScreenAdaper.sp(18)), + fontSize: ScreenAdaper.height(18)), )), SizedBox( width: ScreenAdaper.width(5), @@ -51,14 +51,15 @@ class UserInfoPage extends StatelessWidget { TextFormField( controller: _controller.nickNameController, cursorColor: const Color.fromARGB(255, 87, 86, 86), - style: TextStyle(fontSize: ScreenAdaper.sp(18), color: Colors.black), + style: + TextStyle(fontSize: ScreenAdaper.height(18), color: Colors.black), decoration: InputDecoration( contentPadding: EdgeInsets.fromLTRB( ScreenAdaper.width(12), 0, ScreenAdaper.width(12), 0), labelText: "Nick Name", labelStyle: TextStyle( color: const Color.fromARGB(255, 136, 136, 136), - fontSize: ScreenAdaper.sp(18)), + fontSize: ScreenAdaper.height(18)), enabledBorder: const UnderlineInputBorder( borderSide: BorderSide( color: Color.fromARGB(153, 191, 190, 190), @@ -82,7 +83,7 @@ class UserInfoPage extends StatelessWidget { // labelText: "Date of birth", // labelStyle: TextStyle( // color: const Color.fromARGB(255, 136, 136, 136), - // fontSize: ScreenAdaper.sp(18)), + // fontSize: ScreenAdaper.height(18)), // enabledBorder: const UnderlineInputBorder( // borderSide: BorderSide( // color: Color.fromARGB(153, 191, 190, 190), @@ -124,7 +125,7 @@ class UserInfoPage extends StatelessWidget { // )); // }, // style: - // TextStyle(fontSize: ScreenAdaper.sp(18), color: Colors.black), + // TextStyle(fontSize: ScreenAdaper.height(18), color: Colors.black), // cursorColor: const Color.fromARGB(255, 87, 86, 86)), SizedBox( height: ScreenAdaper.height(15), @@ -137,7 +138,7 @@ class UserInfoPage extends StatelessWidget { // labelText: "Country", // labelStyle: TextStyle( // color: const Color.fromARGB(255, 136, 136, 136), - // fontSize: ScreenAdaper.sp(18)), + // fontSize: ScreenAdaper.height(18)), // enabledBorder: const UnderlineInputBorder( // borderSide: BorderSide( // color: Color.fromARGB(153, 191, 190, 190), @@ -168,14 +169,14 @@ class UserInfoPage extends StatelessWidget { // child: Text( // e, // style: TextStyle( - // fontSize: ScreenAdaper.sp(30)), + // fontSize: ScreenAdaper.height(30)), // ), // )) // .toList(), // ))); // }, // style: - // TextStyle(fontSize: ScreenAdaper.sp(18), color: Colors.black), + // TextStyle(fontSize: ScreenAdaper.height(18), color: Colors.black), // cursorColor: const Color.fromARGB(255, 87, 86, 86)) ], ); diff --git a/lib/screens/new_inventory_inout/components/agent_search.dart b/lib/screens/new_inventory_inout/components/agent_search.dart index b90ff40..0d88886 100644 --- a/lib/screens/new_inventory_inout/components/agent_search.dart +++ b/lib/screens/new_inventory_inout/components/agent_search.dart @@ -20,7 +20,7 @@ class AgentSearch extends StatelessWidget { AgentSearch({super.key, this.onSelected, this.beforeSelectedCheck}); final controller = Get.put(AgentSearchController()); final listTitleTextStyle = - TextStyle(fontSize: ScreenAdaper.sp(20), fontWeight: FontWeight.w600); + TextStyle(fontSize: ScreenAdaper.height(20), fontWeight: FontWeight.w600); @override Widget build(BuildContext context) { return Container( @@ -79,7 +79,7 @@ class AgentSearch extends StatelessWidget { } Widget buildList() { - final textStyle = TextStyle(fontSize: ScreenAdaper.sp(22)); + final textStyle = TextStyle(fontSize: ScreenAdaper.height(22)); return Obx(() => SmartRefresher( enablePullDown: true, enablePullUp: true, @@ -130,7 +130,7 @@ class AgentSearch extends StatelessWidget { ), Text( '${controller.list[index].nickname}', - style: TextStyle(fontSize: ScreenAdaper.sp(25)), + style: TextStyle(fontSize: ScreenAdaper.height(25)), ), if (controller.list[index].dept != null) ...[ SizedBox( diff --git a/lib/screens/new_inventory_inout/components/inventory_search.dart b/lib/screens/new_inventory_inout/components/inventory_search.dart index 912e16f..5921b43 100644 --- a/lib/screens/new_inventory_inout/components/inventory_search.dart +++ b/lib/screens/new_inventory_inout/components/inventory_search.dart @@ -19,7 +19,7 @@ class InventorySearch extends StatelessWidget { {super.key, this.onInventorySelected, this.beforeSelectedCheck}); final controller = Get.put(InventorySearchController()); final listTitleTextStyle = - TextStyle(fontSize: ScreenAdaper.sp(20), fontWeight: FontWeight.w600); + TextStyle(fontSize: ScreenAdaper.height(25), fontWeight: FontWeight.w600); @override Widget build(BuildContext context) { return Container( @@ -83,8 +83,8 @@ class InventorySearch extends StatelessWidget { Widget buildHasInventoryPicker() { return Container( - width: ScreenAdaper.width(150), - constraints: BoxConstraints(minWidth: ScreenAdaper.width(150)), + width: ScreenAdaper.width(200), + constraints: BoxConstraints(minWidth: ScreenAdaper.width(200)), child: Obx( () => DropdownButtonFormField( value: controller.hasInventoryStatus.value, @@ -118,7 +118,7 @@ class InventorySearch extends StatelessWidget { } Widget buildInventoryList() { - final textStyle = TextStyle(fontSize: ScreenAdaper.sp(22)); + final textStyle = TextStyle(fontSize: ScreenAdaper.height(25)); return Obx(() => SmartRefresher( enablePullDown: true, enablePullUp: true, @@ -132,14 +132,20 @@ class InventorySearch extends StatelessWidget { child: Empty(text: '暂无库存'), ) : Table(columnWidths: { - 0: FixedColumnWidth(100), - 1: FlexColumnWidth(2), - 2: MinColumnWidth( - FixedColumnWidth(200), FixedColumnWidth(200)), - 3: MinColumnWidth( - FixedColumnWidth(100), FixedColumnWidth(100)), - 4: MinColumnWidth( + 0: MinColumnWidth( FixedColumnWidth(80), FixedColumnWidth(80)), + 1: FlexColumnWidth(ScreenAdaper.screenShortDistance() / 4), + 2: FlexColumnWidth(ScreenAdaper.screenShortDistance() / 4), + 3: MinColumnWidth( + FixedColumnWidth( + ScreenAdaper.screenShortDistance() / 8), + FixedColumnWidth( + ScreenAdaper.screenShortDistance() / 8)), + 4: MinColumnWidth( + FixedColumnWidth( + ScreenAdaper.screenShortDistance() / 8), + FixedColumnWidth( + ScreenAdaper.screenShortDistance() / 8)), }, children: [ // table header TableRow( @@ -217,7 +223,7 @@ class InventorySearch extends StatelessWidget { Text( '${itemData.product?.company?.name}', style: TextStyle( - fontSize: ScreenAdaper.sp(15), + fontSize: ScreenAdaper.height(15), color: AppTheme.grey), ) ], diff --git a/lib/screens/new_inventory_inout/components/product_search.dart b/lib/screens/new_inventory_inout/components/product_search.dart index bb2ac82..f91886e 100644 --- a/lib/screens/new_inventory_inout/components/product_search.dart +++ b/lib/screens/new_inventory_inout/components/product_search.dart @@ -15,7 +15,7 @@ class ProductSearch extends StatelessWidget { ProductSearch({super.key, this.onProductSelected}); final controller = Get.put(ProductSearchController()); final listTitleTextStyle = - TextStyle(fontSize: ScreenAdaper.sp(20), fontWeight: FontWeight.w600); + TextStyle(fontSize: ScreenAdaper.height(20), fontWeight: FontWeight.w600); @override Widget build(BuildContext context) { return Container( @@ -121,7 +121,7 @@ class ProductSearch extends StatelessWidget { BoxConstraints(minWidth: ScreenAdaper.width(100)), child: Text( itemData.productNumber!, - style: TextStyle(fontSize: ScreenAdaper.sp(20)), + style: TextStyle(fontSize: ScreenAdaper.height(20)), ), ), SizedBox( @@ -133,12 +133,12 @@ class ProductSearch extends StatelessWidget { children: [ Text( '${itemData.name}', - style: TextStyle(fontSize: ScreenAdaper.sp(20)), + style: TextStyle(fontSize: ScreenAdaper.height(20)), ), Text( '${itemData.company?.name}', style: TextStyle( - fontSize: ScreenAdaper.sp(15), + fontSize: ScreenAdaper.height(15), color: AppTheme.grey), ) ], diff --git a/lib/screens/new_inventory_inout/new_inventory_inout.dart b/lib/screens/new_inventory_inout/new_inventory_inout.dart index a360b10..d118929 100644 --- a/lib/screens/new_inventory_inout/new_inventory_inout.dart +++ b/lib/screens/new_inventory_inout/new_inventory_inout.dart @@ -34,11 +34,10 @@ class NewInventoryInout extends StatelessWidget { return SafeArea( top: false, // 设置为false以避免保留顶部状态栏的空间 child: Scaffold( - appBar: PreferredSize( - preferredSize: Size.fromHeight(ScreenAdaper.height( - kToolbarHeight)), // 这里使用kToolbarHeight,它是不包含状态栏的AppBar的推荐高度 - child: AppBar( - title: const Text('出入库登记'), + appBar: AppBar( + title: Text( + inOrOut == InventoryInOrOutEnum.In ? '入库登记' : '出库登记', + style: TextStyle(fontSize: ScreenAdaper.height(35)), ), ), resizeToAvoidBottomInset: true, @@ -63,7 +62,51 @@ class NewInventoryInout extends StatelessWidget { Widget buildForm() { double formVerticalGap = 20.0; double formHorizontalGap = 20.0; - final children = [ + final phoneChildren = [ + buildProductPicker(), + SizedBox( + height: ScreenAdaper.height(formVerticalGap), + ), + buildProjectPicker(), + SizedBox( + height: ScreenAdaper.height(formVerticalGap), + ), + buildQuantity(), + SizedBox( + height: ScreenAdaper.height(formVerticalGap), + ), + Row( + children: [ + if (inOrOut == InventoryInOrOutEnum.In) ...[ + Expanded(flex: 1, child: buildUnitPrice()), + SizedBox( + width: ScreenAdaper.width(formHorizontalGap), + ), + Expanded(flex: 1, child: buildAmount()) + ], + ], + ), + SizedBox( + height: ScreenAdaper.height(formVerticalGap), + ), + buildDatePicker(), + SizedBox( + height: ScreenAdaper.height(formVerticalGap), + ), + buildAgent(), + SizedBox( + height: ScreenAdaper.height(formVerticalGap), + ), + if (inOrOut == InventoryInOrOutEnum.In) buildPositionBottomPicker(), + SizedBox( + height: ScreenAdaper.height(formVerticalGap), + ), + Row( + children: [Expanded(child: buildRemark())], + ), + buildImageUploadQueue() + ]; + final tabletChildren = [ Row(children: [ Expanded( flex: 3, @@ -121,11 +164,10 @@ class NewInventoryInout extends StatelessWidget { ), buildImageUploadQueue() ]; - final child = Column( mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.max, - children: children, + children: ScreenAdaper.isTablet() ? tabletChildren : phoneChildren, ); return Form( @@ -152,7 +194,7 @@ class NewInventoryInout extends StatelessWidget { horizontal: ScreenAdaper.width(20)), child: Text( '${itemData.name}', - style: TextStyle(fontSize: ScreenAdaper.sp(20)), + style: TextStyle(fontSize: ScreenAdaper.height(20)), )), suggestionsCallback: (String keyword) { return controller.getProjects(keyword: keyword); @@ -179,11 +221,11 @@ class NewInventoryInout extends StatelessWidget { Text( "*", style: TextStyle( - color: Colors.red, fontSize: ScreenAdaper.sp(30)), + color: Colors.red, fontSize: ScreenAdaper.height(30)), ), Text( '产品', - style: TextStyle(fontSize: ScreenAdaper.sp(30)), + style: TextStyle(fontSize: ScreenAdaper.height(30)), ), ]), floatingLabelBehavior: FloatingLabelBehavior.always), @@ -300,11 +342,11 @@ class NewInventoryInout extends StatelessWidget { Text( "*", style: TextStyle( - color: Colors.red, fontSize: ScreenAdaper.sp(30)), + color: Colors.red, fontSize: ScreenAdaper.height(30)), ), Text( '经办人', - style: TextStyle(fontSize: ScreenAdaper.sp(30)), + style: TextStyle(fontSize: ScreenAdaper.height(30)), ), ]), floatingLabelBehavior: FloatingLabelBehavior.always), @@ -360,8 +402,9 @@ class NewInventoryInout extends StatelessWidget { ]; return TextFormField( controller: controller.positionTextController, - decoration: const InputDecoration( - labelText: '库存位置', + decoration: InputDecoration( + label: Text('库存位置', + style: TextStyle(fontSize: ScreenAdaper.height(30))), floatingLabelBehavior: FloatingLabelBehavior.always), readOnly: true, onTap: () { @@ -405,7 +448,7 @@ class NewInventoryInout extends StatelessWidget { Text( '*产品照片', style: TextStyle( - fontSize: ScreenAdaper.sp(25), + fontSize: ScreenAdaper.height(25), color: AppTheme.secondPrimaryColor), ), SizedBox( @@ -433,7 +476,7 @@ class NewInventoryInout extends StatelessWidget { Text( '*经办人自拍', style: TextStyle( - fontSize: ScreenAdaper.sp(25), + fontSize: ScreenAdaper.height(25), color: AppTheme.secondPrimaryColor), ), SizedBox( @@ -509,7 +552,7 @@ class NewInventoryInout extends StatelessWidget { blurRadius: 3, ), ], - size: ScreenAdaper.sp(40), + size: ScreenAdaper.height(40), color: AppTheme.nearlyWhite, ), )) @@ -535,7 +578,7 @@ class NewInventoryInout extends StatelessWidget { child: Center( child: Icon( Icons.add_a_photo_rounded, - size: ScreenAdaper.sp(60), + size: ScreenAdaper.height(60), color: AppTheme.primaryColor, )))); } diff --git a/lib/screens/workbench/workbench.dart b/lib/screens/workbench/workbench.dart index d29a101..57be903 100644 --- a/lib/screens/workbench/workbench.dart +++ b/lib/screens/workbench/workbench.dart @@ -79,10 +79,10 @@ class WorkBenchPage extends StatelessWidget { colors: [AppTheme.primaryColorLight, AppTheme.primaryColor]), boxShadow: [ BoxShadow( - color: AppTheme.black.withOpacity(0.5), + color: AppTheme.black.withOpacity(0.4), offset: Offset(0, 0), - blurRadius: 5, - spreadRadius: 2) + blurRadius: 1, + spreadRadius: 1) ], ), child: Stack( @@ -96,7 +96,7 @@ class WorkBenchPage extends StatelessWidget { works[index].title, style: TextStyle( letterSpacing: ScreenAdaper.width(10), - fontSize: ScreenAdaper.sp(40), + fontSize: ScreenAdaper.height(40), fontWeight: FontWeight.bold, foreground: Paint() ..style = PaintingStyle.stroke @@ -108,7 +108,7 @@ class WorkBenchPage extends StatelessWidget { style: TextStyle( letterSpacing: ScreenAdaper.width(10), color: Colors.white, - fontSize: ScreenAdaper.sp(40), + fontSize: ScreenAdaper.height(40), fontWeight: FontWeight.bold), ), ], diff --git a/lib/util/loading_util.dart b/lib/util/loading_util.dart index 5a6acfa..8093150 100644 --- a/lib/util/loading_util.dart +++ b/lib/util/loading_util.dart @@ -36,7 +36,7 @@ class LoadingUtil extends GetxService { children: [ LoadingAnimationWidget.fourRotatingDots( color: AppTheme.primaryColor, - size: ScreenAdaper.sp(50), + size: ScreenAdaper.height(50), ), if (status != null) SizedBox(width: ScreenAdaper.width(20)), @@ -44,7 +44,7 @@ class LoadingUtil extends GetxService { Text(status, style: TextStyle( color: AppTheme.primaryColor, - fontSize: ScreenAdaper.sp(20))) + fontSize: ScreenAdaper.height(20))) ], ), ) diff --git a/lib/util/screen_adaper_util.dart b/lib/util/screen_adaper_util.dart index aa35e2a..36085b5 100644 --- a/lib/util/screen_adaper_util.dart +++ b/lib/util/screen_adaper_util.dart @@ -30,8 +30,8 @@ class ScreenAdaper { : ScreenUtil().screenHeight; } - /// 获取 计算后的屏幕宽度 - static double screenWidth() { + /// 获取 计算后屏幕最窄距离 + static double screenShortDistance() { return isLandspace() ? ScreenUtil().screenHeight : ScreenUtil().screenWidth; } @@ -48,4 +48,8 @@ class ScreenAdaper { static isLandspace() { return Get.context?.orientation == Orientation.landscape; } + + static isTablet() { + return ScreenUtil().screenWidth > 650; + } } diff --git a/lib/util/snack_bar.util.dart b/lib/util/snack_bar.util.dart index be2a37e..a9e318d 100644 --- a/lib/util/snack_bar.util.dart +++ b/lib/util/snack_bar.util.dart @@ -32,7 +32,7 @@ class SnackBarUtil { messageText: Text( '$title', style: TextStyle( - fontSize: ScreenAdaper.sp(25), color: AppTheme.nearlyWhite), + fontSize: ScreenAdaper.height(25), color: AppTheme.nearlyWhite), ), margin: EdgeInsets.symmetric( horizontal: ScreenAdaper.width(20), vertical: 0), diff --git a/lib/widgets/bottom_nav_bar.dart b/lib/widgets/bottom_nav_bar.dart index 0e824c1..0b1923c 100644 --- a/lib/widgets/bottom_nav_bar.dart +++ b/lib/widgets/bottom_nav_bar.dart @@ -36,13 +36,14 @@ class BottomNavBar extends StatelessWidget { children: [ Icon( controller.bottomNavItems![index].icon, - size: ScreenAdaper.sp(40), + size: ScreenAdaper.height(40), color: color, ), AutoSizeText( controller.bottomNavItems![index].label ?? '', maxLines: 1, - style: TextStyle(color: color, fontSize: ScreenAdaper.sp(20)), + style: + TextStyle(color: color, fontSize: ScreenAdaper.height(20)), group: autoSizeGroup, ), ], @@ -53,7 +54,7 @@ class BottomNavBar extends StatelessWidget { } } // BottomNavigationBar( -// iconSize: ScreenAdaper.sp(40), +// iconsize: ScreenAdaper.height(40), // type: BottomNavigationBarType.fixed, // items: bottomNavItems, // showSelectedLabels: true, diff --git a/lib/widgets/core/zk_date_picker.dart b/lib/widgets/core/zk_date_picker.dart index cf7ebfa..4e6b83a 100644 --- a/lib/widgets/core/zk_date_picker.dart +++ b/lib/widgets/core/zk_date_picker.dart @@ -31,7 +31,7 @@ class ZtDatePicker extends StatelessWidget { floatingLabelBehavior: FloatingLabelBehavior.always, prefixIcon: Icon( Icons.date_range_outlined, - size: ScreenAdaper.sp(40), + size: ScreenAdaper.height(40), ), suffixIcon: textController.text.isNotEmpty ? IconButton( @@ -54,11 +54,11 @@ class ZtDatePicker extends StatelessWidget { Text( "*", style: TextStyle( - color: Colors.red, fontSize: ScreenAdaper.sp(30)), + color: Colors.red, fontSize: ScreenAdaper.height(30)), ), Text( labelText, - style: TextStyle(fontSize: ScreenAdaper.sp(30)), + style: TextStyle(fontSize: ScreenAdaper.height(30)), ), ])), keyboardType: TextInputType.none, diff --git a/lib/widgets/core/zt_base_date_picker copy.dart b/lib/widgets/core/zt_base_date_picker copy.dart index a81ca25..a60c42d 100644 --- a/lib/widgets/core/zt_base_date_picker copy.dart +++ b/lib/widgets/core/zt_base_date_picker copy.dart @@ -29,7 +29,7 @@ class ZtBaseDatePicker extends StatelessWidget { }, child: Text( '取消', - style: TextStyle(fontSize: ScreenAdaper.sp(25)), + style: TextStyle(fontSize: ScreenAdaper.height(25)), )), const Spacer(), TextButton( @@ -48,7 +48,7 @@ class ZtBaseDatePicker extends StatelessWidget { }, child: Text( '确定', - style: TextStyle(fontSize: ScreenAdaper.sp(25)), + style: TextStyle(fontSize: ScreenAdaper.height(25)), )) ], ), diff --git a/lib/widgets/core/zt_base_date_picker.dart b/lib/widgets/core/zt_base_date_picker.dart index f1cf476..47b65dd 100644 --- a/lib/widgets/core/zt_base_date_picker.dart +++ b/lib/widgets/core/zt_base_date_picker.dart @@ -35,7 +35,7 @@ class ZtBaseDatePicker extends StatelessWidget { }, child: Text( '取消', - style: TextStyle(fontSize: ScreenAdaper.sp(25)), + style: TextStyle(fontSize: ScreenAdaper.height(25)), )), const Spacer(), TextButton( @@ -54,7 +54,7 @@ class ZtBaseDatePicker extends StatelessWidget { }, child: Text( '确定', - style: TextStyle(fontSize: ScreenAdaper.sp(25)), + style: TextStyle(fontSize: ScreenAdaper.height(25)), )) ], ), diff --git a/lib/widgets/core/zt_bottomsheet_picker.dart b/lib/widgets/core/zt_bottomsheet_picker.dart index 0e620b9..c774132 100644 --- a/lib/widgets/core/zt_bottomsheet_picker.dart +++ b/lib/widgets/core/zt_bottomsheet_picker.dart @@ -43,7 +43,7 @@ class ZtBottomSheetPicker extends StatelessWidget { }, child: Text( '取消', - style: TextStyle(fontSize: ScreenAdaper.sp(25)), + style: TextStyle(fontSize: ScreenAdaper.height(25)), )), Expanded( child: Center( @@ -51,7 +51,7 @@ class ZtBottomSheetPicker extends StatelessWidget { title, style: TextStyle( color: AppTheme.nearlyBlack, - fontSize: ScreenAdaper.sp(25), + fontSize: ScreenAdaper.height(25), decoration: TextDecoration.none), ), )), @@ -70,7 +70,7 @@ class ZtBottomSheetPicker extends StatelessWidget { }, child: Text( '确定', - style: TextStyle(fontSize: ScreenAdaper.sp(25)), + style: TextStyle(fontSize: ScreenAdaper.height(25)), )) ], ), diff --git a/lib/widgets/core/zt_number_input.dart b/lib/widgets/core/zt_number_input.dart index c086021..deb3788 100644 --- a/lib/widgets/core/zt_number_input.dart +++ b/lib/widgets/core/zt_number_input.dart @@ -48,11 +48,11 @@ class ZtNumberInput extends StatelessWidget { Text( "*", style: TextStyle( - color: Colors.red, fontSize: ScreenAdaper.sp(30)), + color: Colors.red, fontSize: ScreenAdaper.height(30)), ), Text( labelText, - style: TextStyle(fontSize: ScreenAdaper.sp(30)), + style: TextStyle(fontSize: ScreenAdaper.height(30)), ), ]), focusedBorder: OutlineInputBorder( diff --git a/lib/widgets/core/zt_search_select.dart b/lib/widgets/core/zt_search_select.dart index 61a6b14..e372aa8 100644 --- a/lib/widgets/core/zt_search_select.dart +++ b/lib/widgets/core/zt_search_select.dart @@ -74,11 +74,11 @@ class ZtSearchSelect extends StatelessWidget { "*", style: TextStyle( color: Colors.red, - fontSize: ScreenAdaper.sp(30)), + fontSize: ScreenAdaper.height(30)), ), Text( labelText, - style: TextStyle(fontSize: ScreenAdaper.sp(30)), + style: TextStyle(fontSize: ScreenAdaper.height(30)), ), ]))); }, @@ -88,7 +88,7 @@ class ZtSearchSelect extends StatelessWidget { height: ScreenAdaper.height(50), child: Text( '未找到记录', - style: TextStyle(fontSize: ScreenAdaper.sp(20)), + style: TextStyle(fontSize: ScreenAdaper.height(20)), ), ), itemBuilder: (context, itemData) { diff --git a/lib/widgets/core/zt_text_input.dart b/lib/widgets/core/zt_text_input.dart index dcd38ba..03625e1 100644 --- a/lib/widgets/core/zt_text_input.dart +++ b/lib/widgets/core/zt_text_input.dart @@ -40,11 +40,11 @@ class ZtTextInput extends StatelessWidget { Text( "*", style: TextStyle( - color: Colors.red, fontSize: ScreenAdaper.sp(30)), + color: Colors.red, fontSize: ScreenAdaper.height(30)), ), Text( labelText, - style: TextStyle(fontSize: ScreenAdaper.sp(30)), + style: TextStyle(fontSize: ScreenAdaper.height(30)), ), ]), focusedBorder: OutlineInputBorder( diff --git a/lib/widgets/empty.dart b/lib/widgets/empty.dart index 00d1848..e8a2d85 100644 --- a/lib/widgets/empty.dart +++ b/lib/widgets/empty.dart @@ -17,7 +17,7 @@ class Empty extends StatelessWidget { Text( text ?? '', textAlign: TextAlign.center, - style: TextStyle(fontSize: ScreenAdaper.sp(30)), + style: TextStyle(fontSize: ScreenAdaper.height(30)), ), ]), ); diff --git a/lib/widgets/fade_in_cache_image.dart b/lib/widgets/fade_in_cache_image.dart index d648701..e69e7a6 100644 --- a/lib/widgets/fade_in_cache_image.dart +++ b/lib/widgets/fade_in_cache_image.dart @@ -75,7 +75,7 @@ class _FadeInCacheImageState extends State { width: widget.width, height: widget.height, child: Icon(Icons.image_not_supported, - size: ScreenAdaper.sp((widget.width ?? 200) * 3 / 4), + size: ScreenAdaper.height((widget.width ?? 200) * 3 / 4), color: AppTheme.grey), ); } diff --git a/lib/widgets/floating_action.dart b/lib/widgets/floating_action.dart index 3cef6d1..0b2f36b 100644 --- a/lib/widgets/floating_action.dart +++ b/lib/widgets/floating_action.dart @@ -22,7 +22,7 @@ class FloatingCreateButton extends StatelessWidget { child: Icon( Icons.add, color: Colors.white, - size: ScreenAdaper.sp(70), + size: ScreenAdaper.height(70), ), ), ); diff --git a/lib/widgets/gradient_button.dart b/lib/widgets/gradient_button.dart index a41ab56..1077c33 100644 --- a/lib/widgets/gradient_button.dart +++ b/lib/widgets/gradient_button.dart @@ -36,14 +36,14 @@ class GradientButton extends StatelessWidget { child: isLoading ? LoadingAnimationWidget.fourRotatingDots( color: AppTheme.nearlyWhite, - size: ScreenAdaper.sp(40), + size: ScreenAdaper.height(40), ) : Text( buttonText, style: TextStyle( color: AppTheme.nearlyWhite, fontWeight: FontWeight.bold, - fontSize: ScreenAdaper.sp(25), + fontSize: ScreenAdaper.height(25), ), ), ), diff --git a/lib/widgets/image_preview.dart b/lib/widgets/image_preview.dart index 0c7ae2e..b4b2219 100644 --- a/lib/widgets/image_preview.dart +++ b/lib/widgets/image_preview.dart @@ -61,7 +61,7 @@ class _ImagePreivewState extends State { style: TextStyle( decoration: TextDecoration.none, color: Colors.white, - fontSize: ScreenAdaper.sp(20), + fontSize: ScreenAdaper.height(20), ), ), ), @@ -84,7 +84,7 @@ class _ImagePreivewState extends State { icon: Icon( Icons.download_for_offline_sharp, color: AppTheme.nearlyWhite, - size: ScreenAdaper.sp(50), + size: ScreenAdaper.height(50), ), )) ], diff --git a/lib/widgets/loading_indicator.dart b/lib/widgets/loading_indicator.dart index 2fdcf53..c854792 100644 --- a/lib/widgets/loading_indicator.dart +++ b/lib/widgets/loading_indicator.dart @@ -13,7 +13,7 @@ class LoadingIndicator extends StatelessWidget { Widget build(BuildContext context) { return common ? LoadingAnimationWidget.fourRotatingDots( - color: AppTheme.primaryColorLight, size: ScreenAdaper.sp(45)) + color: AppTheme.primaryColorLight, size: ScreenAdaper.height(45)) : CupertinoActivityIndicator( animating: animating, color: AppTheme.primaryColor, diff --git a/lib/widgets/refresh_footer.dart b/lib/widgets/refresh_footer.dart index 92d6b85..068c8e4 100644 --- a/lib/widgets/refresh_footer.dart +++ b/lib/widgets/refresh_footer.dart @@ -30,7 +30,7 @@ class _RefreshFooterState extends State } Widget buildBody() { - TextStyle style = TextStyle(fontSize: ScreenAdaper.sp(18)); + TextStyle style = TextStyle(fontSize: ScreenAdaper.height(18)); return CustomFooter( builder: (BuildContext context, LoadStatus? status) { Widget body; diff --git a/lib/widgets/refresh_header.dart b/lib/widgets/refresh_header.dart index 95864a2..7db652f 100644 --- a/lib/widgets/refresh_header.dart +++ b/lib/widgets/refresh_header.dart @@ -39,7 +39,7 @@ class RefreshHeaderState extends RefreshIndicatorState @override Widget buildContent(BuildContext context, RefreshStatus mode) { - TextStyle style = TextStyle(fontSize: ScreenAdaper.sp(18)); + TextStyle style = TextStyle(fontSize: ScreenAdaper.height(18)); Widget body; if (mode == RefreshStatus.refreshing) { body = const LoadingIndicator();