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,
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))),

View File

@ -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';

View File

@ -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),
))),
],
),

View File

@ -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,
),
),

View File

@ -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)),
),
)
],

View File

@ -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),
),
);
}

View File

@ -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))));
}
}

View File

@ -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(

View File

@ -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,
),
),

View File

@ -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),

View File

@ -43,6 +43,7 @@ class InventoryInoutController extends GetxController {
/// picker
Future<void> 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,9 +208,7 @@ class InventoryInoutController extends GetxController {
/// dialog
Future showInventoryInoutCreateDialog(int inOrOut) async {
final isTablet = Responsive.isTablet(Get.context!);
return isTablet
? Get.generalDialog(
return Get.generalDialog(
barrierLabel: "CreateInventoryInout",
barrierDismissible: true,
transitionDuration: const Duration(milliseconds: 400),
@ -230,22 +231,13 @@ class InventoryInoutController extends GetxController {
if (value != null) {
getData();
}
})
: showModalBottomSheet(
elevation: 0,
isScrollControlled: true,
backgroundColor: Colors.white,
context: Get.overlayContext!,
builder: (context) {
return NewInventoryInout(inOrOut: inOrOut);
},
);
});
}
// 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))

View File

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

View File

@ -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,
),
)),

View File

@ -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,
),
)),

View File

@ -77,7 +77,7 @@ class _MinePageState extends State<MinePage>
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<MinePage>
style: TextStyle(
letterSpacing: ScreenAdaper.width(5),
color: Colors.white,
fontSize: ScreenAdaper.sp(30),
fontSize: ScreenAdaper.height(30),
fontWeight: FontWeight.bold),
),
],

View File

@ -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)),
// ),
// ],
// )));

View File

@ -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))
],
);

View File

@ -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(

View File

@ -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),
)
],

View File

@ -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),
)
],

View File

@ -34,11 +34,10 @@ class NewInventoryInout extends StatelessWidget {
return SafeArea(
top: false, // false以避免保留顶部状态栏的空间
child: Scaffold(
appBar: PreferredSize(
preferredSize: Size.fromHeight(ScreenAdaper.height(
kToolbarHeight)), // 使kToolbarHeightAppBar的推荐高度
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,
))));
}

View File

@ -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),
),
],

View File

@ -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)))
],
),
)

View File

@ -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;
}
}

View File

@ -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),

View File

@ -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,

View File

@ -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,

View File

@ -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)),
))
],
),

View File

@ -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)),
))
],
),

View File

@ -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)),
))
],
),

View File

@ -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(

View File

@ -74,11 +74,11 @@ class ZtSearchSelect<T> 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<T> extends StatelessWidget {
height: ScreenAdaper.height(50),
child: Text(
'未找到记录',
style: TextStyle(fontSize: ScreenAdaper.sp(20)),
style: TextStyle(fontSize: ScreenAdaper.height(20)),
),
),
itemBuilder: (context, itemData) {

View File

@ -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(

View File

@ -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)),
),
]),
);

View File

@ -75,7 +75,7 @@ class _FadeInCacheImageState extends State<FadeInCacheImage> {
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),
);
}

View File

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

View File

@ -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),
),
),
),

View File

@ -61,7 +61,7 @@ class _ImagePreivewState extends State<ImagePreivew> {
style: TextStyle(
decoration: TextDecoration.none,
color: Colors.white,
fontSize: ScreenAdaper.sp(20),
fontSize: ScreenAdaper.height(20),
),
),
),
@ -84,7 +84,7 @@ class _ImagePreivewState extends State<ImagePreivew> {
icon: Icon(
Icons.download_for_offline_sharp,
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) {
return common
? LoadingAnimationWidget.fourRotatingDots(
color: AppTheme.primaryColorLight, size: ScreenAdaper.sp(45))
color: AppTheme.primaryColorLight, size: ScreenAdaper.height(45))
: CupertinoActivityIndicator(
animating: animating,
color: AppTheme.primaryColor,

View File

@ -30,7 +30,7 @@ class _RefreshFooterState extends State<RefreshFooter>
}
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;

View File

@ -39,7 +39,7 @@ class RefreshHeaderState extends RefreshIndicatorState<RefreshHeader>
@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();