feat: 适配相关

This commit is contained in:
louis 2024-03-28 17:18:46 +08:00
parent 8d699dee2f
commit 4c13315bb2
41 changed files with 250 additions and 197 deletions

View File

@ -83,8 +83,8 @@ final theme = ThemeData(
scaffoldBackgroundColor: AppTheme.nearlyWhite, scaffoldBackgroundColor: AppTheme.nearlyWhite,
bottomNavigationBarTheme: BottomNavigationBarThemeData( bottomNavigationBarTheme: BottomNavigationBarThemeData(
backgroundColor: AppTheme.nearlyWhite, backgroundColor: AppTheme.nearlyWhite,
unselectedLabelStyle: TextStyle(fontSize: ScreenAdaper.sp(20)), unselectedLabelStyle: TextStyle(fontSize: ScreenAdaper.height(20)),
selectedLabelStyle: TextStyle(fontSize: ScreenAdaper.sp(20)), selectedLabelStyle: TextStyle(fontSize: ScreenAdaper.height(20)),
selectedItemColor: AppTheme.primaryColor), selectedItemColor: AppTheme.primaryColor),
tabBarTheme: const TabBarTheme( tabBarTheme: const TabBarTheme(
indicator: BoxDecoration( indicator: BoxDecoration(
@ -97,16 +97,16 @@ final theme = ThemeData(
backgroundColor: AppTheme.primaryColor, backgroundColor: AppTheme.primaryColor,
titleTextStyle: TextStyle( titleTextStyle: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: ScreenAdaper.sp(30), fontSize: ScreenAdaper.height(30),
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
inputDecorationTheme: InputDecorationTheme( inputDecorationTheme: InputDecorationTheme(
floatingLabelStyle: TextStyle( floatingLabelStyle: TextStyle(
color: AppTheme.primaryColor, color: AppTheme.primaryColor,
fontSize: ScreenAdaper.sp(30), fontSize: ScreenAdaper.height(30),
), ),
labelStyle: TextStyle( labelStyle: TextStyle(
fontSize: ScreenAdaper.sp(25), fontSize: ScreenAdaper.height(25),
), ),
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: BorderRadius.circular(ScreenAdaper.sp(15))), borderRadius: BorderRadius.circular(ScreenAdaper.sp(15))),

View File

@ -1,10 +1,11 @@
/// Global config /// Global config
class GloablConfig { class GloablConfig {
// static const BASE_URL = "http://10.0.2.2:7001/api/"; // static const BASE_URL = "http://10.0.2.2:8001/api/";
// static const BASE_URL = "http://144.123.43.138:3001/api/"; // static const OSS_URL = "http://10.0.2.2:8001";
// static const OSS_URL = "http://144.123.43.138:3001"; static const BASE_URL = "http://144.123.43.138:3001/api/";
static const BASE_URL = "http://192.168.60.220:8001/api/"; static const OSS_URL = "http://144.123.43.138:3001";
static const OSS_URL = "http://192.168.60.220:8001"; // 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 DOMAIN_NAME = "山矿通";
static const DEBUG = true; static const DEBUG = true;
static const PRIVACY_POLICY = 'http://h5.heeru.xyz/privacyPolicy.html'; static const PRIVACY_POLICY = 'http://h5.heeru.xyz/privacyPolicy.html';

View File

@ -26,7 +26,7 @@ class ChangeButtonRow extends StatelessWidget {
icon: Icon( icon: Icon(
Icons.arrow_back_ios_rounded, Icons.arrow_back_ios_rounded,
color: Colors.white, color: Colors.white,
size: ScreenAdaper.sp(30), size: ScreenAdaper.height(30),
)), )),
)), )),
const SizedBox( const SizedBox(
@ -38,7 +38,7 @@ class ChangeButtonRow extends StatelessWidget {
icon: Icon( icon: Icon(
Icons.arrow_forward_ios_rounded, Icons.arrow_forward_ios_rounded,
color: Colors.white, color: Colors.white,
size: ScreenAdaper.sp(30), size: ScreenAdaper.height(30),
))), ))),
], ],
), ),

View File

@ -28,7 +28,7 @@ class CustomAppBar extends StatelessWidget {
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
height: 0, height: 0,
letterSpacing: 2, letterSpacing: 2,
fontSize: ScreenAdaper.sp(25)), fontSize: ScreenAdaper.height(25)),
), ),
Obx( Obx(
() => Text( () => Text(
@ -38,7 +38,7 @@ class CustomAppBar extends StatelessWidget {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
letterSpacing: 2, letterSpacing: 2,
height: 0, height: 0,
fontSize: ScreenAdaper.sp(30)), fontSize: ScreenAdaper.height(30)),
), ),
) )
], ],
@ -71,7 +71,7 @@ class CustomAppBar extends StatelessWidget {
}, },
child: Container( child: Container(
height: ScreenAdaper.height(70), height: ScreenAdaper.height(70),
width: ScreenAdaper.width(70), width: ScreenAdaper.height(70),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
color: AppTheme.primaryColorLight, color: AppTheme.primaryColorLight,
@ -87,7 +87,7 @@ class CustomAppBar extends StatelessWidget {
]), ]),
child: Icon( child: Icon(
Icons.calendar_month_outlined, Icons.calendar_month_outlined,
size: ScreenAdaper.sp(40), size: ScreenAdaper.height(40),
color: Colors.white, color: Colors.white,
), ),
), ),

View File

@ -21,7 +21,7 @@ class Dates extends StatelessWidget {
? Colors.white ? Colors.white
: Colors.black, : Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: ScreenAdaper.sp(18), fontSize: ScreenAdaper.height(18),
height: 0), height: 0),
), ),
), ),
@ -34,7 +34,7 @@ class Dates extends StatelessWidget {
? Colors.white ? Colors.white
: Colors.black, : Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: ScreenAdaper.sp(30), fontSize: ScreenAdaper.height(30),
height: 0), height: 0),
), ),
), ),
@ -47,7 +47,7 @@ class Dates extends StatelessWidget {
? Colors.white ? Colors.white
: Colors.black, : Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: ScreenAdaper.sp(16)), fontSize: ScreenAdaper.height(16)),
), ),
) )
], ],

View File

@ -85,7 +85,7 @@ class InventoryInoutCard extends StatelessWidget {
// icon: Icon( // icon: Icon(
// Icons.more_vert_rounded, // Icons.more_vert_rounded,
// color: Colors.grey, // color: Colors.grey,
// size: ScreenAdaper.sp(24), // size: ScreenAdaper.height(24),
// ), // ),
// shape: OutlineInputBorder( // shape: OutlineInputBorder(
// borderRadius: // borderRadius:
@ -102,7 +102,7 @@ class InventoryInoutCard extends StatelessWidget {
// Icon( // Icon(
// Icons.edit_note, // Icons.edit_note,
// color: Colors.orange, // color: Colors.orange,
// size: ScreenAdaper.sp(14), // size: ScreenAdaper.height(14),
// ), // ),
// SizedBox( // SizedBox(
// width: // width:
@ -120,7 +120,7 @@ class InventoryInoutCard extends StatelessWidget {
// Icon( // Icon(
// Icons.delete_outline, // Icons.delete_outline,
// color: Colors.orange, // color: Colors.orange,
// size: ScreenAdaper.sp(14), // size: ScreenAdaper.height(14),
// ), // ),
// SizedBox( // SizedBox(
// width: // width:
@ -138,7 +138,7 @@ class InventoryInoutCard extends StatelessWidget {
// Icon( // Icon(
// Icons.done_all_outlined, // Icons.done_all_outlined,
// color: Colors.orange, // color: Colors.orange,
// size: ScreenAdaper.sp(14), // size: ScreenAdaper.height(14),
// ), // ),
// SizedBox( // SizedBox(
// width: // width:
@ -173,7 +173,7 @@ class InventoryInoutCard extends StatelessWidget {
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: ScreenAdaper.sp(25)), fontSize: ScreenAdaper.height(25)),
)), )),
buildInOrOut() buildInOrOut()
], ],
@ -183,7 +183,7 @@ class InventoryInoutCard extends StatelessWidget {
style: TextStyle( style: TextStyle(
color: AppTheme.grey, color: AppTheme.grey,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: ScreenAdaper.sp(20)), fontSize: ScreenAdaper.height(20)),
), ),
SizedBox( SizedBox(
height: ScreenAdaper.height(5), height: ScreenAdaper.height(5),
@ -194,7 +194,8 @@ class InventoryInoutCard extends StatelessWidget {
child: Text( child: Text(
'项目: ${controller.list[ind][index].project?.name}', '项目: ${controller.list[ind][index].project?.name}',
style: TextStyle( 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( child: Text(
'数量: ${controller.list[ind][index].quantity} ${controller.list[ind][index].product?.unit?.label ?? '-'}', '数量: ${controller.list[ind][index].quantity} ${controller.list[ind][index].product?.unit?.label ?? '-'}',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w600, fontSize: ScreenAdaper.sp(20)), fontWeight: FontWeight.w600,
fontSize: ScreenAdaper.height(25)),
), ),
), ),
Text( Text(
controller.list[ind][index].agent ?? '-', controller.list[ind][index].agent ?? '-',
style: TextStyle( 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( child: ClipRRect(
borderRadius: BorderRadius.circular(ScreenAdaper.sp(15)), borderRadius: BorderRadius.circular(ScreenAdaper.sp(15)),
child: FadeInCacheImage( child: FadeInCacheImage(
width: ScreenAdaper.width(100), width: ScreenAdaper.height(100),
height: ScreenAdaper.width(100), height: ScreenAdaper.height(100),
url: controller.list[ind][index].files.isNotEmpty 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( return Container(
alignment: Alignment.center, alignment: Alignment.center,
height: ScreenAdaper.height(40), height: ScreenAdaper.height(40),
width: ScreenAdaper.width(40), width: ScreenAdaper.height(40),
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
gradient: LinearGradient( gradient: LinearGradient(
@ -266,8 +269,10 @@ class InventoryInoutCard extends StatelessWidget {
]), ]),
child: Text( child: Text(
textInOut, textInOut,
style: const TextStyle( style: TextStyle(
color: AppTheme.nearlyWhite, fontWeight: FontWeight.w600), fontSize: ScreenAdaper.sp(25),
color: AppTheme.nearlyWhite,
fontWeight: FontWeight.w600),
), ),
); );
} }

View File

@ -34,7 +34,8 @@ class InventoryInoutInfo extends StatelessWidget {
Text( Text(
'出入库详情', '出入库详情',
style: TextStyle( 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: Text(
'${leading ?? ''}: ', '${leading ?? ''}: ',
style: TextStyle( style: TextStyle(
fontSize: ScreenAdaper.sp(25), fontWeight: FontWeight.w600), fontSize: ScreenAdaper.height(25), fontWeight: FontWeight.w600),
), ),
trailing: Text('${trailing ?? ''}', trailing: Text('${trailing ?? ''}',
style: TextStyle(fontSize: ScreenAdaper.sp(25)))); style: TextStyle(fontSize: ScreenAdaper.height(25))));
} }
} }

View File

@ -54,7 +54,7 @@ class Grid extends StatelessWidget {
color: AppTheme.black, color: AppTheme.black,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
letterSpacing: ScreenAdaper.width(2), letterSpacing: ScreenAdaper.width(2),
fontSize: ScreenAdaper.sp(30)), fontSize: ScreenAdaper.height(30)),
), ),
) )
: GridView.builder( : GridView.builder(

View File

@ -31,9 +31,10 @@ class TodayButton extends StatelessWidget {
colors: [AppTheme.primaryColorLight, AppTheme.primaryColor])), colors: [AppTheme.primaryColorLight, AppTheme.primaryColor])),
child: Text( child: Text(
TextEnum.backToTodayButtonText, TextEnum.backToTodayButtonText,
// '${ScreenAdaper.screenShortDistance()}',
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: ScreenAdaper.sp(25), fontSize: ScreenAdaper.height(25),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),

View File

@ -14,9 +14,6 @@ class UperBody extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
children: [ children: [
const SizedBox(
height: defaultPadding,
),
CustomAppBar(), CustomAppBar(),
SizedBox( SizedBox(
height: ScreenAdaper.height(150), height: ScreenAdaper.height(150),

View File

@ -43,6 +43,7 @@ class InventoryInoutController extends GetxController {
/// picker /// picker
Future<void> showInOrOutPickerDialog() async { Future<void> showInOrOutPickerDialog() async {
final moveDis = ScreenAdaper.screenShortDistance() / 10;
showDialog( showDialog(
context: Get.overlayContext!, context: Get.overlayContext!,
builder: (_) => Align( builder: (_) => Align(
@ -62,7 +63,7 @@ class InventoryInoutController extends GetxController {
children: [ children: [
AnimatedPositioned( AnimatedPositioned(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
left: value * 80, left: value * moveDis,
child: ClipRRect( child: ClipRRect(
borderRadius: borderRadius:
const BorderRadius.all(Radius.circular(30)), const BorderRadius.all(Radius.circular(30)),
@ -96,8 +97,9 @@ class InventoryInoutController extends GetxController {
EdgeInsets.zero), EdgeInsets.zero),
), ),
child: Container( child: Container(
height: ScreenAdaper.height(350), height:
width: ScreenAdaper.height(350), ScreenAdaper.screenShortDistance() / 3,
width: ScreenAdaper.screenShortDistance() / 3,
alignment: Alignment.center, alignment: Alignment.center,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -105,7 +107,7 @@ class InventoryInoutController extends GetxController {
Icon( Icon(
Icons.add_circle_outline, Icons.add_circle_outline,
color: AppTheme.nearlyWhite, color: AppTheme.nearlyWhite,
size: ScreenAdaper.sp(80), size: ScreenAdaper.height(80),
), ),
SizedBox( SizedBox(
height: ScreenAdaper.height(10), height: ScreenAdaper.height(10),
@ -115,7 +117,7 @@ class InventoryInoutController extends GetxController {
style: TextStyle( style: TextStyle(
decoration: TextDecoration.none, decoration: TextDecoration.none,
color: AppTheme.nearlyWhite, color: AppTheme.nearlyWhite,
fontSize: ScreenAdaper.sp(60), fontSize: ScreenAdaper.height(60),
letterSpacing: ScreenAdaper.width(5), letterSpacing: ScreenAdaper.width(5),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
@ -130,7 +132,7 @@ class InventoryInoutController extends GetxController {
), ),
AnimatedPositioned( AnimatedPositioned(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
right: value * 80, right: value * moveDis,
child: ClipRRect( child: ClipRRect(
borderRadius: borderRadius:
const BorderRadius.all(Radius.circular(30)), const BorderRadius.all(Radius.circular(30)),
@ -164,8 +166,9 @@ class InventoryInoutController extends GetxController {
EdgeInsets.zero), EdgeInsets.zero),
), ),
child: Container( child: Container(
height: ScreenAdaper.height(350), height:
width: ScreenAdaper.height(350), ScreenAdaper.screenShortDistance() / 3,
width: ScreenAdaper.screenShortDistance() / 3,
alignment: Alignment.center, alignment: Alignment.center,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -173,7 +176,7 @@ class InventoryInoutController extends GetxController {
Icon( Icon(
Icons.remove_circle_outline, Icons.remove_circle_outline,
color: AppTheme.nearlyWhite, color: AppTheme.nearlyWhite,
size: ScreenAdaper.sp(80), size: ScreenAdaper.height(80),
), ),
SizedBox( SizedBox(
height: ScreenAdaper.height(10), height: ScreenAdaper.height(10),
@ -183,7 +186,7 @@ class InventoryInoutController extends GetxController {
style: TextStyle( style: TextStyle(
decoration: TextDecoration.none, decoration: TextDecoration.none,
color: AppTheme.nearlyWhite, color: AppTheme.nearlyWhite,
fontSize: ScreenAdaper.sp(60), fontSize: ScreenAdaper.height(60),
letterSpacing: ScreenAdaper.width(5), letterSpacing: ScreenAdaper.width(5),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
@ -205,9 +208,7 @@ class InventoryInoutController extends GetxController {
/// dialog /// dialog
Future showInventoryInoutCreateDialog(int inOrOut) async { Future showInventoryInoutCreateDialog(int inOrOut) async {
final isTablet = Responsive.isTablet(Get.context!); return Get.generalDialog(
return isTablet
? Get.generalDialog(
barrierLabel: "CreateInventoryInout", barrierLabel: "CreateInventoryInout",
barrierDismissible: true, barrierDismissible: true,
transitionDuration: const Duration(milliseconds: 400), transitionDuration: const Duration(milliseconds: 400),
@ -230,22 +231,13 @@ class InventoryInoutController extends GetxController {
if (value != null) { if (value != null) {
getData(); getData();
} }
}) });
: showModalBottomSheet(
elevation: 0,
isScrollControlled: true,
backgroundColor: Colors.white,
context: Get.overlayContext!,
builder: (context) {
return NewInventoryInout(inOrOut: inOrOut);
},
);
} }
// dialog // dialog
Future showInventoryInoutInfoDialog(int id) async { Future showInventoryInoutInfoDialog(int id) async {
ModalUtil.showGeneralDialog( ModalUtil.showGeneralDialog(
width: ScreenAdaper.width(Get.width - 100), width: ScreenAdaper.screenShortDistance() - ScreenAdaper.width(100),
height: ScreenAdaper.height(Get.height - 100), height: ScreenAdaper.height(Get.height - 100),
content: InventoryInoutInfo(inventoryInoutId: id), content: InventoryInoutInfo(inventoryInoutId: id),
offset: const Offset(0, -1)) offset: const Offset(0, -1))

View File

@ -17,7 +17,7 @@ class LandingPage extends StatelessWidget {
child: Stack(children: [ child: Stack(children: [
const BackColors(), const BackColors(),
SafeArea( SafeArea(
top: false, top: true,
child: Obx(() => Scaffold( child: Obx(() => Scaffold(
floatingActionButtonLocation: floatingActionButtonLocation:
FloatingActionButtonLocation.centerDocked, FloatingActionButtonLocation.centerDocked,

View File

@ -55,7 +55,7 @@ class LoginScreen extends StatelessWidget {
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: AppTheme.nearlyWhite, color: AppTheme.nearlyWhite,
letterSpacing: ScreenAdaper.sp(5), letterSpacing: ScreenAdaper.sp(5),
fontSize: ScreenAdaper.sp(70)), fontSize: ScreenAdaper.height(70)),
) )
], ],
), ),
@ -114,7 +114,7 @@ class LoginScreen extends StatelessWidget {
textStyle: TextStyle( textStyle: TextStyle(
letterSpacing: 5, letterSpacing: 5,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: ScreenAdaper.sp(25)), fontSize: ScreenAdaper.height(25)),
backgroundColor: AppTheme.primaryColor), backgroundColor: AppTheme.primaryColor),
onPressed: _controller.doLogin, onPressed: _controller.doLogin,
child: const Text('登录'), child: const Text('登录'),
@ -135,7 +135,7 @@ class LoginScreen extends StatelessWidget {
onFieldSubmitted: (value) { onFieldSubmitted: (value) {
_controller.passwordFocusNode.requestFocus(); _controller.passwordFocusNode.requestFocus();
}, },
style: TextStyle(fontSize: ScreenAdaper.sp(25)), style: TextStyle(fontSize: ScreenAdaper.height(25)),
onChanged: (value) {}, onChanged: (value) {},
validator: (String? value) { validator: (String? value) {
if (value == null || value == '') { if (value == null || value == '') {
@ -157,7 +157,7 @@ class LoginScreen extends StatelessWidget {
onFieldSubmitted: (value) { onFieldSubmitted: (value) {
_controller.doLogin(); _controller.doLogin();
}, },
style: TextStyle(fontSize: ScreenAdaper.sp(25)), style: TextStyle(fontSize: ScreenAdaper.height(25)),
onChanged: (value) {}, onChanged: (value) {},
validator: (String? value) { validator: (String? value) {
return (value ?? '').length >= 6 ? null : '密码长度至少6位'; return (value ?? '').length >= 6 ? null : '密码长度至少6位';
@ -174,7 +174,7 @@ class LoginScreen extends StatelessWidget {
'忘记密码?', '忘记密码?',
style: TextStyle( style: TextStyle(
color: Colors.grey, color: Colors.grey,
fontSize: ScreenAdaper.sp(20), fontSize: ScreenAdaper.height(20),
decoration: TextDecoration.underline, decoration: TextDecoration.underline,
), ),
)), )),

View File

@ -60,7 +60,7 @@ class LoginScreen extends StatelessWidget {
), ),
], ],
letterSpacing: ScreenAdaper.width(5), letterSpacing: ScreenAdaper.width(5),
fontSize: ScreenAdaper.sp(70), fontSize: ScreenAdaper.height(70),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
foreground: Paint() foreground: Paint()
..style = PaintingStyle.stroke ..style = PaintingStyle.stroke
@ -73,7 +73,7 @@ class LoginScreen extends StatelessWidget {
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: AppTheme.nearlyWhite.withOpacity(0.9), color: AppTheme.nearlyWhite.withOpacity(0.9),
letterSpacing: ScreenAdaper.sp(5), letterSpacing: ScreenAdaper.sp(5),
fontSize: ScreenAdaper.sp(70)), fontSize: ScreenAdaper.height(70)),
), ),
], ],
) )
@ -141,7 +141,7 @@ class LoginScreen extends StatelessWidget {
textStyle: TextStyle( textStyle: TextStyle(
letterSpacing: 5, letterSpacing: 5,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: ScreenAdaper.sp(25)), fontSize: ScreenAdaper.height(25)),
backgroundColor: AppTheme.primaryColor), backgroundColor: AppTheme.primaryColor),
onPressed: _controller.doLogin, onPressed: _controller.doLogin,
child: const Text('登录'), child: const Text('登录'),
@ -178,20 +178,21 @@ class LoginScreen extends StatelessWidget {
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: Icon( prefixIcon: Icon(
Icons.person_2_outlined, Icons.person_2_outlined,
size: ScreenAdaper.sp(40), size: ScreenAdaper.height(40),
), ),
errorStyle: TextStyle(fontSize: ScreenAdaper.sp(20)), errorStyle: TextStyle(fontSize: ScreenAdaper.height(20)),
contentPadding: EdgeInsets.symmetric( // contentPadding: EdgeInsets.symmetric(
horizontal: ScreenAdaper.width(30), // horizontal: ScreenAdaper.width(30),
vertical: ScreenAdaper.height(10)), // vertical: ScreenAdaper.height(10)),
hintText: '用户名', hintText: '用户名',
hintStyle: TextStyle(fontSize: ScreenAdaper.height(25)),
border: InputBorder.none, border: InputBorder.none,
focusedBorder: InputBorder.none), focusedBorder: InputBorder.none),
onFieldSubmitted: (value) { onFieldSubmitted: (value) {
_controller.passwordFocusNode.requestFocus(); _controller.passwordFocusNode.requestFocus();
}, },
autovalidateMode: AutovalidateMode.onUserInteraction, autovalidateMode: AutovalidateMode.onUserInteraction,
style: TextStyle(fontSize: ScreenAdaper.sp(25)), style: TextStyle(fontSize: ScreenAdaper.height(25)),
onChanged: (value) { onChanged: (value) {
_controller.username = value; _controller.username = value;
}, },
@ -204,9 +205,9 @@ class LoginScreen extends StatelessWidget {
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: Icon( prefixIcon: Icon(
Icons.lock_outlined, 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( contentPadding: EdgeInsets.symmetric(
horizontal: ScreenAdaper.width(30), horizontal: ScreenAdaper.width(30),
vertical: ScreenAdaper.height(10)), vertical: ScreenAdaper.height(10)),
@ -218,7 +219,7 @@ class LoginScreen extends StatelessWidget {
onFieldSubmitted: (value) { onFieldSubmitted: (value) {
_controller.doLogin(); _controller.doLogin();
}, },
style: TextStyle(fontSize: ScreenAdaper.sp(25)), style: TextStyle(fontSize: ScreenAdaper.height(25)),
onChanged: (value) { onChanged: (value) {
_controller.password = value; _controller.password = value;
}, },
@ -236,7 +237,7 @@ class LoginScreen extends StatelessWidget {
'忘记密码?', '忘记密码?',
style: TextStyle( style: TextStyle(
color: Colors.grey, color: Colors.grey,
fontSize: ScreenAdaper.sp(20), fontSize: ScreenAdaper.height(20),
decoration: TextDecoration.underline, decoration: TextDecoration.underline,
), ),
)), )),

View File

@ -77,7 +77,7 @@ class _MinePageState extends State<MinePage>
AuthStore.to.userInfo.value.nickname ?? '', AuthStore.to.userInfo.value.nickname ?? '',
style: TextStyle( style: TextStyle(
letterSpacing: ScreenAdaper.width(5), letterSpacing: ScreenAdaper.width(5),
fontSize: ScreenAdaper.sp(30), fontSize: ScreenAdaper.height(30),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
foreground: Paint() foreground: Paint()
..style = PaintingStyle.stroke ..style = PaintingStyle.stroke
@ -89,7 +89,7 @@ class _MinePageState extends State<MinePage>
style: TextStyle( style: TextStyle(
letterSpacing: ScreenAdaper.width(5), letterSpacing: ScreenAdaper.width(5),
color: Colors.white, color: Colors.white,
fontSize: ScreenAdaper.sp(30), fontSize: ScreenAdaper.height(30),
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
], ],

View File

@ -39,7 +39,7 @@ class MineSettingsPage extends StatelessWidget {
Text( Text(
'退出登录', '退出登录',
style: TextStyle( style: TextStyle(
fontSize: ScreenAdaper.sp(20), fontSize: ScreenAdaper.height(20),
fontWeight: FontWeight.w600), fontWeight: FontWeight.w600),
), ),
], ],
@ -65,7 +65,7 @@ class MineSettingsPage extends StatelessWidget {
// children: [ // children: [
// Text( // Text(
// 'Delete acount', // 'Delete acount',
// style: TextStyle(fontSize: ScreenAdaper.sp(18)), // style: TextStyle(fontSize: ScreenAdaper.height(18)),
// ), // ),
// ], // ],
// ))); // )));

View File

@ -28,7 +28,7 @@ class UserInfoPage extends StatelessWidget {
'Save', 'Save',
style: TextStyle( style: TextStyle(
color: const Color(0xFFB0F320), color: const Color(0xFFB0F320),
fontSize: ScreenAdaper.sp(18)), fontSize: ScreenAdaper.height(18)),
)), )),
SizedBox( SizedBox(
width: ScreenAdaper.width(5), width: ScreenAdaper.width(5),
@ -51,14 +51,15 @@ class UserInfoPage extends StatelessWidget {
TextFormField( TextFormField(
controller: _controller.nickNameController, controller: _controller.nickNameController,
cursorColor: const Color.fromARGB(255, 87, 86, 86), 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( decoration: InputDecoration(
contentPadding: EdgeInsets.fromLTRB( contentPadding: EdgeInsets.fromLTRB(
ScreenAdaper.width(12), 0, ScreenAdaper.width(12), 0), ScreenAdaper.width(12), 0, ScreenAdaper.width(12), 0),
labelText: "Nick Name", labelText: "Nick Name",
labelStyle: TextStyle( labelStyle: TextStyle(
color: const Color.fromARGB(255, 136, 136, 136), color: const Color.fromARGB(255, 136, 136, 136),
fontSize: ScreenAdaper.sp(18)), fontSize: ScreenAdaper.height(18)),
enabledBorder: const UnderlineInputBorder( enabledBorder: const UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: Color.fromARGB(153, 191, 190, 190), color: Color.fromARGB(153, 191, 190, 190),
@ -82,7 +83,7 @@ class UserInfoPage extends StatelessWidget {
// labelText: "Date of birth", // labelText: "Date of birth",
// labelStyle: TextStyle( // labelStyle: TextStyle(
// color: const Color.fromARGB(255, 136, 136, 136), // color: const Color.fromARGB(255, 136, 136, 136),
// fontSize: ScreenAdaper.sp(18)), // fontSize: ScreenAdaper.height(18)),
// enabledBorder: const UnderlineInputBorder( // enabledBorder: const UnderlineInputBorder(
// borderSide: BorderSide( // borderSide: BorderSide(
// color: Color.fromARGB(153, 191, 190, 190), // color: Color.fromARGB(153, 191, 190, 190),
@ -124,7 +125,7 @@ class UserInfoPage extends StatelessWidget {
// )); // ));
// }, // },
// style: // 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)), // cursorColor: const Color.fromARGB(255, 87, 86, 86)),
SizedBox( SizedBox(
height: ScreenAdaper.height(15), height: ScreenAdaper.height(15),
@ -137,7 +138,7 @@ class UserInfoPage extends StatelessWidget {
// labelText: "Country", // labelText: "Country",
// labelStyle: TextStyle( // labelStyle: TextStyle(
// color: const Color.fromARGB(255, 136, 136, 136), // color: const Color.fromARGB(255, 136, 136, 136),
// fontSize: ScreenAdaper.sp(18)), // fontSize: ScreenAdaper.height(18)),
// enabledBorder: const UnderlineInputBorder( // enabledBorder: const UnderlineInputBorder(
// borderSide: BorderSide( // borderSide: BorderSide(
// color: Color.fromARGB(153, 191, 190, 190), // color: Color.fromARGB(153, 191, 190, 190),
@ -168,14 +169,14 @@ class UserInfoPage extends StatelessWidget {
// child: Text( // child: Text(
// e, // e,
// style: TextStyle( // style: TextStyle(
// fontSize: ScreenAdaper.sp(30)), // fontSize: ScreenAdaper.height(30)),
// ), // ),
// )) // ))
// .toList(), // .toList(),
// ))); // )));
// }, // },
// style: // 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)) // cursorColor: const Color.fromARGB(255, 87, 86, 86))
], ],
); );

View File

@ -20,7 +20,7 @@ class AgentSearch extends StatelessWidget {
AgentSearch({super.key, this.onSelected, this.beforeSelectedCheck}); AgentSearch({super.key, this.onSelected, this.beforeSelectedCheck});
final controller = Get.put(AgentSearchController()); final controller = Get.put(AgentSearchController());
final listTitleTextStyle = final listTitleTextStyle =
TextStyle(fontSize: ScreenAdaper.sp(20), fontWeight: FontWeight.w600); TextStyle(fontSize: ScreenAdaper.height(20), fontWeight: FontWeight.w600);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
@ -79,7 +79,7 @@ class AgentSearch extends StatelessWidget {
} }
Widget buildList() { Widget buildList() {
final textStyle = TextStyle(fontSize: ScreenAdaper.sp(22)); final textStyle = TextStyle(fontSize: ScreenAdaper.height(22));
return Obx(() => SmartRefresher( return Obx(() => SmartRefresher(
enablePullDown: true, enablePullDown: true,
enablePullUp: true, enablePullUp: true,
@ -130,7 +130,7 @@ class AgentSearch extends StatelessWidget {
), ),
Text( Text(
'${controller.list[index].nickname}', '${controller.list[index].nickname}',
style: TextStyle(fontSize: ScreenAdaper.sp(25)), style: TextStyle(fontSize: ScreenAdaper.height(25)),
), ),
if (controller.list[index].dept != null) ...[ if (controller.list[index].dept != null) ...[
SizedBox( SizedBox(

View File

@ -19,7 +19,7 @@ class InventorySearch extends StatelessWidget {
{super.key, this.onInventorySelected, this.beforeSelectedCheck}); {super.key, this.onInventorySelected, this.beforeSelectedCheck});
final controller = Get.put(InventorySearchController()); final controller = Get.put(InventorySearchController());
final listTitleTextStyle = final listTitleTextStyle =
TextStyle(fontSize: ScreenAdaper.sp(20), fontWeight: FontWeight.w600); TextStyle(fontSize: ScreenAdaper.height(25), fontWeight: FontWeight.w600);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
@ -83,8 +83,8 @@ class InventorySearch extends StatelessWidget {
Widget buildHasInventoryPicker() { Widget buildHasInventoryPicker() {
return Container( return Container(
width: ScreenAdaper.width(150), width: ScreenAdaper.width(200),
constraints: BoxConstraints(minWidth: ScreenAdaper.width(150)), constraints: BoxConstraints(minWidth: ScreenAdaper.width(200)),
child: Obx( child: Obx(
() => DropdownButtonFormField( () => DropdownButtonFormField(
value: controller.hasInventoryStatus.value, value: controller.hasInventoryStatus.value,
@ -118,7 +118,7 @@ class InventorySearch extends StatelessWidget {
} }
Widget buildInventoryList() { Widget buildInventoryList() {
final textStyle = TextStyle(fontSize: ScreenAdaper.sp(22)); final textStyle = TextStyle(fontSize: ScreenAdaper.height(25));
return Obx(() => SmartRefresher( return Obx(() => SmartRefresher(
enablePullDown: true, enablePullDown: true,
enablePullUp: true, enablePullUp: true,
@ -132,14 +132,20 @@ class InventorySearch extends StatelessWidget {
child: Empty(text: '暂无库存'), child: Empty(text: '暂无库存'),
) )
: Table(columnWidths: { : Table(columnWidths: {
0: FixedColumnWidth(100), 0: MinColumnWidth(
1: FlexColumnWidth(2),
2: MinColumnWidth(
FixedColumnWidth(200), FixedColumnWidth(200)),
3: MinColumnWidth(
FixedColumnWidth(100), FixedColumnWidth(100)),
4: MinColumnWidth(
FixedColumnWidth(80), FixedColumnWidth(80)), 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: [ }, children: [
// table header // table header
TableRow( TableRow(
@ -217,7 +223,7 @@ class InventorySearch extends StatelessWidget {
Text( Text(
'${itemData.product?.company?.name}', '${itemData.product?.company?.name}',
style: TextStyle( style: TextStyle(
fontSize: ScreenAdaper.sp(15), fontSize: ScreenAdaper.height(15),
color: AppTheme.grey), color: AppTheme.grey),
) )
], ],

View File

@ -15,7 +15,7 @@ class ProductSearch extends StatelessWidget {
ProductSearch({super.key, this.onProductSelected}); ProductSearch({super.key, this.onProductSelected});
final controller = Get.put(ProductSearchController()); final controller = Get.put(ProductSearchController());
final listTitleTextStyle = final listTitleTextStyle =
TextStyle(fontSize: ScreenAdaper.sp(20), fontWeight: FontWeight.w600); TextStyle(fontSize: ScreenAdaper.height(20), fontWeight: FontWeight.w600);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
@ -121,7 +121,7 @@ class ProductSearch extends StatelessWidget {
BoxConstraints(minWidth: ScreenAdaper.width(100)), BoxConstraints(minWidth: ScreenAdaper.width(100)),
child: Text( child: Text(
itemData.productNumber!, itemData.productNumber!,
style: TextStyle(fontSize: ScreenAdaper.sp(20)), style: TextStyle(fontSize: ScreenAdaper.height(20)),
), ),
), ),
SizedBox( SizedBox(
@ -133,12 +133,12 @@ class ProductSearch extends StatelessWidget {
children: [ children: [
Text( Text(
'${itemData.name}', '${itemData.name}',
style: TextStyle(fontSize: ScreenAdaper.sp(20)), style: TextStyle(fontSize: ScreenAdaper.height(20)),
), ),
Text( Text(
'${itemData.company?.name}', '${itemData.company?.name}',
style: TextStyle( style: TextStyle(
fontSize: ScreenAdaper.sp(15), fontSize: ScreenAdaper.height(15),
color: AppTheme.grey), color: AppTheme.grey),
) )
], ],

View File

@ -34,11 +34,10 @@ class NewInventoryInout extends StatelessWidget {
return SafeArea( return SafeArea(
top: false, // false以避免保留顶部状态栏的空间 top: false, // false以避免保留顶部状态栏的空间
child: Scaffold( child: Scaffold(
appBar: PreferredSize( appBar: AppBar(
preferredSize: Size.fromHeight(ScreenAdaper.height( title: Text(
kToolbarHeight)), // 使kToolbarHeightAppBar的推荐高度 inOrOut == InventoryInOrOutEnum.In ? '入库登记' : '出库登记',
child: AppBar( style: TextStyle(fontSize: ScreenAdaper.height(35)),
title: const Text('出入库登记'),
), ),
), ),
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
@ -63,7 +62,51 @@ class NewInventoryInout extends StatelessWidget {
Widget buildForm() { Widget buildForm() {
double formVerticalGap = 20.0; double formVerticalGap = 20.0;
double formHorizontalGap = 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: [ Row(children: [
Expanded( Expanded(
flex: 3, flex: 3,
@ -121,11 +164,10 @@ class NewInventoryInout extends StatelessWidget {
), ),
buildImageUploadQueue() buildImageUploadQueue()
]; ];
final child = Column( final child = Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: children, children: ScreenAdaper.isTablet() ? tabletChildren : phoneChildren,
); );
return Form( return Form(
@ -152,7 +194,7 @@ class NewInventoryInout extends StatelessWidget {
horizontal: ScreenAdaper.width(20)), horizontal: ScreenAdaper.width(20)),
child: Text( child: Text(
'${itemData.name}', '${itemData.name}',
style: TextStyle(fontSize: ScreenAdaper.sp(20)), style: TextStyle(fontSize: ScreenAdaper.height(20)),
)), )),
suggestionsCallback: (String keyword) { suggestionsCallback: (String keyword) {
return controller.getProjects(keyword: keyword); return controller.getProjects(keyword: keyword);
@ -179,11 +221,11 @@ class NewInventoryInout extends StatelessWidget {
Text( Text(
"*", "*",
style: TextStyle( style: TextStyle(
color: Colors.red, fontSize: ScreenAdaper.sp(30)), color: Colors.red, fontSize: ScreenAdaper.height(30)),
), ),
Text( Text(
'产品', '产品',
style: TextStyle(fontSize: ScreenAdaper.sp(30)), style: TextStyle(fontSize: ScreenAdaper.height(30)),
), ),
]), ]),
floatingLabelBehavior: FloatingLabelBehavior.always), floatingLabelBehavior: FloatingLabelBehavior.always),
@ -300,11 +342,11 @@ class NewInventoryInout extends StatelessWidget {
Text( Text(
"*", "*",
style: TextStyle( style: TextStyle(
color: Colors.red, fontSize: ScreenAdaper.sp(30)), color: Colors.red, fontSize: ScreenAdaper.height(30)),
), ),
Text( Text(
'经办人', '经办人',
style: TextStyle(fontSize: ScreenAdaper.sp(30)), style: TextStyle(fontSize: ScreenAdaper.height(30)),
), ),
]), ]),
floatingLabelBehavior: FloatingLabelBehavior.always), floatingLabelBehavior: FloatingLabelBehavior.always),
@ -360,8 +402,9 @@ class NewInventoryInout extends StatelessWidget {
]; ];
return TextFormField( return TextFormField(
controller: controller.positionTextController, controller: controller.positionTextController,
decoration: const InputDecoration( decoration: InputDecoration(
labelText: '库存位置', label: Text('库存位置',
style: TextStyle(fontSize: ScreenAdaper.height(30))),
floatingLabelBehavior: FloatingLabelBehavior.always), floatingLabelBehavior: FloatingLabelBehavior.always),
readOnly: true, readOnly: true,
onTap: () { onTap: () {
@ -405,7 +448,7 @@ class NewInventoryInout extends StatelessWidget {
Text( Text(
'*产品照片', '*产品照片',
style: TextStyle( style: TextStyle(
fontSize: ScreenAdaper.sp(25), fontSize: ScreenAdaper.height(25),
color: AppTheme.secondPrimaryColor), color: AppTheme.secondPrimaryColor),
), ),
SizedBox( SizedBox(
@ -433,7 +476,7 @@ class NewInventoryInout extends StatelessWidget {
Text( Text(
'*经办人自拍', '*经办人自拍',
style: TextStyle( style: TextStyle(
fontSize: ScreenAdaper.sp(25), fontSize: ScreenAdaper.height(25),
color: AppTheme.secondPrimaryColor), color: AppTheme.secondPrimaryColor),
), ),
SizedBox( SizedBox(
@ -509,7 +552,7 @@ class NewInventoryInout extends StatelessWidget {
blurRadius: 3, blurRadius: 3,
), ),
], ],
size: ScreenAdaper.sp(40), size: ScreenAdaper.height(40),
color: AppTheme.nearlyWhite, color: AppTheme.nearlyWhite,
), ),
)) ))
@ -535,7 +578,7 @@ class NewInventoryInout extends StatelessWidget {
child: Center( child: Center(
child: Icon( child: Icon(
Icons.add_a_photo_rounded, Icons.add_a_photo_rounded,
size: ScreenAdaper.sp(60), size: ScreenAdaper.height(60),
color: AppTheme.primaryColor, color: AppTheme.primaryColor,
)))); ))));
} }

View File

@ -79,10 +79,10 @@ class WorkBenchPage extends StatelessWidget {
colors: [AppTheme.primaryColorLight, AppTheme.primaryColor]), colors: [AppTheme.primaryColorLight, AppTheme.primaryColor]),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: AppTheme.black.withOpacity(0.5), color: AppTheme.black.withOpacity(0.4),
offset: Offset(0, 0), offset: Offset(0, 0),
blurRadius: 5, blurRadius: 1,
spreadRadius: 2) spreadRadius: 1)
], ],
), ),
child: Stack( child: Stack(
@ -96,7 +96,7 @@ class WorkBenchPage extends StatelessWidget {
works[index].title, works[index].title,
style: TextStyle( style: TextStyle(
letterSpacing: ScreenAdaper.width(10), letterSpacing: ScreenAdaper.width(10),
fontSize: ScreenAdaper.sp(40), fontSize: ScreenAdaper.height(40),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
foreground: Paint() foreground: Paint()
..style = PaintingStyle.stroke ..style = PaintingStyle.stroke
@ -108,7 +108,7 @@ class WorkBenchPage extends StatelessWidget {
style: TextStyle( style: TextStyle(
letterSpacing: ScreenAdaper.width(10), letterSpacing: ScreenAdaper.width(10),
color: Colors.white, color: Colors.white,
fontSize: ScreenAdaper.sp(40), fontSize: ScreenAdaper.height(40),
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
], ],

View File

@ -36,7 +36,7 @@ class LoadingUtil extends GetxService {
children: [ children: [
LoadingAnimationWidget.fourRotatingDots( LoadingAnimationWidget.fourRotatingDots(
color: AppTheme.primaryColor, color: AppTheme.primaryColor,
size: ScreenAdaper.sp(50), size: ScreenAdaper.height(50),
), ),
if (status != null) if (status != null)
SizedBox(width: ScreenAdaper.width(20)), SizedBox(width: ScreenAdaper.width(20)),
@ -44,7 +44,7 @@ class LoadingUtil extends GetxService {
Text(status, Text(status,
style: TextStyle( style: TextStyle(
color: AppTheme.primaryColor, color: AppTheme.primaryColor,
fontSize: ScreenAdaper.sp(20))) fontSize: ScreenAdaper.height(20)))
], ],
), ),
) )

View File

@ -30,8 +30,8 @@ class ScreenAdaper {
: ScreenUtil().screenHeight; : ScreenUtil().screenHeight;
} }
/// ///
static double screenWidth() { static double screenShortDistance() {
return isLandspace() ? ScreenUtil().screenHeight : ScreenUtil().screenWidth; return isLandspace() ? ScreenUtil().screenHeight : ScreenUtil().screenWidth;
} }
@ -48,4 +48,8 @@ class ScreenAdaper {
static isLandspace() { static isLandspace() {
return Get.context?.orientation == Orientation.landscape; return Get.context?.orientation == Orientation.landscape;
} }
static isTablet() {
return ScreenUtil().screenWidth > 650;
}
} }

View File

@ -32,7 +32,7 @@ class SnackBarUtil {
messageText: Text( messageText: Text(
'$title', '$title',
style: TextStyle( style: TextStyle(
fontSize: ScreenAdaper.sp(25), color: AppTheme.nearlyWhite), fontSize: ScreenAdaper.height(25), color: AppTheme.nearlyWhite),
), ),
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
horizontal: ScreenAdaper.width(20), vertical: 0), horizontal: ScreenAdaper.width(20), vertical: 0),

View File

@ -36,13 +36,14 @@ class BottomNavBar extends StatelessWidget {
children: [ children: [
Icon( Icon(
controller.bottomNavItems![index].icon, controller.bottomNavItems![index].icon,
size: ScreenAdaper.sp(40), size: ScreenAdaper.height(40),
color: color, color: color,
), ),
AutoSizeText( AutoSizeText(
controller.bottomNavItems![index].label ?? '', controller.bottomNavItems![index].label ?? '',
maxLines: 1, maxLines: 1,
style: TextStyle(color: color, fontSize: ScreenAdaper.sp(20)), style:
TextStyle(color: color, fontSize: ScreenAdaper.height(20)),
group: autoSizeGroup, group: autoSizeGroup,
), ),
], ],
@ -53,7 +54,7 @@ class BottomNavBar extends StatelessWidget {
} }
} }
// BottomNavigationBar( // BottomNavigationBar(
// iconSize: ScreenAdaper.sp(40), // iconsize: ScreenAdaper.height(40),
// type: BottomNavigationBarType.fixed, // type: BottomNavigationBarType.fixed,
// items: bottomNavItems, // items: bottomNavItems,
// showSelectedLabels: true, // showSelectedLabels: true,

View File

@ -31,7 +31,7 @@ class ZtDatePicker extends StatelessWidget {
floatingLabelBehavior: FloatingLabelBehavior.always, floatingLabelBehavior: FloatingLabelBehavior.always,
prefixIcon: Icon( prefixIcon: Icon(
Icons.date_range_outlined, Icons.date_range_outlined,
size: ScreenAdaper.sp(40), size: ScreenAdaper.height(40),
), ),
suffixIcon: textController.text.isNotEmpty suffixIcon: textController.text.isNotEmpty
? IconButton( ? IconButton(
@ -54,11 +54,11 @@ class ZtDatePicker extends StatelessWidget {
Text( Text(
"*", "*",
style: TextStyle( style: TextStyle(
color: Colors.red, fontSize: ScreenAdaper.sp(30)), color: Colors.red, fontSize: ScreenAdaper.height(30)),
), ),
Text( Text(
labelText, labelText,
style: TextStyle(fontSize: ScreenAdaper.sp(30)), style: TextStyle(fontSize: ScreenAdaper.height(30)),
), ),
])), ])),
keyboardType: TextInputType.none, keyboardType: TextInputType.none,

View File

@ -29,7 +29,7 @@ class ZtBaseDatePicker extends StatelessWidget {
}, },
child: Text( child: Text(
'取消', '取消',
style: TextStyle(fontSize: ScreenAdaper.sp(25)), style: TextStyle(fontSize: ScreenAdaper.height(25)),
)), )),
const Spacer(), const Spacer(),
TextButton( TextButton(
@ -48,7 +48,7 @@ class ZtBaseDatePicker extends StatelessWidget {
}, },
child: Text( child: Text(
'确定', '确定',
style: TextStyle(fontSize: ScreenAdaper.sp(25)), style: TextStyle(fontSize: ScreenAdaper.height(25)),
)) ))
], ],
), ),

View File

@ -35,7 +35,7 @@ class ZtBaseDatePicker extends StatelessWidget {
}, },
child: Text( child: Text(
'取消', '取消',
style: TextStyle(fontSize: ScreenAdaper.sp(25)), style: TextStyle(fontSize: ScreenAdaper.height(25)),
)), )),
const Spacer(), const Spacer(),
TextButton( TextButton(
@ -54,7 +54,7 @@ class ZtBaseDatePicker extends StatelessWidget {
}, },
child: Text( child: Text(
'确定', '确定',
style: TextStyle(fontSize: ScreenAdaper.sp(25)), style: TextStyle(fontSize: ScreenAdaper.height(25)),
)) ))
], ],
), ),

View File

@ -43,7 +43,7 @@ class ZtBottomSheetPicker extends StatelessWidget {
}, },
child: Text( child: Text(
'取消', '取消',
style: TextStyle(fontSize: ScreenAdaper.sp(25)), style: TextStyle(fontSize: ScreenAdaper.height(25)),
)), )),
Expanded( Expanded(
child: Center( child: Center(
@ -51,7 +51,7 @@ class ZtBottomSheetPicker extends StatelessWidget {
title, title,
style: TextStyle( style: TextStyle(
color: AppTheme.nearlyBlack, color: AppTheme.nearlyBlack,
fontSize: ScreenAdaper.sp(25), fontSize: ScreenAdaper.height(25),
decoration: TextDecoration.none), decoration: TextDecoration.none),
), ),
)), )),
@ -70,7 +70,7 @@ class ZtBottomSheetPicker extends StatelessWidget {
}, },
child: Text( child: Text(
'确定', '确定',
style: TextStyle(fontSize: ScreenAdaper.sp(25)), style: TextStyle(fontSize: ScreenAdaper.height(25)),
)) ))
], ],
), ),

View File

@ -48,11 +48,11 @@ class ZtNumberInput extends StatelessWidget {
Text( Text(
"*", "*",
style: TextStyle( style: TextStyle(
color: Colors.red, fontSize: ScreenAdaper.sp(30)), color: Colors.red, fontSize: ScreenAdaper.height(30)),
), ),
Text( Text(
labelText, labelText,
style: TextStyle(fontSize: ScreenAdaper.sp(30)), style: TextStyle(fontSize: ScreenAdaper.height(30)),
), ),
]), ]),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(

View File

@ -74,11 +74,11 @@ class ZtSearchSelect<T> extends StatelessWidget {
"*", "*",
style: TextStyle( style: TextStyle(
color: Colors.red, color: Colors.red,
fontSize: ScreenAdaper.sp(30)), fontSize: ScreenAdaper.height(30)),
), ),
Text( Text(
labelText, labelText,
style: TextStyle(fontSize: ScreenAdaper.sp(30)), style: TextStyle(fontSize: ScreenAdaper.height(30)),
), ),
]))); ])));
}, },
@ -88,7 +88,7 @@ class ZtSearchSelect<T> extends StatelessWidget {
height: ScreenAdaper.height(50), height: ScreenAdaper.height(50),
child: Text( child: Text(
'未找到记录', '未找到记录',
style: TextStyle(fontSize: ScreenAdaper.sp(20)), style: TextStyle(fontSize: ScreenAdaper.height(20)),
), ),
), ),
itemBuilder: (context, itemData) { itemBuilder: (context, itemData) {

View File

@ -40,11 +40,11 @@ class ZtTextInput extends StatelessWidget {
Text( Text(
"*", "*",
style: TextStyle( style: TextStyle(
color: Colors.red, fontSize: ScreenAdaper.sp(30)), color: Colors.red, fontSize: ScreenAdaper.height(30)),
), ),
Text( Text(
labelText, labelText,
style: TextStyle(fontSize: ScreenAdaper.sp(30)), style: TextStyle(fontSize: ScreenAdaper.height(30)),
), ),
]), ]),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(

View File

@ -17,7 +17,7 @@ class Empty extends StatelessWidget {
Text( Text(
text ?? '', text ?? '',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(fontSize: ScreenAdaper.sp(30)), style: TextStyle(fontSize: ScreenAdaper.height(30)),
), ),
]), ]),
); );

View File

@ -75,7 +75,7 @@ class _FadeInCacheImageState extends State<FadeInCacheImage> {
width: widget.width, width: widget.width,
height: widget.height, height: widget.height,
child: Icon(Icons.image_not_supported, 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), color: AppTheme.grey),
); );
} }

View File

@ -22,7 +22,7 @@ class FloatingCreateButton extends StatelessWidget {
child: Icon( child: Icon(
Icons.add, Icons.add,
color: Colors.white, color: Colors.white,
size: ScreenAdaper.sp(70), size: ScreenAdaper.height(70),
), ),
), ),
); );

View File

@ -36,14 +36,14 @@ class GradientButton extends StatelessWidget {
child: isLoading child: isLoading
? LoadingAnimationWidget.fourRotatingDots( ? LoadingAnimationWidget.fourRotatingDots(
color: AppTheme.nearlyWhite, color: AppTheme.nearlyWhite,
size: ScreenAdaper.sp(40), size: ScreenAdaper.height(40),
) )
: Text( : Text(
buttonText, buttonText,
style: TextStyle( style: TextStyle(
color: AppTheme.nearlyWhite, color: AppTheme.nearlyWhite,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: ScreenAdaper.sp(25), fontSize: ScreenAdaper.height(25),
), ),
), ),
), ),

View File

@ -61,7 +61,7 @@ class _ImagePreivewState extends State<ImagePreivew> {
style: TextStyle( style: TextStyle(
decoration: TextDecoration.none, decoration: TextDecoration.none,
color: Colors.white, color: Colors.white,
fontSize: ScreenAdaper.sp(20), fontSize: ScreenAdaper.height(20),
), ),
), ),
), ),
@ -84,7 +84,7 @@ class _ImagePreivewState extends State<ImagePreivew> {
icon: Icon( icon: Icon(
Icons.download_for_offline_sharp, Icons.download_for_offline_sharp,
color: AppTheme.nearlyWhite, color: AppTheme.nearlyWhite,
size: ScreenAdaper.sp(50), size: ScreenAdaper.height(50),
), ),
)) ))
], ],

View File

@ -13,7 +13,7 @@ class LoadingIndicator extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return common return common
? LoadingAnimationWidget.fourRotatingDots( ? LoadingAnimationWidget.fourRotatingDots(
color: AppTheme.primaryColorLight, size: ScreenAdaper.sp(45)) color: AppTheme.primaryColorLight, size: ScreenAdaper.height(45))
: CupertinoActivityIndicator( : CupertinoActivityIndicator(
animating: animating, animating: animating,
color: AppTheme.primaryColor, color: AppTheme.primaryColor,

View File

@ -30,7 +30,7 @@ class _RefreshFooterState extends State<RefreshFooter>
} }
Widget buildBody() { Widget buildBody() {
TextStyle style = TextStyle(fontSize: ScreenAdaper.sp(18)); TextStyle style = TextStyle(fontSize: ScreenAdaper.height(18));
return CustomFooter( return CustomFooter(
builder: (BuildContext context, LoadStatus? status) { builder: (BuildContext context, LoadStatus? status) {
Widget body; Widget body;

View File

@ -39,7 +39,7 @@ class RefreshHeaderState extends RefreshIndicatorState<RefreshHeader>
@override @override
Widget buildContent(BuildContext context, RefreshStatus mode) { Widget buildContent(BuildContext context, RefreshStatus mode) {
TextStyle style = TextStyle(fontSize: ScreenAdaper.sp(18)); TextStyle style = TextStyle(fontSize: ScreenAdaper.height(18));
Widget body; Widget body;
if (mode == RefreshStatus.refreshing) { if (mode == RefreshStatus.refreshing) {
body = const LoadingIndicator(); body = const LoadingIndicator();