feat: mine page
Before Width: | Height: | Size: 1014 KiB |
Before Width: | Height: | Size: 316 KiB |
Before Width: | Height: | Size: 510 KiB |
Before Width: | Height: | Size: 414 KiB |
Before Width: | Height: | Size: 912 KiB |
Before Width: | Height: | Size: 282 KiB |
Before Width: | Height: | Size: 372 KiB |
After Width: | Height: | Size: 86 KiB |
|
@ -96,7 +96,7 @@ final theme = ThemeData(
|
||||||
iconTheme: const IconThemeData(color: Colors.black),
|
iconTheme: const IconThemeData(color: Colors.black),
|
||||||
backgroundColor: AppTheme.primaryColor,
|
backgroundColor: AppTheme.primaryColor,
|
||||||
titleTextStyle: TextStyle(
|
titleTextStyle: TextStyle(
|
||||||
color: Colors.black,
|
color: Colors.white,
|
||||||
fontSize: ScreenAdaper.sp(30),
|
fontSize: ScreenAdaper.sp(30),
|
||||||
fontWeight: FontWeight.bold),
|
fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:sk_base_mobile/screens/inventory/inventory.dart';
|
||||||
import 'package:sk_base_mobile/screens/login/login.dart';
|
import 'package:sk_base_mobile/screens/login/login.dart';
|
||||||
|
|
||||||
import '../screens/landing/landing.dart';
|
import '../screens/landing/landing.dart';
|
||||||
|
@ -8,9 +9,11 @@ class RouteConfig {
|
||||||
static const String home = "/";
|
static const String home = "/";
|
||||||
static const String login = '/login';
|
static const String login = '/login';
|
||||||
static const String userinfo = '/userinfo';
|
static const String userinfo = '/userinfo';
|
||||||
|
static const String inventory = '/inventory';
|
||||||
static final List<GetPage> getPages = [
|
static final List<GetPage> getPages = [
|
||||||
GetPage(name: login, page: () => LoginScreen()),
|
GetPage(name: login, page: () => LoginScreen()),
|
||||||
GetPage(name: home, page: () => LandingPage()),
|
GetPage(name: home, page: () => LandingPage()),
|
||||||
GetPage(name: userinfo, page: () => UserInfoPage()),
|
GetPage(name: userinfo, page: () => UserInfoPage()),
|
||||||
|
GetPage(name: inventory, page: () => InventoryPage()),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:sk_base_mobile/config.dart';
|
import 'package:sk_base_mobile/config.dart';
|
||||||
import 'package:sk_base_mobile/screens/landing/landing.dart';
|
|
||||||
import 'package:sk_base_mobile/screens/login/login%20copy.dart';
|
|
||||||
import 'package:sk_base_mobile/services/storage.service.dart';
|
import 'package:sk_base_mobile/services/storage.service.dart';
|
||||||
import 'package:sk_base_mobile/app_theme.dart';
|
import 'package:sk_base_mobile/app_theme.dart';
|
||||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:sk_base_mobile/constants/bg_color.dart';
|
import 'package:sk_base_mobile/constants/bg_color.dart';
|
||||||
import 'package:sk_base_mobile/screens/inventory_inout/components/change_icon.dart';
|
import 'package:sk_base_mobile/screens/inventory_inout/components/change_icon.dart';
|
||||||
|
import 'package:sk_base_mobile/screens/inventory_inout/components/filter_btn.dart';
|
||||||
import 'package:sk_base_mobile/screens/inventory_inout/components/today_button.dart';
|
import 'package:sk_base_mobile/screens/inventory_inout/components/today_button.dart';
|
||||||
import 'package:sk_base_mobile/screens/inventory_inout/inventory_inout_controller.dart';
|
import 'package:sk_base_mobile/screens/inventory_inout/inventory_inout_controller.dart';
|
||||||
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
||||||
|
@ -16,7 +17,7 @@ class ChangeButtonRow extends StatelessWidget {
|
||||||
horizontal: MediaQuery.sizeOf(context).width * 0.06),
|
horizontal: MediaQuery.sizeOf(context).width * 0.06),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
const TodayButton(),
|
TodayButton(),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
ClipOval(
|
ClipOval(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
|
|
|
@ -63,8 +63,7 @@ class CustomAppBar extends StatelessWidget {
|
||||||
initialDate: controller.endTime.value,
|
initialDate: controller.endTime.value,
|
||||||
endDate: controller.endTime.value,
|
endDate: controller.endTime.value,
|
||||||
onDateTimeChanged: (date) {
|
onDateTimeChanged: (date) {
|
||||||
controller.endTime.value = DateTime.parse(date);
|
controller.setEndTime(DateTime.parse(date));
|
||||||
controller.getData();
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
// import 'package:flutter/foundation.dart';
|
||||||
|
// import 'package:flutter/material.dart';
|
||||||
|
// import 'package:flutter/widgets.dart';
|
||||||
|
// import 'package:get/get.dart';
|
||||||
|
// import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart';
|
||||||
|
// import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
||||||
|
|
||||||
|
// class FilterBtn extends StatelessWidget {
|
||||||
|
// FilterBtn({super.key});
|
||||||
|
// final controller = Get.put<FilterBtnController>();
|
||||||
|
// @override
|
||||||
|
// Widget build(BuildContext context) {
|
||||||
|
// return Container(
|
||||||
|
// width: ScreenAdaper.width(150),
|
||||||
|
// constraints: BoxConstraints(minWidth: ScreenAdaper.width(150)),
|
||||||
|
// child: Obx(
|
||||||
|
// () => DropdownButtonFormField(
|
||||||
|
// value: controller.hasInventoryStatus.value,
|
||||||
|
// items: [
|
||||||
|
// DropdownMenuItem(
|
||||||
|
// child: Text('全部'),
|
||||||
|
// value: -1,
|
||||||
|
// ),
|
||||||
|
// DropdownMenuItem(
|
||||||
|
// child: const Text('入库'),
|
||||||
|
// value: 0,
|
||||||
|
// ),
|
||||||
|
// DropdownMenuItem(
|
||||||
|
// child: const Text('出库'),
|
||||||
|
// value: 1,
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// onChanged: (value) {
|
||||||
|
// controller.hasInventoryStatus.value = value!;
|
||||||
|
// controller.refreshController.requestRefresh();
|
||||||
|
// },
|
||||||
|
// decoration: InputDecoration(
|
||||||
|
// contentPadding: EdgeInsets.symmetric(
|
||||||
|
// vertical: ScreenAdaper.height(15),
|
||||||
|
// horizontal: ScreenAdaper.width(15)),
|
||||||
|
// border: OutlineInputBorder(
|
||||||
|
// borderRadius: BorderRadius.circular(ScreenAdaper.sp(15)),
|
||||||
|
// ),
|
||||||
|
// )),
|
||||||
|
// ));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// class FilterBtnController extends GetxController {}
|
|
@ -6,15 +6,13 @@ import 'package:sk_base_mobile/screens/inventory_inout/inventory_inout_controlle
|
||||||
import 'package:sk_base_mobile/util/util.dart';
|
import 'package:sk_base_mobile/util/util.dart';
|
||||||
|
|
||||||
class TodayButton extends StatelessWidget {
|
class TodayButton extends StatelessWidget {
|
||||||
const TodayButton({super.key});
|
TodayButton({super.key});
|
||||||
|
final controller = Get.find<InventoryInoutController>();
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final controller = Get.find<InventoryInoutController>();
|
|
||||||
return InkWell(
|
return InkWell(
|
||||||
borderRadius: BorderRadius.circular(ScreenAdaper.sp(30)),
|
borderRadius: BorderRadius.circular(ScreenAdaper.sp(30)),
|
||||||
onTap: () => controller.pageController.animateToPage(0,
|
onTap: () => controller.setEndTime(DateTime.now()),
|
||||||
duration: const Duration(milliseconds: 300), curve: Curves.easeIn),
|
|
||||||
child: Container(
|
child: Container(
|
||||||
height: ScreenAdaper.height(70),
|
height: ScreenAdaper.height(70),
|
||||||
width: ScreenAdaper.width(200),
|
width: ScreenAdaper.width(200),
|
||||||
|
|
|
@ -41,7 +41,7 @@ class InventoryInoutController extends GetxController {
|
||||||
getData();
|
getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 打开出库还是入库选择框
|
/// 出库还是入库picker
|
||||||
Future<void> showInOrOutPickerDialog() async {
|
Future<void> showInOrOutPickerDialog() async {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: Get.overlayContext!,
|
context: Get.overlayContext!,
|
||||||
|
@ -203,7 +203,7 @@ class InventoryInoutController extends GetxController {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 打开新建库存出入库对话框
|
/// 新建出入库dialog
|
||||||
Future showInventoryInoutCreateDialog(int inOrOut) async {
|
Future showInventoryInoutCreateDialog(int inOrOut) async {
|
||||||
final isTablet = Responsive.isTablet(Get.context!);
|
final isTablet = Responsive.isTablet(Get.context!);
|
||||||
return isTablet
|
return isTablet
|
||||||
|
@ -242,11 +242,13 @@ class InventoryInoutController extends GetxController {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 出入库详情dialog
|
||||||
Future showInventoryInoutInfoDialog(int id) async {
|
Future showInventoryInoutInfoDialog(int id) async {
|
||||||
ModalUtil.showGeneralDialog(
|
ModalUtil.showGeneralDialog(
|
||||||
width: ScreenAdaper.width(Get.width - 100),
|
width: ScreenAdaper.width(Get.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))
|
||||||
.then((value) => {Get.delete<InventoryInouInfoController>()});
|
.then((value) => {Get.delete<InventoryInouInfoController>()});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,6 +281,14 @@ class InventoryInoutController extends GetxController {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setEndTime(DateTime newEndTime) async {
|
||||||
|
currentIndex.value = 0;
|
||||||
|
endTime.value = newEndTime;
|
||||||
|
pageController.jumpTo(0);
|
||||||
|
scrollController.jumpTo(0);
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
|
||||||
setIndex(int value) {
|
setIndex(int value) {
|
||||||
pageController.animateToPage(value,
|
pageController.animateToPage(value,
|
||||||
duration: const Duration(milliseconds: 300), curve: Curves.easeIn);
|
duration: const Duration(milliseconds: 300), curve: Curves.easeIn);
|
||||||
|
|
|
@ -34,118 +34,77 @@ class _MinePageState extends State<MinePage>
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return _buildBody();
|
return Container(
|
||||||
|
color: AppTheme.nearlyWhite,
|
||||||
|
child: _buildBody(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildBody() {
|
Widget _buildBody() {
|
||||||
return Column(children: [
|
return Column(children: [
|
||||||
// Container(
|
Container(
|
||||||
// height: ScreenAdaper.height(360),
|
height: ScreenAdaper.height(300),
|
||||||
// width: ScreenAdaper.screenWidth(),
|
decoration: const BoxDecoration(
|
||||||
// decoration: const BoxDecoration(
|
image: DecorationImage(
|
||||||
// image: DecorationImage(
|
fit: BoxFit.cover,
|
||||||
// fit: BoxFit.cover,
|
image: AssetImage('assets/images/yeyazhijia_bg.jpg'))),
|
||||||
// image: AssetImage('assets/images/mine_bg.png'))),
|
// decoration: BoxDecoration(
|
||||||
// child: Padding(
|
// gradient: LinearGradient(
|
||||||
// padding: EdgeInsets.symmetric(
|
// colors: [AppTheme.primaryColorLight, AppTheme.primaryColor])),
|
||||||
// horizontal: ScreenAdaper.width(20),
|
child: Padding(
|
||||||
// vertical: ScreenAdaper.height(20)),
|
padding: EdgeInsets.symmetric(
|
||||||
// child: Column(children: [
|
horizontal: ScreenAdaper.width(20),
|
||||||
// SizedBox(
|
vertical: ScreenAdaper.height(20)),
|
||||||
// height: ScreenAdaper.height(30),
|
child: Column(children: [
|
||||||
// ),
|
SizedBox(
|
||||||
// Row(
|
height: ScreenAdaper.height(80),
|
||||||
// children: [
|
),
|
||||||
// const Spacer(),
|
Row(
|
||||||
// Container(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
// height: ScreenAdaper.width(40),
|
children: [
|
||||||
// width: ScreenAdaper.width(40),
|
Column(
|
||||||
// padding: EdgeInsets.all(ScreenAdaper.width(2)),
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
// decoration: BoxDecoration(
|
children: [
|
||||||
// borderRadius: BorderRadius.circular(ScreenAdaper.sp(40)),
|
MyAvatarWidget(),
|
||||||
// color: const Color(0xFF000000).withOpacity(0.3)),
|
SizedBox(
|
||||||
// child: const SizedBox(),
|
height: ScreenAdaper.height(10),
|
||||||
// )
|
),
|
||||||
// ],
|
Obx(
|
||||||
// ),
|
() => Stack(
|
||||||
// SizedBox(
|
alignment: Alignment.center,
|
||||||
// height: ScreenAdaper.height(120),
|
children: [
|
||||||
// ),
|
Text(
|
||||||
// Row(
|
AuthStore.to.userInfo.value.nickname ?? '',
|
||||||
// children: [
|
style: TextStyle(
|
||||||
// Expanded(
|
letterSpacing: ScreenAdaper.width(5),
|
||||||
// child: Column(
|
fontSize: ScreenAdaper.sp(30),
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
fontWeight: FontWeight.bold,
|
||||||
// mainAxisAlignment: MainAxisAlignment.center,
|
foreground: Paint()
|
||||||
// children: [
|
..style = PaintingStyle.stroke
|
||||||
// Row(
|
..strokeWidth = 2
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
..color = Colors.black),
|
||||||
// children: [
|
),
|
||||||
// Obx(() => Text(
|
Text(
|
||||||
// AuthStore.to.userInfo.value.nickname ?? '',
|
AuthStore.to.userInfo.value.nickname ?? '',
|
||||||
// style: TextStyle(
|
style: TextStyle(
|
||||||
// fontSize: ScreenAdaper.sp(20),
|
letterSpacing: ScreenAdaper.width(5),
|
||||||
// fontWeight: FontWeight.w400),
|
color: Colors.white,
|
||||||
// )),
|
fontSize: ScreenAdaper.sp(30),
|
||||||
// SizedBox(
|
fontWeight: FontWeight.bold),
|
||||||
// width: ScreenAdaper.width(3),
|
),
|
||||||
// ),
|
],
|
||||||
// InkWell(
|
),
|
||||||
// onTap: () {
|
)
|
||||||
// Get.toNamed(RouteConfig.userinfo);
|
],
|
||||||
// },
|
)
|
||||||
// child: Image(
|
],
|
||||||
// image:
|
)
|
||||||
// const AssetImage('assets/images/edit_icon.png'),
|
]),
|
||||||
// height: ScreenAdaper.width(20),
|
),
|
||||||
// ),
|
),
|
||||||
// )
|
SizedBox(
|
||||||
// ],
|
height: ScreenAdaper.height(50),
|
||||||
// ),
|
),
|
||||||
// SizedBox(
|
|
||||||
// height: ScreenAdaper.height(15),
|
|
||||||
// ),
|
|
||||||
// Text(StorageService.to.getString(CacheKeys.deviceUUID) ??
|
|
||||||
// ''),
|
|
||||||
// Row(
|
|
||||||
// children: [
|
|
||||||
// SizedBox(
|
|
||||||
// width: ScreenAdaper.width(210),
|
|
||||||
// child: Text(
|
|
||||||
// 'ID: ${AuthStore.to.userInfo.value.id}',
|
|
||||||
// overflow: TextOverflow.ellipsis,
|
|
||||||
// maxLines: 2,
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: ScreenAdaper.sp(16),
|
|
||||||
// color: Colors.grey[500]),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// InkWell(
|
|
||||||
// onTap: () {},
|
|
||||||
// child: Container(
|
|
||||||
// alignment: Alignment.topCenter,
|
|
||||||
// width: ScreenAdaper.width(50),
|
|
||||||
// height: ScreenAdaper.height(30),
|
|
||||||
// padding: EdgeInsets.symmetric(
|
|
||||||
// horizontal: ScreenAdaper.width(5)),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// color: const Color(0xFF454545),
|
|
||||||
// borderRadius: BorderRadius.circular(5)),
|
|
||||||
// child: Text('copy',
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: AppTheme.white,
|
|
||||||
// fontSize: ScreenAdaper.sp(16)))),
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// )),
|
|
||||||
// MyAvatarWidget()
|
|
||||||
// ],
|
|
||||||
// )
|
|
||||||
// ]),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
Expanded(child: MineSettingsPage())
|
Expanded(child: MineSettingsPage())
|
||||||
// Expanded(
|
// Expanded(
|
||||||
// child: DefaultTabController(
|
// child: DefaultTabController(
|
||||||
|
|
|
@ -13,59 +13,66 @@ class MineSettingsPage extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: EdgeInsets.symmetric(horizontal: ScreenAdaper.width(15)),
|
padding: EdgeInsets.symmetric(horizontal: ScreenAdaper.width(15)),
|
||||||
child: ListView.separated(
|
child: SingleChildScrollView(
|
||||||
separatorBuilder: (_, index) => const Divider(
|
child: Column(
|
||||||
color: Color(0xFFCCCCCC),
|
children: [
|
||||||
),
|
Container(
|
||||||
itemBuilder: ((_, index) => _buildSettingsItem(
|
decoration: BoxDecoration(
|
||||||
index,
|
border: Border.all(),
|
||||||
)),
|
borderRadius: BorderRadius.circular(15),
|
||||||
itemCount: 4),
|
color: AppTheme.nearlyWhite),
|
||||||
);
|
width: ScreenAdaper.width(400),
|
||||||
|
padding:
|
||||||
|
EdgeInsets.symmetric(vertical: ScreenAdaper.width(10)),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
await AuthStore.to.logout(force: true);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: ScreenAdaper.width(20),
|
||||||
|
vertical: ScreenAdaper.width(20)),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'退出登录',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: ScreenAdaper.sp(20),
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
))))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildSettingsItem(int index) {
|
// Widget _buildSettingsItem(int index) {
|
||||||
switch (index) {
|
// switch (index) {
|
||||||
// auto translate
|
// // auto translate
|
||||||
case 0:
|
// case 0:
|
||||||
return Container(
|
// return;
|
||||||
padding: EdgeInsets.symmetric(vertical: ScreenAdaper.width(10)),
|
// case 1:
|
||||||
child: Row(
|
// return InkWell(
|
||||||
children: [],
|
// onTap: () async {
|
||||||
));
|
// await AuthStore.to.deleteAccount();
|
||||||
case 1:
|
// },
|
||||||
return InkWell(
|
// child: Container(
|
||||||
onTap: () async {
|
// padding: EdgeInsets.symmetric(vertical: ScreenAdaper.width(10)),
|
||||||
await AuthStore.to.deleteAccount();
|
// child: Row(
|
||||||
},
|
// children: [
|
||||||
child: Container(
|
// Text(
|
||||||
padding: EdgeInsets.symmetric(vertical: ScreenAdaper.width(10)),
|
// 'Delete acount',
|
||||||
child: Row(
|
// style: TextStyle(fontSize: ScreenAdaper.sp(18)),
|
||||||
children: [
|
// ),
|
||||||
Text(
|
// ],
|
||||||
'Delete acount',
|
// )));
|
||||||
style: TextStyle(fontSize: ScreenAdaper.sp(18)),
|
// case 2:
|
||||||
),
|
// return I;
|
||||||
],
|
// default:
|
||||||
)));
|
// return SizedBox();
|
||||||
case 2:
|
// }
|
||||||
return InkWell(
|
// }
|
||||||
onTap: () async {
|
|
||||||
await AuthStore.to.logout(force: true);
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.symmetric(vertical: ScreenAdaper.width(10)),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'Logout',
|
|
||||||
style: TextStyle(fontSize: ScreenAdaper.sp(18)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)));
|
|
||||||
default:
|
|
||||||
return SizedBox();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,218 +125,130 @@ class InventorySearch extends StatelessWidget {
|
||||||
controller: controller.refreshController,
|
controller: controller.refreshController,
|
||||||
onLoading: controller.onLoading,
|
onLoading: controller.onLoading,
|
||||||
onRefresh: controller.onRefresh,
|
onRefresh: controller.onRefresh,
|
||||||
child: controller.inventories.isEmpty
|
child: controller.refreshController.isLoading
|
||||||
? Center(
|
? SizedBox()
|
||||||
child: Empty(text: '暂无库存'),
|
: controller.inventories.isEmpty
|
||||||
)
|
? Center(
|
||||||
: Table(columnWidths: {
|
child: Empty(text: '暂无库存'),
|
||||||
0: FixedColumnWidth(100),
|
)
|
||||||
1: FlexColumnWidth(2),
|
: Table(columnWidths: {
|
||||||
2: MinColumnWidth(FixedColumnWidth(200), FixedColumnWidth(200)),
|
0: FixedColumnWidth(100),
|
||||||
3: MinColumnWidth(FixedColumnWidth(100), FixedColumnWidth(100)),
|
1: FlexColumnWidth(2),
|
||||||
4: MinColumnWidth(FixedColumnWidth(80), FixedColumnWidth(80)),
|
2: MinColumnWidth(
|
||||||
}, children: [
|
FixedColumnWidth(200), FixedColumnWidth(200)),
|
||||||
// table header
|
3: MinColumnWidth(
|
||||||
TableRow(
|
FixedColumnWidth(100), FixedColumnWidth(100)),
|
||||||
decoration: BoxDecoration(
|
4: MinColumnWidth(
|
||||||
border: Border(
|
FixedColumnWidth(80), FixedColumnWidth(80)),
|
||||||
bottom: BorderSide(color: AppTheme.dividerColor))),
|
}, children: [
|
||||||
children: [
|
// table header
|
||||||
TableCell(
|
TableRow(
|
||||||
verticalAlignment: TableCellVerticalAlignment.middle,
|
decoration: BoxDecoration(
|
||||||
child: Container(
|
border: Border(
|
||||||
alignment: Alignment.centerLeft,
|
bottom:
|
||||||
height: ScreenAdaper.height(60),
|
BorderSide(color: AppTheme.dividerColor))),
|
||||||
|
children: [
|
||||||
|
TableCell(
|
||||||
|
verticalAlignment:
|
||||||
|
TableCellVerticalAlignment.middle,
|
||||||
|
child: Container(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
height: ScreenAdaper.height(60),
|
||||||
|
child: Text(
|
||||||
|
'库存编号',
|
||||||
|
style: listTitleTextStyle,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
TableCell(
|
||||||
|
verticalAlignment:
|
||||||
|
TableCellVerticalAlignment.middle,
|
||||||
|
child: Text(
|
||||||
|
'产品名称',
|
||||||
|
style: listTitleTextStyle,
|
||||||
|
)),
|
||||||
|
TableCell(
|
||||||
|
verticalAlignment:
|
||||||
|
TableCellVerticalAlignment.middle,
|
||||||
child: Text(
|
child: Text(
|
||||||
'库存编号',
|
'规格',
|
||||||
style: listTitleTextStyle,
|
style: listTitleTextStyle,
|
||||||
),
|
),
|
||||||
)),
|
),
|
||||||
TableCell(
|
TableCell(
|
||||||
verticalAlignment: TableCellVerticalAlignment.middle,
|
verticalAlignment:
|
||||||
child: Text(
|
TableCellVerticalAlignment.middle,
|
||||||
'产品名称',
|
child: Text(
|
||||||
style: listTitleTextStyle,
|
'单价',
|
||||||
)),
|
style: listTitleTextStyle,
|
||||||
TableCell(
|
|
||||||
verticalAlignment: TableCellVerticalAlignment.middle,
|
|
||||||
child: Text(
|
|
||||||
'规格',
|
|
||||||
style: listTitleTextStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TableCell(
|
|
||||||
verticalAlignment: TableCellVerticalAlignment.middle,
|
|
||||||
child: Text(
|
|
||||||
'单价',
|
|
||||||
style: listTitleTextStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TableCell(
|
|
||||||
verticalAlignment: TableCellVerticalAlignment.middle,
|
|
||||||
child: Text(
|
|
||||||
'数量',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: listTitleTextStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
...controller.inventories.map((itemData) {
|
|
||||||
return TableRow(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border(
|
|
||||||
bottom:
|
|
||||||
BorderSide(color: AppTheme.dividerColor))),
|
|
||||||
children: [
|
|
||||||
buildTableCell(
|
|
||||||
Text(
|
|
||||||
itemData.inventoryNumber!,
|
|
||||||
style: textStyle,
|
|
||||||
),
|
),
|
||||||
itemData: itemData),
|
),
|
||||||
buildTableCell(
|
TableCell(
|
||||||
Column(
|
verticalAlignment:
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
TableCellVerticalAlignment.middle,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Text(
|
||||||
children: [
|
'数量',
|
||||||
|
textAlign: TextAlign.right,
|
||||||
|
style: listTitleTextStyle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
...controller.inventories.map((itemData) {
|
||||||
|
return TableRow(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
bottom: BorderSide(
|
||||||
|
color: AppTheme.dividerColor))),
|
||||||
|
children: [
|
||||||
|
buildTableCell(
|
||||||
Text(
|
Text(
|
||||||
'${itemData.product?.name}',
|
itemData.inventoryNumber!,
|
||||||
style: textStyle,
|
style: textStyle,
|
||||||
),
|
),
|
||||||
|
itemData: itemData),
|
||||||
|
buildTableCell(
|
||||||
|
Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'${itemData.product?.name}',
|
||||||
|
style: textStyle,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'${itemData.product?.company?.name}',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: ScreenAdaper.sp(15),
|
||||||
|
color: AppTheme.grey),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
itemData: itemData),
|
||||||
|
// 规格
|
||||||
|
buildTableCell(
|
||||||
Text(
|
Text(
|
||||||
'${itemData.product?.company?.name}',
|
itemData.product?.productSpecification ??
|
||||||
style: TextStyle(
|
'',
|
||||||
fontSize: ScreenAdaper.sp(15),
|
style: textStyle),
|
||||||
color: AppTheme.grey),
|
itemData: itemData),
|
||||||
)
|
// 单价
|
||||||
],
|
buildTableCell(
|
||||||
),
|
Text(
|
||||||
itemData: itemData),
|
'¥${double.parse('${itemData.unitPrice}')}',
|
||||||
// 规格
|
style: textStyle,
|
||||||
buildTableCell(
|
),
|
||||||
Text(itemData.product?.productSpecification ?? '',
|
itemData: itemData),
|
||||||
style: textStyle),
|
|
||||||
itemData: itemData),
|
|
||||||
// 单价
|
|
||||||
buildTableCell(
|
|
||||||
Text(
|
|
||||||
'¥${double.parse('${itemData.unitPrice}')}',
|
|
||||||
style: textStyle,
|
|
||||||
),
|
|
||||||
itemData: itemData),
|
|
||||||
|
|
||||||
// 库存数量
|
// 库存数量
|
||||||
buildTableCell(
|
buildTableCell(
|
||||||
Text(
|
Text(
|
||||||
'${itemData.quantity}${itemData.product?.unit?.label ?? ''}',
|
'${itemData.quantity}${itemData.product?.unit?.label ?? ''}',
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: textStyle),
|
style: textStyle),
|
||||||
itemData: itemData,
|
itemData: itemData,
|
||||||
alignment: Alignment.centerRight),
|
alignment: Alignment.centerRight),
|
||||||
]);
|
]);
|
||||||
}).toList()
|
}).toList()
|
||||||
])));
|
])));
|
||||||
}
|
|
||||||
|
|
||||||
Widget buildInventoryList1() {
|
|
||||||
final textStyle = TextStyle(fontSize: ScreenAdaper.sp(22));
|
|
||||||
return Obx(
|
|
||||||
() => SmartRefresher(
|
|
||||||
enablePullDown: true,
|
|
||||||
enablePullUp: true,
|
|
||||||
controller: controller.refreshController,
|
|
||||||
onLoading: controller.onLoading,
|
|
||||||
onRefresh: controller.onRefresh,
|
|
||||||
child: ListView.separated(
|
|
||||||
itemCount: controller.inventories.length,
|
|
||||||
separatorBuilder: (context, index) => const Divider(
|
|
||||||
height: 1,
|
|
||||||
color: AppTheme.dividerColor,
|
|
||||||
),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
final itemData = controller.inventories[index];
|
|
||||||
return InkWell(
|
|
||||||
onTap: () {
|
|
||||||
if (onInventorySelected != null)
|
|
||||||
onInventorySelected!(itemData);
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
padding:
|
|
||||||
EdgeInsets.symmetric(vertical: ScreenAdaper.height(10)),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
//最小宽度
|
|
||||||
constraints:
|
|
||||||
BoxConstraints(minWidth: ScreenAdaper.width(100)),
|
|
||||||
child: Text(
|
|
||||||
itemData.inventoryNumber!,
|
|
||||||
style: textStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: ScreenAdaper.width(10),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 8,
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'${itemData.product?.name}',
|
|
||||||
style: textStyle,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'${itemData.product?.company?.name}',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: ScreenAdaper.sp(15),
|
|
||||||
color: AppTheme.grey),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
SizedBox(
|
|
||||||
width: ScreenAdaper.width(10),
|
|
||||||
),
|
|
||||||
// 规格
|
|
||||||
Expanded(
|
|
||||||
child: Container(
|
|
||||||
constraints:
|
|
||||||
BoxConstraints(minWidth: ScreenAdaper.width(100)),
|
|
||||||
child: Text(
|
|
||||||
itemData.product?.productSpecification ?? '',
|
|
||||||
style: textStyle),
|
|
||||||
)),
|
|
||||||
SizedBox(
|
|
||||||
width: ScreenAdaper.width(10),
|
|
||||||
),
|
|
||||||
// 单价
|
|
||||||
Container(
|
|
||||||
constraints:
|
|
||||||
BoxConstraints(minWidth: ScreenAdaper.width(100)),
|
|
||||||
child: Text(
|
|
||||||
'¥${double.parse('${itemData.unitPrice}')}${double.parse('${itemData.unitPrice}')}${double.parse('${itemData.unitPrice}')}${double.parse('${itemData.unitPrice}')}',
|
|
||||||
style: textStyle),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: ScreenAdaper.width(10),
|
|
||||||
),
|
|
||||||
// 库存数量
|
|
||||||
Expanded(
|
|
||||||
child: Container(
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
constraints:
|
|
||||||
BoxConstraints(minWidth: ScreenAdaper.width(80)),
|
|
||||||
child: Text(
|
|
||||||
'${itemData.quantity}${itemData.quantity}${itemData.product?.unit?.label ?? ''}',
|
|
||||||
style: textStyle),
|
|
||||||
))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildTableCell(Widget child,
|
Widget buildTableCell(Widget child,
|
||||||
|
|
|
@ -358,37 +358,69 @@ class NewInventoryInout extends StatelessWidget {
|
||||||
vertical: ScreenAdaper.height(20),
|
vertical: ScreenAdaper.height(20),
|
||||||
horizontal: ScreenAdaper.width(20)),
|
horizontal: ScreenAdaper.width(20)),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Column(
|
child: Row(children: [
|
||||||
children: [
|
Expanded(
|
||||||
Text(
|
child: Column(
|
||||||
'*请拍照上传照片',
|
children: [
|
||||||
style: TextStyle(
|
Text(
|
||||||
fontSize: ScreenAdaper.sp(25),
|
'*产品照片',
|
||||||
color: AppTheme.secondPrimaryColor),
|
style: TextStyle(
|
||||||
),
|
fontSize: ScreenAdaper.sp(25),
|
||||||
SizedBox(
|
color: AppTheme.secondPrimaryColor),
|
||||||
height: ScreenAdaper.height(10),
|
),
|
||||||
),
|
SizedBox(
|
||||||
Obx(() => SingleChildScrollView(
|
height: ScreenAdaper.height(10),
|
||||||
controller: controller.uploadScrollController,
|
),
|
||||||
scrollDirection: Axis.horizontal,
|
Obx(() => SingleChildScrollView(
|
||||||
child: Row(
|
controller: controller.uploadScrollController,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
scrollDirection: Axis.horizontal,
|
||||||
children: [
|
child: Row(
|
||||||
...controller.uploadImgFilesPath
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
.map((String path) => builderImagePreview(path))
|
children: [
|
||||||
.toList(),
|
...controller.uploadProductImgFilesPath
|
||||||
buildImageUploader()
|
.map((String path) =>
|
||||||
],
|
builderImagePreview(path, 'product'))
|
||||||
),
|
.toList(),
|
||||||
)),
|
buildImageUploader('product')
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'*经办人自拍',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: ScreenAdaper.sp(25),
|
||||||
|
color: AppTheme.secondPrimaryColor),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: ScreenAdaper.height(10),
|
||||||
|
),
|
||||||
|
Obx(() => SingleChildScrollView(
|
||||||
|
controller: controller.uploadScrollController,
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
...controller.uploadAgentImgFilesPath
|
||||||
|
.map((String path) =>
|
||||||
|
builderImagePreview(path, 'agent'))
|
||||||
|
.toList(),
|
||||||
|
buildImageUploader('agent')
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
))
|
||||||
|
]),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 照片预览队列Item
|
/// 照片预览队列Item
|
||||||
Widget builderImagePreview(String path) {
|
Widget builderImagePreview(String path, String type) {
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
|
@ -417,7 +449,11 @@ class NewInventoryInout extends StatelessWidget {
|
||||||
right: ScreenAdaper.width(5),
|
right: ScreenAdaper.width(5),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
controller.uploadImgFilesPath.remove(path);
|
if (type == 'agent') {
|
||||||
|
controller.uploadAgentImgFilesPath.remove(path);
|
||||||
|
} else {
|
||||||
|
controller.uploadProductImgFilesPath.remove(path);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.close,
|
Icons.close,
|
||||||
|
@ -442,10 +478,10 @@ class NewInventoryInout extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上传照片控制器
|
// 上传照片控制器
|
||||||
Widget buildImageUploader() {
|
Widget buildImageUploader(String type) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
controller.photoPicker();
|
controller.photoPicker(type);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsets.symmetric(horizontal: ScreenAdaper.width(5)),
|
margin: EdgeInsets.symmetric(horizontal: ScreenAdaper.width(5)),
|
||||||
|
|
|
@ -43,7 +43,9 @@ class NewInventoryInoutController extends GetxController {
|
||||||
final agentTextController = TextEditingController();
|
final agentTextController = TextEditingController();
|
||||||
final remarkTextController = TextEditingController();
|
final remarkTextController = TextEditingController();
|
||||||
final positionTextController = TextEditingController();
|
final positionTextController = TextEditingController();
|
||||||
final uploadImgFilesPath = <String>[].obs;
|
final uploadProductImgFilesPath = <String>[].obs;
|
||||||
|
final uploadAgentImgFilesPath = <String>[].obs;
|
||||||
|
// final uploadImgFilesPath = <String>[].obs
|
||||||
final uploadScrollController = ScrollController();
|
final uploadScrollController = ScrollController();
|
||||||
Map<String, dynamic> payload = {};
|
Map<String, dynamic> payload = {};
|
||||||
NewInventoryInoutController({this.inOrOut});
|
NewInventoryInoutController({this.inOrOut});
|
||||||
|
@ -114,37 +116,49 @@ class NewInventoryInoutController extends GetxController {
|
||||||
/// 创建出入库记录
|
/// 创建出入库记录
|
||||||
Future<void> create() async {
|
Future<void> create() async {
|
||||||
if (payload['projectId'] == null) {
|
if (payload['projectId'] == null) {
|
||||||
SnackBarUtil().info(
|
SnackBarUtil().error(
|
||||||
'项目不能为空',
|
'项目不能为空',
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (payload['productId'] == null) {
|
if (payload['productId'] == null) {
|
||||||
SnackBarUtil().info(
|
SnackBarUtil().error(
|
||||||
'产品不能为空',
|
'产品不能为空',
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (payload['time'] == null) {
|
if (payload['time'] == null) {
|
||||||
SnackBarUtil().info(
|
SnackBarUtil().error(
|
||||||
'时间不能为空',
|
'时间不能为空',
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
payload['quantity'] = quantityTextController.text;
|
payload['quantity'] = quantityTextController.text;
|
||||||
if (payload['quantity'].isEmpty || payload['quantity'] == '0') {
|
if (payload['quantity'].isEmpty || payload['quantity'] == '0') {
|
||||||
SnackBarUtil().info(
|
SnackBarUtil().error(
|
||||||
'数量必须大于1',
|
'数量必须大于1',
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
payload['agent'] = agentTextController.text;
|
payload['agent'] = agentTextController.text;
|
||||||
if (payload['agent'].isEmpty) {
|
if (payload['agent'].isEmpty) {
|
||||||
SnackBarUtil().info(
|
SnackBarUtil().error(
|
||||||
'经办人不能为空',
|
'经办人不能为空',
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (uploadProductImgFilesPath.isEmpty) {
|
||||||
|
SnackBarUtil().error(
|
||||||
|
'请上传产品照片',
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (uploadAgentImgFilesPath.isEmpty) {
|
||||||
|
SnackBarUtil().error(
|
||||||
|
'请上传经办人照片',
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (unitPriceTextController.text.isEmpty) {
|
if (unitPriceTextController.text.isEmpty) {
|
||||||
payload.remove('unitPrice');
|
payload.remove('unitPrice');
|
||||||
} else {
|
} else {
|
||||||
|
@ -163,7 +177,10 @@ class NewInventoryInoutController extends GetxController {
|
||||||
try {
|
try {
|
||||||
// final recordId = res.data as int;
|
// final recordId = res.data as int;
|
||||||
// 批量同时上传
|
// 批量同时上传
|
||||||
final uploadRes = await Future.wait(uploadImgFilesPath
|
final uploadRes = await Future.wait([
|
||||||
|
...uploadProductImgFilesPath,
|
||||||
|
...uploadAgentImgFilesPath
|
||||||
|
]
|
||||||
.map((filePath) => MediaUtil().uploadImg(File(filePath),
|
.map((filePath) => MediaUtil().uploadImg(File(filePath),
|
||||||
bussinessModule: StorageBussinessModuleEnum.MaterialsInOut,
|
bussinessModule: StorageBussinessModuleEnum.MaterialsInOut,
|
||||||
bussinessRecordId: null))
|
bussinessRecordId: null))
|
||||||
|
@ -189,10 +206,15 @@ class NewInventoryInoutController extends GetxController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> photoPicker() async {
|
Future<void> photoPicker(String type) async {
|
||||||
XFile? pickedFile = await MediaUtil().getImageFromCamera();
|
XFile? pickedFile =
|
||||||
|
await MediaUtil().getImageFromCamera(isFront: type == 'agent');
|
||||||
if (pickedFile != null) {
|
if (pickedFile != null) {
|
||||||
uploadImgFilesPath.add(pickedFile.path);
|
if (type == 'product') {
|
||||||
|
uploadProductImgFilesPath.add(pickedFile.path);
|
||||||
|
} else {
|
||||||
|
uploadAgentImgFilesPath.add(pickedFile.path);
|
||||||
|
}
|
||||||
Future.delayed(const Duration(milliseconds: 100), () {
|
Future.delayed(const Duration(milliseconds: 100), () {
|
||||||
// 滚动到最右边
|
// 滚动到最右边
|
||||||
uploadScrollController.animateTo(
|
uploadScrollController.animateTo(
|
||||||
|
@ -283,17 +305,17 @@ class NewInventoryInoutController extends GetxController {
|
||||||
|
|
||||||
insertTask(BuildContext context) {
|
insertTask(BuildContext context) {
|
||||||
if (label.value.text.toString().isEmpty) {
|
if (label.value.text.toString().isEmpty) {
|
||||||
SnackBarUtil().warning(
|
// SnackBarUtil().error(
|
||||||
'Warning',
|
// 'Warning',
|
||||||
message: 'Enter valid label',
|
// message: 'Enter valid label',
|
||||||
);
|
// );
|
||||||
return;
|
// return;
|
||||||
}
|
}
|
||||||
if (category.value.text.toString().isEmpty) {
|
if (category.value.text.toString().isEmpty) {
|
||||||
SnackBarUtil().warning(
|
// SnackBarUtil().error(
|
||||||
'Warning',
|
// 'Warning',
|
||||||
message: 'Enter Correct Category',
|
// message: 'Enter Correct Category',
|
||||||
);
|
// );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (selectedDate.isEmpty) {
|
if (selectedDate.isEmpty) {
|
||||||
|
|
|
@ -1,49 +1,29 @@
|
||||||
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:sk_base_mobile/app_theme.dart';
|
import 'package:sk_base_mobile/app_theme.dart';
|
||||||
|
import 'package:sk_base_mobile/constants/router.dart';
|
||||||
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
||||||
|
import 'package:sk_base_mobile/util/snack_bar.util.dart';
|
||||||
|
|
||||||
class WorkBenchModel {
|
class WorkBenchModel {
|
||||||
final String title;
|
final String title;
|
||||||
final String icon;
|
|
||||||
final String route;
|
final String route;
|
||||||
WorkBenchModel(
|
WorkBenchModel({required this.title, required this.route});
|
||||||
{required this.title, required this.icon, required this.route});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class WorkBenchPage extends StatelessWidget {
|
class WorkBenchPage extends StatelessWidget {
|
||||||
WorkBenchPage({super.key});
|
WorkBenchPage({super.key});
|
||||||
List<WorkBenchModel> works = [
|
List<WorkBenchModel> works = [
|
||||||
WorkBenchModel(
|
WorkBenchModel(title: '库存', route: '/inventory'),
|
||||||
title: '产品管理',
|
WorkBenchModel(title: '产品', route: '/product'),
|
||||||
icon: 'assets/images/product_manage.png',
|
WorkBenchModel(title: '合同', route: '/contract'),
|
||||||
route: '/product'),
|
WorkBenchModel(title: '人事', route: '/personnel'),
|
||||||
WorkBenchModel(
|
WorkBenchModel(title: '公车', route: '/finance'),
|
||||||
title: '库存管理',
|
WorkBenchModel(title: '任务', route: '/task_manage'),
|
||||||
icon: 'assets/images/inventory_manage.png',
|
WorkBenchModel(title: '报表', route: '/report'),
|
||||||
route: '/inventory'),
|
|
||||||
WorkBenchModel(
|
|
||||||
title: '合同管理',
|
|
||||||
icon: 'assets/images/contract_manage.png',
|
|
||||||
route: '/contract'),
|
|
||||||
WorkBenchModel(
|
|
||||||
title: '人事管理',
|
|
||||||
icon: 'assets/images/hr_manage.png',
|
|
||||||
route: '/personnel'),
|
|
||||||
WorkBenchModel(
|
|
||||||
title: '公车管理',
|
|
||||||
icon: 'assets/images/vehicle_usage.png',
|
|
||||||
route: '/finance'),
|
|
||||||
WorkBenchModel(
|
|
||||||
title: '任务管理',
|
|
||||||
icon: 'assets/images/task_manage.png',
|
|
||||||
route: '/task_manage'),
|
|
||||||
WorkBenchModel(
|
|
||||||
title: '报表管理',
|
|
||||||
icon: 'assets/images/report_manage.png',
|
|
||||||
route: '/report'),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -78,42 +58,63 @@ class WorkBenchPage extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildCard(int index) {
|
Widget buildCard(int index) {
|
||||||
return Card(
|
return InkWell(
|
||||||
clipBehavior: Clip.antiAlias,
|
onTap: () {
|
||||||
shadowColor: AppTheme.black,
|
final route = RouteConfig.getPages
|
||||||
elevation: 10.0,
|
.map((e) => e.name)
|
||||||
shape: RoundedRectangleBorder(
|
.firstWhereOrNull((name) => name == works[index].route);
|
||||||
borderRadius: BorderRadius.circular(ScreenAdaper.width(20))),
|
if (route != null) {
|
||||||
child: Stack(
|
Get.toNamed(works[index].route);
|
||||||
children: [
|
} else {
|
||||||
Image.asset(works[index].icon),
|
SnackBarUtil().info('功能待开发。');
|
||||||
Center(
|
}
|
||||||
child: Stack(
|
},
|
||||||
alignment: Alignment.center,
|
child: Container(
|
||||||
children: [
|
clipBehavior: Clip.antiAlias,
|
||||||
Text(
|
decoration: BoxDecoration(
|
||||||
works[index].title,
|
borderRadius: BorderRadius.circular(10),
|
||||||
style: TextStyle(
|
gradient: LinearGradient(
|
||||||
letterSpacing: ScreenAdaper.width(5),
|
begin: Alignment.centerLeft,
|
||||||
fontSize: ScreenAdaper.sp(30),
|
end: Alignment.centerRight,
|
||||||
fontWeight: FontWeight.bold,
|
colors: [AppTheme.primaryColorLight, AppTheme.primaryColor]),
|
||||||
foreground: Paint()
|
boxShadow: [
|
||||||
..style = PaintingStyle.stroke
|
BoxShadow(
|
||||||
..strokeWidth = 5
|
color: AppTheme.black.withOpacity(0.5),
|
||||||
..color = Colors.black),
|
offset: Offset(0, 0),
|
||||||
|
blurRadius: 5,
|
||||||
|
spreadRadius: 2)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
// Image.asset(works[index].icon),
|
||||||
|
Center(
|
||||||
|
child: Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
works[index].title,
|
||||||
|
style: TextStyle(
|
||||||
|
letterSpacing: ScreenAdaper.width(5),
|
||||||
|
fontSize: ScreenAdaper.sp(40),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
foreground: Paint()
|
||||||
|
..style = PaintingStyle.stroke
|
||||||
|
..strokeWidth = 5
|
||||||
|
..color = Colors.black),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
works[index].title,
|
||||||
|
style: TextStyle(
|
||||||
|
letterSpacing: ScreenAdaper.width(5),
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: ScreenAdaper.sp(40),
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Text(
|
)
|
||||||
works[index].title,
|
],
|
||||||
style: TextStyle(
|
)));
|
||||||
letterSpacing: ScreenAdaper.width(5),
|
|
||||||
color: Colors.white,
|
|
||||||
fontSize: ScreenAdaper.sp(30),
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ class DioService extends Get.GetxService {
|
||||||
static DioService get to => Get.Get.find();
|
static DioService get to => Get.Get.find();
|
||||||
static Dio get dio => _dio;
|
static Dio get dio => _dio;
|
||||||
static late Dio _dio;
|
static late Dio _dio;
|
||||||
List<String> whiteList = [Urls.login, Urls.uploadAttachemnt];
|
List<String> whiteList = [Urls.login];
|
||||||
BaseOptions dioBaseOptions = BaseOptions(
|
BaseOptions dioBaseOptions = BaseOptions(
|
||||||
connectTimeout: const Duration(seconds: 20),
|
connectTimeout: const Duration(seconds: 20),
|
||||||
baseUrl: '${GloablConfig.BASE_URL}',
|
baseUrl: '${GloablConfig.BASE_URL}',
|
||||||
|
|
|
@ -10,15 +10,19 @@ import 'package:sk_base_mobile/services/service.dart';
|
||||||
|
|
||||||
class MediaUtil {
|
class MediaUtil {
|
||||||
//拍照
|
//拍照
|
||||||
Future<XFile?> getImageFromCamera({double? maxWidth}) async {
|
Future<XFile?> getImageFromCamera(
|
||||||
|
{double? maxWidth, bool isFront = false}) async {
|
||||||
XFile? pickedFile;
|
XFile? pickedFile;
|
||||||
try {
|
try {
|
||||||
if (AppInfoService.to.isCameraing.value) {
|
if (AppInfoService.to.isCameraing.value) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
AppInfoService.to.isCameraing.value = true;
|
AppInfoService.to.isCameraing.value = true;
|
||||||
pickedFile = await ImagePicker()
|
pickedFile = await ImagePicker().pickImage(
|
||||||
.pickImage(source: ImageSource.camera, maxWidth: maxWidth ?? 2000);
|
source: ImageSource.camera,
|
||||||
|
maxWidth: maxWidth ?? 2000,
|
||||||
|
preferredCameraDevice:
|
||||||
|
isFront ? CameraDevice.front : CameraDevice.rear);
|
||||||
AppInfoService.to.isCameraing.value = false;
|
AppInfoService.to.isCameraing.value = false;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
AppInfoService.to.isCameraing.value = false;
|
AppInfoService.to.isCameraing.value = false;
|
||||||
|
|
|
@ -68,7 +68,10 @@ class ModalUtil {
|
||||||
);
|
);
|
||||||
|
|
||||||
static Future<void> showGeneralDialog(
|
static Future<void> showGeneralDialog(
|
||||||
{required Widget content, double? width, double? height}) {
|
{required Widget content,
|
||||||
|
double? width,
|
||||||
|
double? height,
|
||||||
|
Offset? offset}) {
|
||||||
return Get.generalDialog(
|
return Get.generalDialog(
|
||||||
barrierLabel: "productPicker",
|
barrierLabel: "productPicker",
|
||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
|
@ -86,7 +89,7 @@ class ModalUtil {
|
||||||
},
|
},
|
||||||
transitionBuilder: (_, anim, __, child) {
|
transitionBuilder: (_, anim, __, child) {
|
||||||
Tween<Offset> tween;
|
Tween<Offset> tween;
|
||||||
tween = Tween(begin: const Offset(0, 1), end: Offset.zero);
|
tween = Tween(begin: offset ?? const Offset(0, 1), end: Offset.zero);
|
||||||
return SlideTransition(
|
return SlideTransition(
|
||||||
position: tween.animate(
|
position: tween.animate(
|
||||||
CurvedAnimation(parent: anim, curve: Curves.easeInOut),
|
CurvedAnimation(parent: anim, curve: Curves.easeInOut),
|
||||||
|
|
|
@ -29,8 +29,8 @@ class MyAvatarWidget extends StatelessWidget {
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: AppTheme.white, width: ScreenAdaper.sp(2)),
|
color: AppTheme.white, width: ScreenAdaper.sp(2)),
|
||||||
borderRadius: BorderRadius.circular(50)),
|
borderRadius: BorderRadius.circular(50)),
|
||||||
height: ScreenAdaper.width(90),
|
height: ScreenAdaper.width(120),
|
||||||
width: ScreenAdaper.width(90),
|
width: ScreenAdaper.width(120),
|
||||||
child: const SizedBox(),
|
child: const SizedBox(),
|
||||||
)),
|
)),
|
||||||
Positioned(
|
Positioned(
|
||||||
|
@ -42,7 +42,7 @@ class MyAvatarWidget extends StatelessWidget {
|
||||||
},
|
},
|
||||||
child: Image(
|
child: Image(
|
||||||
height: ScreenAdaper.width(40),
|
height: ScreenAdaper.width(40),
|
||||||
image: const AssetImage('assets/images/photo_icon.png'),
|
image: const AssetImage('assets/images/company_logo.png'),
|
||||||
)))
|
)))
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|