添加新增物品页面

hmxc
小赖 4 years ago
parent 88148a5227
commit 5d5147ea0b

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

@ -0,0 +1,32 @@
import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/mock_models/borrow/borrow_model.dart';
class BorrowData {
static List<BorrowModel> models = [
BorrowModel(
borrowPerson: '李慧珍',
borrowTime: null,
goodsStatus: null,
phone: null,
borrowGoods: SingleBorrowGoods(name: ''),
),
];
static List<BorrowObject> borrowObjects = [
BorrowObject.init(
name: '电钻',
assetPath: R.ASSETS_STATIC_TEMP_DRILL_PNG,
allNumber: 5,
),
BorrowObject.init(
name: '梯子',
assetPath: R.ASSETS_STATIC_TEMP_LADDER_PNG,
allNumber: 3,
),
BorrowObject.init(
name: '三角榔头',
assetPath: R.ASSETS_STATIC_TEMP_HAMMER_PNG,
allNumber: 8,
),
];
}

@ -0,0 +1,78 @@
import 'dart:math';
import 'package:meta/meta.dart';
enum BORROW_STATUS {
///
BORROWING,
///
WAIT_CHECK,
///
NOT_BORROW,
///
DONE,
}
enum GOODS_STATUS {
NORMAL,
BROKEN,
}
class BorrowModel {
String borrowPerson;
String phone;
int borrowTime;
GOODS_STATUS goodsStatus;
String title;
SingleBorrowGoods borrowGoods;
BorrowModel({
@required this.borrowPerson,
@required this.phone,
@required this.borrowTime,
@required this.goodsStatus,
@required this.borrowGoods,
});
}
class BorrowObject {
String name;
int allNumber;
dynamic assetPath;
int borrowNumber;
int get restNumber => allNumber - borrowNumber;
List<SingleBorrowGoods> items;
BorrowObject.init({
this.name,
this.allNumber,
this.assetPath,
}) {
this.borrowNumber = 0;
items = List.generate(
this.allNumber,
(index) => SingleBorrowGoods(
name: '${this.name}${index + 1}',
code: (179264234 + Random().nextInt(999999)).toString(),
status: BORROW_STATUS.NOT_BORROW,
assetpath: this.assetPath,
),
);
}
}
class SingleBorrowGoods {
String name;
String code;
dynamic assetpath;
BORROW_STATUS status;
SingleBorrowGoods({
this.name,
this.code,
this.assetpath,
this.status,
});
}

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
export 'package:flutter_screenutil/flutter_screenutil.dart'; export 'package:flutter_screenutil/flutter_screenutil.dart';
export 'package:aku_community_manager/const/resource.dart';
class AppStyle { class AppStyle {
// //

@ -1,6 +1,7 @@
import 'package:aku_community_manager/ui/manage_pages/green_manage/green_manage_page.dart'; import 'package:aku_community_manager/ui/manage_pages/green_manage/green_manage_page.dart';
import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_manage_page.dart'; import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_manage_page.dart';
import 'package:aku_community_manager/ui/sub_pages/activity_manager/activity_manager_page.dart'; import 'package:aku_community_manager/ui/sub_pages/activity_manager/activity_manager_page.dart';
import 'package:aku_community_manager/ui/sub_pages/borrow_manager/borrow_manager_page.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_page.dart'; import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_page.dart';
import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_manager_page.dart'; import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_manager_page.dart';
import 'package:aku_community_manager/ui/sub_pages/items_outdoor/items_outdoor_page.dart'; import 'package:aku_community_manager/ui/sub_pages/items_outdoor/items_outdoor_page.dart';
@ -46,7 +47,7 @@ class _ApplicationPageState extends State<ApplicationPage>
AppApplication( AppApplication(
'活动管理', R.ASSETS_HOME_IC_ACTIVITY_PNG, ActivityManagerPage()), '活动管理', R.ASSETS_HOME_IC_ACTIVITY_PNG, ActivityManagerPage()),
AppApplication('访客管理', R.ASSETS_HOME_IC_VISITORS_PNG, VisitorManagerPage()), AppApplication('访客管理', R.ASSETS_HOME_IC_VISITORS_PNG, VisitorManagerPage()),
AppApplication('借还管理', R.ASSETS_HOME_IC_BORROW_PNG, Scaffold()), AppApplication('借还管理', R.ASSETS_HOME_IC_BORROW_PNG, BorrowManagerPage()),
AppApplication('一键报警', R.ASSETS_HOME_IC_POLICE_PNG, Scaffold()), AppApplication('一键报警', R.ASSETS_HOME_IC_POLICE_PNG, Scaffold()),
]; ];
List<AppApplication> _wisdomApplications = [ List<AppApplication> _wisdomApplications = [
@ -58,7 +59,7 @@ class _ApplicationPageState extends State<ApplicationPage>
'装修管理', R.ASSETS_HOME_IC_DECORATION_PNG, DecorationManagerPage()), '装修管理', R.ASSETS_HOME_IC_DECORATION_PNG, DecorationManagerPage()),
AppApplication( AppApplication(
'活动管理', R.ASSETS_HOME_IC_ACTIVITY_PNG, ActivityManagerPage()), '活动管理', R.ASSETS_HOME_IC_ACTIVITY_PNG, ActivityManagerPage()),
AppApplication('借还管理', R.ASSETS_HOME_IC_BORROW_PNG, Scaffold()), AppApplication('借还管理', R.ASSETS_HOME_IC_BORROW_PNG, BorrowManagerPage()),
AppApplication('巡检管理', R.ASSETS_HOME_IC_PATROL_PNG, InspectionManagePage()), AppApplication('巡检管理', R.ASSETS_HOME_IC_PATROL_PNG, InspectionManagePage()),
AppApplication('绿化管理', R.ASSETS_HOME_IC_GREENING_PNG, GreenManagePage()), AppApplication('绿化管理', R.ASSETS_HOME_IC_GREENING_PNG, GreenManagePage()),
]; ];

@ -0,0 +1,174 @@
import 'dart:io';
import 'dart:math';
import 'package:aku_community_manager/mock_models/borrow/borrow_model.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/pick_image.dart';
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
class AddBorrowItemPage extends StatefulWidget {
final BorrowObject object;
AddBorrowItemPage({Key key, @required this.object}) : super(key: key);
@override
_AddBorrowItemPageState createState() => _AddBorrowItemPageState();
}
class _AddBorrowItemPageState extends State<AddBorrowItemPage> {
TextEditingController _textEditingController = TextEditingController();
String code = '';
File file;
@override
void initState() {
super.initState();
code = (10000000 + Random().nextInt(999999)).toString();
}
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '物品详情',
actions: [
AkuMaterialButton(
minWidth: 120.w,
onPressed: () {
if (TextUtil.isEmpty(_textEditingController.text)) {
BotToast.showText(text: '名称不能为空');
} else if (file == null) {
BotToast.showText(text: '图片不能为空');
} else {
widget.object.items.insert(
0,
SingleBorrowGoods(
name: _textEditingController.text,
code: code,
assetpath: file,
status: BORROW_STATUS.NOT_BORROW,
));
}
},
child: Text(
'完成',
style: TextStyle(
fontSize: 28.w,
color: AppStyle.primaryTextColor,
),
),
),
],
body: ListView(
padding: EdgeInsets.symmetric(vertical: 16.w),
children: [
Container(
color: Colors.white,
padding: EdgeInsets.symmetric(horizontal: 32.w),
child: Column(
children: [
_buildRow(
'物品名称',
TextField(
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.sp,
fontWeight: FontWeight.bold,
),
controller: _textEditingController,
decoration: InputDecoration(
border: InputBorder.none,
hintText: '请输入物品名称',
),
)),
Divider(height: 1.w),
_buildRow(
'物品单号',
Text(
code,
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 28.sp,
fontWeight: FontWeight.bold,
),
)),
_buildRow(
'物品图片',
file == null
? InkWell(
onTap: () {
akuPickImage().then((value) {
if (value != null) file = value;
setState(() {});
});
},
child: Container(
height: 184.w,
width: 184.w,
alignment: Alignment.center,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.image,
size: 60.w,
color: AppStyle.minorTextColor,
),
Text(
'上传图片',
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 22.sp,
),
),
],
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
border: Border.all(
width: 1.w,
color: AppStyle.minorTextColor,
),
),
),
)
: Image.file(
file,
height: 184.w,
width: 184.w,
fit: BoxFit.cover,
),
),
AkuBox.h(28),
],
),
),
],
),
);
}
_buildRow(String title, Widget child) {
return Row(
children: [
AkuBox.h(96),
Text(
title,
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 28.w,
),
),
AkuBox.w(80),
Expanded(
child: Align(
alignment: Alignment.centerLeft,
child: child,
),
),
],
);
}
}

@ -0,0 +1,185 @@
import 'dart:io';
import 'package:aku_community_manager/mock_models/borrow/borrow_data.dart';
import 'package:aku_community_manager/mock_models/borrow/borrow_model.dart';
import 'package:aku_community_manager/mock_models/users/user_info_model.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/pick_image.dart';
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
class AddBorrowObjectPage extends StatefulWidget {
AddBorrowObjectPage({Key key}) : super(key: key);
@override
_AddBorrowObjectPageState createState() => _AddBorrowObjectPageState();
}
class _AddBorrowObjectPageState extends State<AddBorrowObjectPage> {
TextEditingController _textEditingController = TextEditingController();
TextEditingController _numberController = TextEditingController();
File file;
List<BorrowObject> get objects => BorrowData.borrowObjects;
@override
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context);
return AkuScaffold(
title: '物品详情',
actions: [
userProvider.userInfoModel.role != USER_ROLE.MANAGER
? AkuMaterialButton(
minWidth: 120.w,
onPressed: () {
if (TextUtil.isEmpty(_textEditingController.text)) {
BotToast.showText(text: '名称不能为空');
} else if (file == null) {
BotToast.showText(text: '图片不能为空');
} else if (int.tryParse(_numberController.text) == null) {
BotToast.showText(text: '数量错误');
} else {
objects.insert(
0,
BorrowObject.init(
name: _textEditingController.text,
allNumber: int.parse(_numberController.text),
assetPath: file,
),
);
Get.back();
}
},
child: Text(
'完成',
style: TextStyle(
fontSize: 28.w,
color: AppStyle.primaryTextColor,
),
),
)
: SizedBox(),
],
body: ListView(
padding: EdgeInsets.symmetric(vertical: 16.w),
children: [
Container(
color: Colors.white,
padding: EdgeInsets.symmetric(horizontal: 32.w),
child: Column(
children: [
_buildRow(
'总类名称',
TextField(
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.sp,
fontWeight: FontWeight.bold,
),
controller: _textEditingController,
decoration: InputDecoration(
border: InputBorder.none,
hintText: '请输入总类名称',
),
)),
Divider(height: 1.w),
_buildRow(
'物品数量',
TextField(
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.sp,
fontWeight: FontWeight.bold,
),
controller: _numberController,
decoration: InputDecoration(
border: InputBorder.none,
hintText: '请输入物品数量',
),
)),
Divider(height: 1.w),
AkuBox.h(24),
_buildRow(
'物品图片',
file == null
? InkWell(
onTap: () {
akuPickImage().then((value) {
if (value != null) file = value;
setState(() {});
});
},
child: Container(
height: 184.w,
width: 184.w,
alignment: Alignment.center,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.image,
size: 60.w,
color: AppStyle.minorTextColor,
),
Text(
'上传图片',
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 22.sp,
),
),
],
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
border: Border.all(
width: 1.w,
color: AppStyle.minorTextColor,
),
),
),
)
: Image.file(
file,
height: 184.w,
width: 184.w,
fit: BoxFit.cover,
),
),
AkuBox.h(28),
],
),
),
],
),
);
}
_buildRow(String title, Widget child) {
return Row(
children: [
AkuBox.h(96),
Text(
title,
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 28.w,
),
),
AkuBox.w(80),
Expanded(
child: Align(
alignment: Alignment.centerLeft,
child: child,
),
),
],
);
}
}

@ -0,0 +1,124 @@
import 'package:aku_community_manager/mock_models/borrow/borrow_data.dart';
import 'package:aku_community_manager/mock_models/borrow/borrow_model.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/sub_pages/borrow_manager/add_borrow_object_page.dart';
import 'package:aku_community_manager/ui/sub_pages/borrow_manager/borrow_items_page.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:aku_community_manager/const/resource.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class AllBorrowGoods extends StatefulWidget {
AllBorrowGoods({Key key}) : super(key: key);
@override
_AllBorrowGoodsState createState() => _AllBorrowGoodsState();
}
class _AllBorrowGoodsState extends State<AllBorrowGoods> {
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '全部物品',
actions: [
AkuMaterialButton(
minWidth: 120.w,
onPressed: () {
Get.to(AddBorrowObjectPage());
},
child: Text(
'新增',
style: TextStyle(
fontSize: 28.w,
color: AppStyle.primaryTextColor,
),
),
),
],
body: ListView.builder(
padding: EdgeInsets.symmetric(
horizontal: 32.w,
),
itemBuilder: (context, index) {
return _buildCard(BorrowData.borrowObjects[index]);
},
itemCount: BorrowData.borrowObjects.length,
),
);
}
_buildCard(BorrowObject object) {
return GestureDetector(
onTap: () => Get.to(BorrowItemPage(object: object)),
child: Container(
padding: EdgeInsets.all(24.w),
margin: EdgeInsets.only(top: 16.w),
child: Row(
children: [
ClipRRect(
borderRadius: BorderRadius.circular(4.w),
child: (object.assetPath is String)
? Image.asset(
object.assetPath,
width: 184.w,
height: 184.w,
fit: BoxFit.cover,
)
: Image.file(
object.assetPath,
width: 184.w,
height: 184.w,
fit: BoxFit.cover,
),
),
AkuBox.w(24),
Expanded(
child: Column(
children: [
_buildRow(R.ASSETS_MANAGE_ARTICLE_PNG, '物品名称', object.name),
AkuBox.h(12),
_buildRow(R.ASSETS_MANAGE_BORROW_PNG, '借出数量',
object.borrowNumber.toString()),
AkuBox.h(12),
_buildRow(R.ASSETS_MANAGE_REMAINING_PNG, '剩余数量',
object.items.length.toString()),
],
)),
],
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Colors.white,
),
),
);
}
_buildRow(String assetPath, String title, String subTitle) {
return Row(
children: [
Image.asset(
assetPath,
height: 40.w,
width: 40.w,
),
Text(
'$title\:',
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 28.w,
),
),
Text(
subTitle,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.w,
),
),
],
);
}
}

@ -0,0 +1,148 @@
import 'package:aku_community_manager/mock_models/borrow/borrow_model.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:flutter/material.dart';
class BorrowItemDetailPage extends StatefulWidget {
final SingleBorrowGoods item;
BorrowItemDetailPage({Key key, this.item}) : super(key: key);
@override
_BorrowItemDetailPageState createState() => _BorrowItemDetailPageState();
}
class _BorrowItemDetailPageState extends State<BorrowItemDetailPage> {
bool _isEditing = false;
TextEditingController _textEditingController;
@override
void initState() {
super.initState();
_textEditingController = TextEditingController(text: widget.item.name);
}
@override
void dispose() {
_textEditingController?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '物品详情',
actions: [
AkuMaterialButton(
minWidth: 120.w,
onPressed: () {
setState(() {
_isEditing = !_isEditing;
});
},
child: Text(
_isEditing ? '完成' : '编辑',
style: TextStyle(
fontSize: 28.w,
color: AppStyle.primaryTextColor,
),
),
),
],
body: ListView(
padding: EdgeInsets.symmetric(vertical: 16.w),
children: [
Container(
color: Colors.white,
padding: EdgeInsets.symmetric(horizontal: 32.w),
child: Column(
children: [
_buildRow(
'物品名称',
TextField(
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.sp,
fontWeight: FontWeight.bold,
),
controller: _textEditingController,
enabled: _isEditing,
onChanged: (text) {
widget.item.name = text;
},
decoration: InputDecoration(
border: InputBorder.none,
),
)),
Divider(height: 1.w),
_buildRow(
'物品单号',
Text(
widget.item.code,
style: TextStyle(
color: _isEditing
? AppStyle.minorTextColor
: AppStyle.primaryTextColor,
fontSize: 28.sp,
fontWeight: FontWeight.bold,
),
)),
_buildRow(
'出借状态',
Text(
'未出借',
style: TextStyle(
color: _isEditing
? AppStyle.minorTextColor
: AppStyle.primaryTextColor,
fontSize: 28.sp,
fontWeight: FontWeight.bold,
),
)),
_buildRow(
'物品图片',
(widget.item.assetpath is String)
? Image.asset(
widget.item.assetpath,
height: 184.w,
width: 184.w,
fit: BoxFit.cover,
)
: Image.file(
widget.item.assetpath,
height: 184.w,
width: 184.w,
fit: BoxFit.cover,
),
),
AkuBox.h(28),
],
),
),
],
),
);
}
_buildRow(String title, Widget child) {
return Row(
children: [
AkuBox.h(96),
Text(
title,
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 28.w,
),
),
AkuBox.w(80),
Expanded(
child: Align(
alignment: Alignment.centerLeft,
child: child,
),
),
],
);
}
}

@ -0,0 +1,211 @@
import 'package:aku_community_manager/mock_models/borrow/borrow_model.dart';
import 'package:aku_community_manager/mock_models/users/user_info_model.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/sub_pages/borrow_manager/add_borrow_item_page.dart';
import 'package:aku_community_manager/ui/sub_pages/borrow_manager/borrow_item_detail_page.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
class BorrowItemPage extends StatefulWidget {
final BorrowObject object;
BorrowItemPage({Key key, @required this.object}) : super(key: key);
@override
_BorrowItemPageState createState() => _BorrowItemPageState();
}
class _BorrowItemPageState extends State<BorrowItemPage> {
@override
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context);
return AkuScaffold(
title: '物品查看',
actions: [
userProvider.userInfoModel.role != USER_ROLE.MANAGER
? AkuMaterialButton(
minWidth: 120.w,
onPressed: () {
Get.to(AddBorrowItemPage(object: widget.object));
},
child: Text(
'新增',
style: TextStyle(
fontSize: 28.w,
color: AppStyle.primaryTextColor,
),
),
)
: SizedBox(),
],
body: ListView.builder(
padding: EdgeInsets.symmetric(horizontal: 32.w),
itemBuilder: (context, index) {
return _buildCard(widget.object.items[index]);
},
itemCount: widget.object.items.length,
),
);
}
_buildCard(SingleBorrowGoods item) {
final userProvider = Provider.of<UserProvider>(context);
return GestureDetector(
onTap: () {
Get.to(BorrowItemDetailPage(item: item));
},
child: Container(
margin: EdgeInsets.only(top: 16.w),
child: Column(
children: [
Row(
children: [
AkuBox.h(93),
AkuBox.w(24),
Text(
item.name,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontWeight: FontWeight.bold,
fontSize: 32.sp,
),
),
Spacer(),
userProvider.userInfoModel.role != USER_ROLE.MANAGER
? AkuMaterialButton(
padding: EdgeInsets.symmetric(horizontal: 24.w),
onPressed: () {
showCupertinoDialog(
context: context,
builder: (context) {
return CupertinoAlertDialog(
title: Text('删除物品'),
content: Text('确定要删除${item.name}该物品吗?'),
actions: [
CupertinoDialogAction(
child: Text('取消'),
onPressed: () {
Get.back();
},
),
CupertinoDialogAction(
child: Text('删除'),
onPressed: () {
widget.object.items.remove(item);
setState(() {});
Get.back();
},
),
],
);
},
);
},
child: Row(
children: [
Icon(
Icons.delete,
color: AppStyle.minorTextColor,
size: 40.w,
),
Text(
'删除',
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 28.sp,
),
),
],
),
)
: SizedBox(),
],
),
Divider(
height: 1.w,
),
AkuBox.h(28),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AkuBox.w(24),
ClipRRect(
borderRadius: BorderRadius.circular(4.w),
child: (item.assetpath is String)
? Image.asset(
item.assetpath,
height: 184.w,
width: 184.w,
fit: BoxFit.cover,
)
: Image.file(
item.assetpath,
height: 184.w,
width: 184.w,
fit: BoxFit.cover,
),
),
AkuBox.w(24),
Expanded(
child: Column(
children: [
_buildRow(
R.ASSETS_MANAGE_IC_RENWU_PNG, '物品单号', item.code),
_buildRow(
R.ASSETS_MANAGE_BORROW_PNG,
'出借状态',
'未借出',
color: AppStyle.secondaryColor,
),
],
),
),
],
),
AkuBox.h(32),
],
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.w),
),
),
);
}
_buildRow(
String assetPath,
String title,
String subTitle, {
Color color = AppStyle.primaryTextColor,
}) {
return Row(
children: [
Image.asset(
assetPath,
height: 40.w,
width: 40.w,
),
Text(
'$title\:',
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 28.w,
),
),
Text(
subTitle,
style: TextStyle(
color: color,
fontSize: 28.w,
),
),
],
);
}
}

@ -0,0 +1,45 @@
import 'package:aku_community_manager/mock_models/borrow/borrow_data.dart';
import 'package:aku_community_manager/mock_models/borrow/borrow_model.dart';
import 'package:aku_community_manager/mock_models/users/user_info_model.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/ui/sub_pages/borrow_manager/all_borrow_goods.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
class BorrowManagerPage extends StatefulWidget {
BorrowManagerPage({Key key}) : super(key: key);
@override
_BorrowManagerPageState createState() => _BorrowManagerPageState();
}
class _BorrowManagerPageState extends State<BorrowManagerPage> {
@override
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context);
return AkuScaffold(
title: '物品清单',
actions: [
userProvider.userInfoModel.role != USER_ROLE.MANAGER
? AkuMaterialButton(
minWidth: 178.w,
onPressed: () {
Get.to(AllBorrowGoods());
},
child: Text(
'全部物品',
style: TextStyle(
fontSize: 28.w,
color: AppStyle.primaryTextColor,
),
),
)
: SizedBox(),
],
);
}
}

@ -6,7 +6,7 @@ import 'package:aku_community_manager/tools/screen_tool.dart';
class AkuScaffold extends StatefulWidget { class AkuScaffold extends StatefulWidget {
///AppBar 使 `title`,`titleStyle`,`leading`, ///AppBar 使 `title`,`titleStyle`,`leading`,
///`brightness`,`appBarColor`,`` ///`brightness`,`appBarColor`,`actions`
final PreferredSizeWidget appBar; final PreferredSizeWidget appBar;
///title ///title
@ -45,6 +45,8 @@ class AkuScaffold extends StatefulWidget {
final Color appBarColor; final Color appBarColor;
final List<Widget> actions;
final PreferredSizeWidget appBarBottom; final PreferredSizeWidget appBarBottom;
AkuScaffold({ AkuScaffold({
Key key, Key key,
@ -58,6 +60,7 @@ class AkuScaffold extends StatefulWidget {
this.bottom, this.bottom,
this.appBarColor = Colors.white, this.appBarColor = Colors.white,
this.appBarBottom, this.appBarBottom,
this.actions = const [],
}) : super(key: key); }) : super(key: key);
@override @override
@ -86,6 +89,7 @@ class _AkuScaffoldState extends State<AkuScaffold> {
child: Text(widget.title ?? ''), child: Text(widget.title ?? ''),
), ),
bottom: widget.appBarBottom, bottom: widget.appBarBottom,
actions: widget.actions,
), ),
body: widget.body, body: widget.body,
bottomNavigationBar: widget.bottom, bottomNavigationBar: widget.bottom,

Loading…
Cancel
Save