From 410bc980182fb5b918a66801565a781ad94dab5d Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Fri, 14 May 2021 09:41:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=92=A5=E5=8C=99=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=E5=AF=B9=E6=8E=A5=E9=92=A5=E5=8C=99=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/manage/key.png | Bin 0 -> 1345 bytes assets/manage/lock.png | Bin 0 -> 1897 bytes .../package_manage_list_model.dart | 4 +- .../home/application/applications_page.dart | 6 +- lib/ui/home/home_page.dart | 2 +- .../key_manage/key_manage_card.dart | 127 ++++++++++++++++++ .../key_manage/key_manage_map.dart | 21 +++ .../key_manage/key_manage_page.dart | 62 +++++++++ .../key_manage/key_manage_view.dart | 25 ++++ .../packages_manage/add_package_page.dart | 24 +--- .../packages_manage/packages_manage_card.dart | 2 +- .../packages_manage/packages_manage_page.dart | 10 +- .../packages_manage/packages_manage_view.dart | 9 +- 13 files changed, 262 insertions(+), 30 deletions(-) create mode 100644 assets/manage/key.png create mode 100644 assets/manage/lock.png create mode 100644 lib/ui/manage_pages/key_manage/key_manage_card.dart create mode 100644 lib/ui/manage_pages/key_manage/key_manage_map.dart create mode 100644 lib/ui/manage_pages/key_manage/key_manage_page.dart create mode 100644 lib/ui/manage_pages/key_manage/key_manage_view.dart diff --git a/assets/manage/key.png b/assets/manage/key.png new file mode 100644 index 0000000000000000000000000000000000000000..c294e629e29361c46185f29e30b86dde2976bc35 GIT binary patch literal 1345 zcmV-H1-|-;P)qVDgY`VR1osOO*{Y+3w;&QpmQ z8ygES&(7Q1+wJ!Dc0egfE#Sq)#V#h}g~$dXC2WO8zH1tPv1gLA&d zlTRfD^YgH3_V8###}Qbp1D~~k5U-|>O-xK2ZES1=R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nOAA4bSeaD zkVn$CQz#U6=I7_x(y_a{OA`LB!+5EY=$t?e@^+@CrfM#T3*-3scp9p{35iTH7paiw zlt5|o{uOHS+OTUI)oL|W!%or&>E6P7sT@`?G&D5p(k42c%1MV&RGbRN#>QsTCXYa# zcXV`g7C&2x)6?=9oxvG_(hjNAhsb-iu&|I>fJjghG|+nb!pqYzdUo_c_*aF4tIDSy>XAAP01Hb#;LI-gLUoW~v7B z@;m;-)D~X(7p_-k+dwIOQ3NpL?}aAlBarv*MjipzR50d0bdS&kJa3KEHrg(e8Z58~ zlrN!j95oZw#f$tYG^S=Dkkr?8FP64$C)!RQgCt)tz#!SRr$nc{bfHhR%2W-J9d=(kXWBp^UL93d$r`x$M=e7dXI z=mai-tc96qc|i5VoTj>nxu)vVTxj72&Uwu9u0_|A7*(!T=yECdK%W+EN?^ z#|Fk;242}HD8*`!!UY)e7>e?hgyXRQ-&*;?HJEx6P{7qlSk3> z(hlhvYo_Yk$6I-$S` zV`49r@NiwBx-Zue*T#be5gO7 z=WT2ta(}9L(waO1D-MK|s3zt{SzfxKhuj4G8RjpQO;aa7x z(^-=UwJjwTd6Me7G%HT?fl%cQkx-Y1>DWh;g>YLSlTBkJRmcW~LV;aS6o&H>Uz&Ph z_K;ZOo7O%KSshE>HYo;8rA{%GBJ*w}3WxhRh&T$|WtBow?3r4TXKLFVG)N=_82=QB ziEWbwc|xd;u-lfgR4Zgt-)MtX|E&&{^I-(EFi(WSqtnY$Q94zUw&ha61p1+kHZ!<} z(q=j{oujF#sSVdV0>a2-tCz+;4%Z;^YceuO6`5@|)Y!-23aRWvNkZn^T~i|R>y|OB z`EF-j(B88R*V4(n6yKbHaTZ&At05%Ea{`HLWF>J?^o+nLXej_vS%M@L>91`5K6?q| zT>A^{=A AppApplication('借还管理', R.ASSETS_HOME_IC_BORROW_PNG, BorrowManagerPage()), AppApplication('巡检管理', R.ASSETS_HOME_IC_PATROL_PNG, InspectionManagePage()), AppApplication('绿化管理', R.ASSETS_HOME_IC_GREENING_PNG, GreenManagePage()), - AppApplication('设施检查', R.ASSETS_HOME_IC_FACILITIES_PNG,FacilitiesPage() ), - AppApplication('包裹管理', R.ASSETS_PLACEHOLDER_WEBP, PackagesManagePage()) + AppApplication('设施检查', R.ASSETS_HOME_IC_FACILITIES_PNG, FacilitiesPage()), + AppApplication('包裹管理', R.ASSETS_PLACEHOLDER_WEBP, PackagesManagePage()), + AppApplication('钥匙管理', R.ASSETS_PLACEHOLDER_WEBP, KeyManagePage()) ]; @override diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index c8230ba..f12898b 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -181,7 +181,7 @@ class _HomePageState extends State { final userProvider = Provider.of(context); final appProvider = Provider.of(context); var loadingWidget = Center( - child: CircularProgressIndicator(), + // child: CircularProgressIndicator(), ); return AnnotatedRegion( child: Scaffold( diff --git a/lib/ui/manage_pages/key_manage/key_manage_card.dart b/lib/ui/manage_pages/key_manage/key_manage_card.dart new file mode 100644 index 0000000..26a042f --- /dev/null +++ b/lib/ui/manage_pages/key_manage/key_manage_card.dart @@ -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 { + @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, + ...[ + _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, + ], + ); + } +} diff --git a/lib/ui/manage_pages/key_manage/key_manage_map.dart b/lib/ui/manage_pages/key_manage/key_manage_map.dart new file mode 100644 index 0000000..103de30 --- /dev/null +++ b/lib/ui/manage_pages/key_manage/key_manage_map.dart @@ -0,0 +1,21 @@ +import 'package:flutter/material.dart'; + +class KeyManageMap { + static Map keyStatus = { + 1: '可申请', + 2: '审核中', + 3: '已通过', + 4: '使用中', + 5: '已驳回', + 6: '钥匙已空' + }; + static Map keyStatusColor = { + 1: Color(0xFF2576E5), + 2: Color(0xFFFFC40C), + 3: Color(0xFF333333), + 4: Color(0xFFFFC40C), + 5: Color(0xFFE60E0E), + 6: Color(0xFF999999), + }; + +} diff --git a/lib/ui/manage_pages/key_manage/key_manage_page.dart b/lib/ui/manage_pages/key_manage/key_manage_page.dart new file mode 100644 index 0000000..dd32041 --- /dev/null +++ b/lib/ui/manage_pages/key_manage/key_manage_page.dart @@ -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 + with TickerProviderStateMixin { + List _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: '立即申请'), + ); + } +} diff --git a/lib/ui/manage_pages/key_manage/key_manage_view.dart b/lib/ui/manage_pages/key_manage/key_manage_view.dart new file mode 100644 index 0000000..eeed5b4 --- /dev/null +++ b/lib/ui/manage_pages/key_manage/key_manage_view.dart @@ -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 { + @override + Widget build(BuildContext context) { + return ListView( + padding: EdgeInsets.all(32.w), + children: [ + KeyManageCard( + index: widget.index, + ) + ], + ); + } +} diff --git a/lib/ui/manage_pages/packages_manage/add_package_page.dart b/lib/ui/manage_pages/packages_manage/add_package_page.dart index bc76007..c600139 100644 --- a/lib/ui/manage_pages/packages_manage/add_package_page.dart +++ b/lib/ui/manage_pages/packages_manage/add_package_page.dart @@ -1,6 +1,7 @@ import 'package:aku_community_manager/const/api.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/inner/aku_bottom_button.dart'; import 'package:aku_community_manager/utils/network/base_model.dart'; import 'package:aku_community_manager/utils/network/net_util.dart'; import 'package:bot_toast/bot_toast.dart'; @@ -100,23 +101,7 @@ class _AddPackagePageState extends State { ), ), ), - bottom: _bottomButton(), - ); - } - - 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 { + bottom: AkuBottomButton(title: '确认提交',onTap: () async { canSubmit ? await addPackage( code: _codeController.text, @@ -125,12 +110,11 @@ class _AddPackagePageState extends State { address: _addressController.text, placePosition: _placeController.text) : null; - }, - child: '确认提交'.text.size(32.sp).color(kTextPrimaryColor).bold.make(), - ), + },), ); } + Future addPackage( {@required String code, @required String addresseeName, diff --git a/lib/ui/manage_pages/packages_manage/packages_manage_card.dart b/lib/ui/manage_pages/packages_manage/packages_manage_card.dart index 83b663d..7ef3f9d 100644 --- a/lib/ui/manage_pages/packages_manage/packages_manage_card.dart +++ b/lib/ui/manage_pages/packages_manage/packages_manage_card.dart @@ -81,7 +81,7 @@ class _PackageManageCardState extends State { _rowTile( R.ASSETS_MANAGE_IC_TIME_PNG, '送达时间', - DateUtil.formatDate(widget.model.createDate, + DateUtil.formatDateStr(widget.model.createDate, format: 'yyyy-MM-dd HH:mm') .text .size(24.sp) diff --git a/lib/ui/manage_pages/packages_manage/packages_manage_page.dart b/lib/ui/manage_pages/packages_manage/packages_manage_page.dart index ba71e4e..e84a917 100644 --- a/lib/ui/manage_pages/packages_manage/packages_manage_page.dart +++ b/lib/ui/manage_pages/packages_manage/packages_manage_page.dart @@ -25,6 +25,12 @@ class _PackagesManagePageState extends State _tabController = TabController(length: _tabs.length, vsync: this); } + @override + void dispose() { + _tabController?.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { return AkuScaffold( @@ -36,8 +42,8 @@ class _PackagesManagePageState extends State height: 40.w, child: Image.asset(R.ASSETS_MANAGE_ADD_PNG), ), - onPressed: () { - Get.to(() => AddPackagePage()); + onPressed: () async { + await Get.to(() => AddPackagePage()); }) ], appBarBottom: PreferredSize( diff --git a/lib/ui/manage_pages/packages_manage/packages_manage_view.dart b/lib/ui/manage_pages/packages_manage/packages_manage_view.dart index 2524e43..6b1f459 100644 --- a/lib/ui/manage_pages/packages_manage/packages_manage_view.dart +++ b/lib/ui/manage_pages/packages_manage/packages_manage_view.dart @@ -17,7 +17,9 @@ class PackagesManageView extends StatefulWidget { class _PackagesManageViewState extends State { EasyRefreshController _refreshController; - List _models; + void callRefresh(){ + _refreshController.callRefresh(); + } @override void initState() { super.initState(); @@ -37,12 +39,15 @@ class _PackagesManageViewState extends State { controller: _refreshController, extraParams: {"collectionStatus": widget.index + 1}, convert: (models) { - return models.tableList + List modelList = models.tableList .map((e) => PackageManageListModel.fromJson(e)) .toList(); + print(modelList); + return modelList; }, builder: (items) { return ListView.separated( + padding: EdgeInsets.symmetric(vertical: 24.w,horizontal: 32.w), itemBuilder: (context, index) { return PackageManageCard( index: widget.index,