添加钥匙管理

对接钥匙管理接口
hmxc
张萌 4 years ago
parent 152c8ed209
commit 410bc98018

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -6,8 +6,8 @@ class PackageManageListModel {
String address; String address;
String placePosition; String placePosition;
int status; int status;
DateTime receiveDate; String receiveDate;
DateTime createDate; String createDate;
PackageManageListModel( PackageManageListModel(
{this.id, {this.id,

@ -1,5 +1,6 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/models/manager/facilities/facilities_page.dart'; import 'package:aku_community_manager/models/manager/facilities/facilities_page.dart';
import 'package:aku_community_manager/ui/manage_pages/key_manage/key_manage_page.dart';
import 'package:aku_community_manager/ui/manage_pages/packages_manage/packages_manage_page.dart'; import 'package:aku_community_manager/ui/manage_pages/packages_manage/packages_manage_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -70,7 +71,8 @@ class _ApplicationPageState extends State<ApplicationPage>
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()),
AppApplication('设施检查', R.ASSETS_HOME_IC_FACILITIES_PNG, FacilitiesPage()), AppApplication('设施检查', R.ASSETS_HOME_IC_FACILITIES_PNG, FacilitiesPage()),
AppApplication('包裹管理', R.ASSETS_PLACEHOLDER_WEBP, PackagesManagePage()) AppApplication('包裹管理', R.ASSETS_PLACEHOLDER_WEBP, PackagesManagePage()),
AppApplication('钥匙管理', R.ASSETS_PLACEHOLDER_WEBP, KeyManagePage())
]; ];
@override @override

@ -181,7 +181,7 @@ class _HomePageState extends State<HomePage> {
final userProvider = Provider.of<UserProvider>(context); final userProvider = Provider.of<UserProvider>(context);
final appProvider = Provider.of<AppProvider>(context); final appProvider = Provider.of<AppProvider>(context);
var loadingWidget = Center( var loadingWidget = Center(
child: CircularProgressIndicator(), // child: CircularProgressIndicator(),
); );
return AnnotatedRegion<SystemUiOverlayStyle>( return AnnotatedRegion<SystemUiOverlayStyle>(
child: Scaffold( child: Scaffold(

@ -0,0 +1,127 @@
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/aku_divider.dart';
import 'package:aku_community_manager/ui/manage_pages/key_manage/key_manage_map.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community_manager/tools/extensions/list_extension_tool.dart';
class KeyManageCard extends StatefulWidget {
final int index;
KeyManageCard({Key key, this.index}) : super(key: key);
@override
_KeyManageCardState createState() => _KeyManageCardState();
}
class _KeyManageCardState extends State<KeyManageCard> {
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(8.w)),
padding: EdgeInsets.all(24.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
'3-1-203配电箱'
.text
.size(32.sp)
.color(kTextPrimaryColor)
.bold
.make(),
Spacer(),
KeyManageMap.keyStatus[1].text
.size(28.sp)
.bold
.color(KeyManageMap.keyStatusColor[1])
.make()
],
),
16.w.heightBox,
AkuDivider.horizontal(),
24.w.heightBox,
...<Widget>[
_rowTile(R.ASSETS_MANAGE_KEY_PNG, '可申请钥匙数/钥匙总数',
'2/5'.text.size(24.sp).color(kTextSubColor).make()),
_rowTile(R.ASSETS_MANAGE_LOCK_PNG, '对应设备位置',
'2栋1楼2-3'.text.size(24.sp).color(kTextSubColor).make()),
_rowTile(R.ASSETS_OUTDOOR_IC_ADDRESS_PNG, '存放地址',
'物业管理处2号柜'.text.size(24.sp).color(kTextSubColor).make())
].sepWidget(separate: 12.w.heightBox),
_getBottomButtons(1),
],
),
);
}
Widget _getBottomButtons(int status) {
MaterialButton button;
switch (status) {
case 1:
button = _bottomButton('申请钥匙', () {}, Color(0xFFFFC40C), Colors.black);
break;
case 2:
break;
case 3:
button = _bottomButton('确认领取', () {}, Color(0xFFFFC40C), Colors.black);
break;
case 4:
button = _bottomButton('归还钥匙', () {}, Colors.black, Colors.white);
break;
case 5:
button = _bottomButton('重新提交', () {}, Colors.white, Colors.black);
break;
case 6:
button = _bottomButton('联系物业', () {}, Colors.white, Colors.black);
break;
default:
}
return button == null
? SizedBox()
: Padding(
padding: EdgeInsets.only(top: 40.w),
child: Row(
children: [
Spacer(),
button,
],
),
);
}
Widget _bottomButton(
String title, Function onPressed, Color color, Color textColor) {
return MaterialButton(
height: 52.w,
padding: EdgeInsets.symmetric(vertical: 8.w, horizontal: 24.w),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(74.w)),
color: color,
onPressed: onPressed,
elevation: 0,
focusElevation: 0,
hoverElevation: 0,
highlightElevation: 0,
child: title.text.size(26.sp).color(textColor).make(),
);
}
Widget _rowTile(String iconPath, String title, Widget content) {
return Row(
children: [
SizedBox(
width: 40.w,
height: 40.w,
child: Image.asset(iconPath),
),
12.w.widthBox,
title.text.size(24.sp).color(kTextSubColor).make(),
Spacer(),
content,
],
);
}
}

@ -0,0 +1,21 @@
import 'package:flutter/material.dart';
class KeyManageMap {
static Map<int, String> keyStatus = {
1: '可申请',
2: '审核中',
3: '已通过',
4: '使用中',
5: '已驳回',
6: '钥匙已空'
};
static Map<int, Color> keyStatusColor = {
1: Color(0xFF2576E5),
2: Color(0xFFFFC40C),
3: Color(0xFF333333),
4: Color(0xFFFFC40C),
5: Color(0xFFE60E0E),
6: Color(0xFF999999),
};
}

@ -0,0 +1,62 @@
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/ui/manage_pages/key_manage/key_manage_view.dart';
import 'package:aku_community_manager/ui/manage_pages/packages_manage/add_package_page.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_bottom_button.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class KeyManagePage extends StatefulWidget {
KeyManagePage({Key key}) : super(key: key);
@override
_KeyManagePageState createState() => _KeyManagePageState();
}
class _KeyManagePageState extends State<KeyManagePage>
with TickerProviderStateMixin {
List<String> _tabs = ['钥匙列表', '未归还钥匙'];
TabController _tabController;
@override
void initState() {
super.initState();
_tabController = TabController(length: _tabs.length, vsync: this);
}
@override
void dispose() {
_tabController?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '钥匙管理',
actions: [
InkWell(
onTap: () {
Get.to(() => AddPackagePage());
},
child: '申请记录'.text.size(26.sp).color(kTextPrimaryColor).make(),
),
],
appBarBottom: PreferredSize(
child: AkuTabBar(controller: _tabController, tabs: _tabs),
preferredSize: Size.fromHeight(88.w),
),
body: TabBarView(
controller: _tabController,
children: List.generate(
_tabs.length,
(index) => KeyManageView(
index: index,
)),
),
bottom: AkuBottomButton(title: '立即申请'),
);
}
}

@ -0,0 +1,25 @@
import 'package:aku_community_manager/ui/manage_pages/key_manage/key_manage_card.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class KeyManageView extends StatefulWidget {
final int index;
KeyManageView({Key key, this.index}) : super(key: key);
@override
_KeyManageViewState createState() => _KeyManageViewState();
}
class _KeyManageViewState extends State<KeyManageView> {
@override
Widget build(BuildContext context) {
return ListView(
padding: EdgeInsets.all(32.w),
children: [
KeyManageCard(
index: widget.index,
)
],
);
}
}

@ -1,6 +1,7 @@
import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_bottom_button.dart';
import 'package:aku_community_manager/utils/network/base_model.dart'; import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/net_util.dart'; import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
@ -100,23 +101,7 @@ class _AddPackagePageState extends State<AddPackagePage> {
), ),
), ),
), ),
bottom: _bottomButton(), bottom: AkuBottomButton(title: '确认提交',onTap: () async {
);
}
Widget _bottomButton() {
return Padding(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
child: MaterialButton(
minWidth: double.infinity,
height: 86.w,
color: kPrimaryColor,
elevation: 0,
focusElevation: 0,
hoverElevation: 0,
highlightElevation: 0,
padding: EdgeInsets.symmetric(vertical: 24.w),
onPressed: () async {
canSubmit canSubmit
? await addPackage( ? await addPackage(
code: _codeController.text, code: _codeController.text,
@ -125,12 +110,11 @@ class _AddPackagePageState extends State<AddPackagePage> {
address: _addressController.text, address: _addressController.text,
placePosition: _placeController.text) placePosition: _placeController.text)
: null; : null;
}, },),
child: '确认提交'.text.size(32.sp).color(kTextPrimaryColor).bold.make(),
),
); );
} }
Future addPackage( Future addPackage(
{@required String code, {@required String code,
@required String addresseeName, @required String addresseeName,

@ -81,7 +81,7 @@ class _PackageManageCardState extends State<PackageManageCard> {
_rowTile( _rowTile(
R.ASSETS_MANAGE_IC_TIME_PNG, R.ASSETS_MANAGE_IC_TIME_PNG,
'送达时间', '送达时间',
DateUtil.formatDate(widget.model.createDate, DateUtil.formatDateStr(widget.model.createDate,
format: 'yyyy-MM-dd HH:mm') format: 'yyyy-MM-dd HH:mm')
.text .text
.size(24.sp) .size(24.sp)

@ -25,6 +25,12 @@ class _PackagesManagePageState extends State<PackagesManagePage>
_tabController = TabController(length: _tabs.length, vsync: this); _tabController = TabController(length: _tabs.length, vsync: this);
} }
@override
void dispose() {
_tabController?.dispose();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AkuScaffold( return AkuScaffold(
@ -36,8 +42,8 @@ class _PackagesManagePageState extends State<PackagesManagePage>
height: 40.w, height: 40.w,
child: Image.asset(R.ASSETS_MANAGE_ADD_PNG), child: Image.asset(R.ASSETS_MANAGE_ADD_PNG),
), ),
onPressed: () { onPressed: () async {
Get.to(() => AddPackagePage()); await Get.to(() => AddPackagePage());
}) })
], ],
appBarBottom: PreferredSize( appBarBottom: PreferredSize(

@ -17,7 +17,9 @@ class PackagesManageView extends StatefulWidget {
class _PackagesManageViewState extends State<PackagesManageView> { class _PackagesManageViewState extends State<PackagesManageView> {
EasyRefreshController _refreshController; EasyRefreshController _refreshController;
List<PackageManageListModel> _models; void callRefresh(){
_refreshController.callRefresh();
}
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -37,12 +39,15 @@ class _PackagesManageViewState extends State<PackagesManageView> {
controller: _refreshController, controller: _refreshController,
extraParams: {"collectionStatus": widget.index + 1}, extraParams: {"collectionStatus": widget.index + 1},
convert: (models) { convert: (models) {
return models.tableList List<PackageManageListModel> modelList = models.tableList
.map((e) => PackageManageListModel.fromJson(e)) .map((e) => PackageManageListModel.fromJson(e))
.toList(); .toList();
print(modelList);
return modelList;
}, },
builder: (items) { builder: (items) {
return ListView.separated( return ListView.separated(
padding: EdgeInsets.symmetric(vertical: 24.w,horizontal: 32.w),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return PackageManageCard( return PackageManageCard(
index: widget.index, index: widget.index,

Loading…
Cancel
Save