From bcbca62e462b1078ee684e81b9edd5c7690b46ba Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Thu, 15 Apr 2021 09:55:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=80=89=E6=8B=A9=E5=80=9F?= =?UTF-8?q?=E8=BF=98=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/icons/goods_borrow.png | Bin 0 -> 730 bytes assets/icons/goods_return.png | Bin 0 -> 768 bytes lib/const/resource.dart | 278 +++++++++--------- lib/constants/application_objects.dart | 4 +- .../borrow/borrow_goods_page.dart | 144 +++++++++ .../goods_manage_page/goods_manage_page.dart | 5 +- .../select_borrow_return_page.dart | 61 ++++ 7 files changed, 353 insertions(+), 139 deletions(-) create mode 100644 assets/icons/goods_borrow.png create mode 100644 assets/icons/goods_return.png create mode 100644 lib/pages/goods_manage_page/borrow/borrow_goods_page.dart create mode 100644 lib/pages/goods_manage_page/select_borrow_return_page.dart diff --git a/assets/icons/goods_borrow.png b/assets/icons/goods_borrow.png new file mode 100644 index 0000000000000000000000000000000000000000..cc9d5c7d60dda17cca8b9a96b8890ec3bf4704aa GIT binary patch literal 730 zcmV<00ww*4P)mF#k0jPy+GezgCdgfmRT$K&?QnAf$rOffV3ZDv%CB3Q+RaxlD`!Wa5krxA$hw zQx3#^x4d2VfJitjeyP{%BXm8Ig9y!Euh$a`#!oHF8jwK5aXhgajm8Jw*GMKJo8%hL zsM#bO;t9CR8iYuMqyZrEPTE)&0Rh59hco~p-3BDMNn;`|0T>^pjTsRn;V=Y{a2Nte z0FckTr)&>J5O6pgW=TmM!sGak1Yo<}hOX;&DwPWV?XRMJ!gznVTm~WtU@!^j{?t8; z2$FCZ0!TPYFM?2a7wSIc_xt_6uf#4lO78)-ZNH#va|01ORpQToJe3@X=e4uXV^q3# za11BU@w#e&lh+%x7D43=i!5&_H37=7OY0h}4I6kv;_6o+Q9vm-yXUowGH%ZAsKFbi z@P^0pNKps@F#ZjlL$}A#8$iThwOYOMhMN3&?OoE4J`@aS;w{B$E^F8 z_SKPqi?e=;(kDWg?YZiC)`yt&ZeHUVrS|}+`V8HS{s~hSC*d#zkZ_olArgXSv)M+d ze5RioqQ_-15d^eaEf>kr;%svpm0}qcAsC;yK!U_+Bt-+#O6TTz0Yd-@harH3gCCoV zQ^t-D7m^-$qLfIGl?d?xJ<=RT14uXw0cZiqg=h0EBP5fAfNzla0^51$DrDFN@c;k- M07*qoM6N<$f``02^#A|> literal 0 HcmV?d00001 diff --git a/assets/icons/goods_return.png b/assets/icons/goods_return.png new file mode 100644 index 0000000000000000000000000000000000000000..5862dc4fdd125fbea54f63995280a420a3e281e4 GIT binary patch literal 768 zcmV+b1ONPqP)G!552|yH!#VD7{olU3HBPhXSGU*J5!#F6H%jZ0Qf=*oI3WdTe5Aslm zAP9~_wh@$qk9;wNa(Duu90#TjJ|A%yhF91Fa4ZinXq}M&DrDU2^}5&tFxAH}5a2Zc z%Hausa(Duu17lN%3IbRMycoJVDhL=11|8Nlw^H26Ia`T{=Ojs*2T%eQbuBin)$3ja zp&Xt7D928SAYJP`UF%CK`DfZIROcf=Tx$+~#KShz*IT7hsUbx;8v*lK7bD|*`8xgl z8k;Usf|CTuEOWMHuVU+Vy;B6ptkZ_O;oz^45u71lKI=yBZV9PIg>?efopok{GYaE~ z|Nq7Ypq6xHZ_p|MYs~sGXMuxXS^r7qhW4lerRmPbZUYLAaI%VBYDsSR}=J|aUn*Jlgj;q6tNSg=sZ(wrEv250#FW5 z0F*<`_P9VSIA)ZH*<_p~$%m{#L!jqSpdr634n6=Ldeu1IWz6IF>FD`V(Rvh y$hHZkpwKsGYeQKsa>dku5^&&O^aI|-5cmP}DGkff1n^P-0000 appObjects = [ () => AdvicePage(type: AdviceType.COMPLAIN)), AO('问卷调查', R.ASSETS_APPLICATIONS_QUESTION_PNG, () => QuestionnairePage()), // AO('装修管理', R.ASSETS_APPLICATIONS_DECORATION_PNG, FitupManagePage()), - AO('借还管理', R.ASSETS_APPLICATIONS_BORROW_PNG, () => GoodsManagePage()), + AO('借还管理', R.ASSETS_APPLICATIONS_BORROW_PNG, () => SelectBorrowReturnPage()), AO('一键报警', R.ASSETS_APPLICATIONS_POLICE_PNG, () => AlarmPage()), ]; diff --git a/lib/pages/goods_manage_page/borrow/borrow_goods_page.dart b/lib/pages/goods_manage_page/borrow/borrow_goods_page.dart new file mode 100644 index 00000000..5ccbbbc2 --- /dev/null +++ b/lib/pages/goods_manage_page/borrow/borrow_goods_page.dart @@ -0,0 +1,144 @@ +import 'package:akuCommunity/base/base_style.dart'; +import 'package:akuCommunity/constants/api.dart'; +import 'package:akuCommunity/model/common/img_model.dart'; +import 'package:akuCommunity/model/manager/article_borrow_model.dart'; +import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; +import 'package:akuCommunity/widget/bee_scaffold.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; +import 'package:akuCommunity/const/resource.dart'; + +class BorrowGoodsPage extends StatefulWidget { + BorrowGoodsPage({Key key}) : super(key: key); + + @override + _BorrowGoodsPageState createState() => _BorrowGoodsPageState(); +} + +class _BorrowGoodsPageState extends State { + EasyRefreshController _easyRefreshController; + @override + void initState() { + super.initState(); + _easyRefreshController = EasyRefreshController(); + } + + @override + void dispose() { + _easyRefreshController?.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '全部物品', + actions: [ + MaterialButton( + onPressed: () { + // Get.to(() => MineGoodsPage()); + }, + child: '我的借还物品'.text.black.size(28.sp).make(), + padding: EdgeInsets.symmetric(horizontal: 32.w), + ), + ], + body: BeeListView( + path: API.manager.articleBorrow, + controller: _easyRefreshController, + convert: (models) { + return models.tableList + .map((e) => ArticleBorrowModel.fromJson(e)) + .toList(); + }, + builder: (items) { + return ListView.separated( + itemBuilder: (context, index) { + return _goodsCard(items[index]); + }, + separatorBuilder: (_, __) { + return 16.w.heightBox; + }, + itemCount: items.length); + }), + bottomNavi: Row( + children: [ + '已选择'.richText.color(ktextPrimary).size(28.sp).withTextSpanChildren([ + '0'.textSpan.size(32.sp).color(ktextPrimary).bold.make(), + '项'.textSpan.size(28.sp).color(ktextPrimary).make(), + ]).make(), + Spacer(), + MaterialButton( + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(37.w)), + color: kPrimaryColor, + padding: EdgeInsets.symmetric(horizontal: 50.w, vertical: 15.w), + onPressed: () {}, + child: '选好了'.text.black.size(32.sp).bold.make(), + ), + ], + ) + .pSymmetric(v: 20.w, h: 10.w) + .box + .width(double.infinity) + .padding( + EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom)) + .make(), + ); + } + + Widget _goodsCard(ArticleBorrowModel model) { + return Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + width: 160.w, + height: 120.w, + child: ClipRRect( + child: FadeInImage.assetNetwork( + placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + image: API.image(ImgModel.first(model.imgUrls)), + ), + ), + ), + 20.w.widthBox, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Image.asset( + R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + width: 20.w, + height: 20.w, + ), + 4.w.widthBox, + '物品名称:'.text.color(ktextSubColor).size(28.sp).make(), + '${model.name}'.text.color(ktextPrimary).size(30.sp).make(), + ], + ), + Row( + children: [ + Image.asset( + R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + width: 20.w, + height: 20.w, + ), + 4.w.widthBox, + '物品名称:'.text.color(ktextSubColor).size(28.sp).make(), + '${model.quantity}'.text.color(ktextPrimary).size(30.sp).make(), + ], + ), + ], + ).expand(), + ], + ) + .box + .color(Colors.white) + .padding(EdgeInsets.symmetric(vertical: 12.w, horizontal: 10.w)) + .withRounded(value: 6.w) + .make(); + } +} diff --git a/lib/pages/goods_manage_page/goods_manage_page.dart b/lib/pages/goods_manage_page/goods_manage_page.dart index f8e08ccd..f124eb71 100644 --- a/lib/pages/goods_manage_page/goods_manage_page.dart +++ b/lib/pages/goods_manage_page/goods_manage_page.dart @@ -16,7 +16,8 @@ import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/buttons/bottom_button.dart'; class GoodsManagePage extends StatefulWidget { - GoodsManagePage({Key key}) : super(key: key); + final bool isBorrow; + GoodsManagePage({Key key, this.isBorrow = true}) : super(key: key); @override _GoodsManagePageState createState() => _GoodsManagePageState(); @@ -115,7 +116,7 @@ class _GoodsManagePageState extends State { itemCount: items.length); }), bottomNavi: BottomButton( - child: '扫一扫出借'.text.black.size(32.sp).bold.make(), + child: '扫一扫'.text.black.size(32.sp).bold.make(), onPressed: () {}, ), ); diff --git a/lib/pages/goods_manage_page/select_borrow_return_page.dart b/lib/pages/goods_manage_page/select_borrow_return_page.dart new file mode 100644 index 00000000..77944042 --- /dev/null +++ b/lib/pages/goods_manage_page/select_borrow_return_page.dart @@ -0,0 +1,61 @@ +import 'package:akuCommunity/pages/goods_manage_page/goods_manage_page.dart'; +import 'package:akuCommunity/widget/bee_scaffold.dart'; +import 'package:flutter/cupertino.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'; +import 'package:akuCommunity/const/resource.dart'; +import 'package:akuCommunity/extensions/widget_list_ext.dart'; + +class SelectBorrowReturnPage extends StatefulWidget { + SelectBorrowReturnPage({Key key}) : super(key: key); + + @override + _SelectBorrowReturnPageState createState() => _SelectBorrowReturnPageState(); +} + +class _SelectBorrowReturnPageState extends State { + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '借还管理', + body: ListView( + padding: EdgeInsets.symmetric(vertical: 40.w, horizontal: 36.w), + children: [ + _buidTile(R.ASSETS_ICONS_GOODS_BORROW_PNG, '物品出借', true), + _buidTile(R.ASSETS_ICONS_GOODS_RETURN_PNG, '物品归还', false), + ].sepWidget(separate: 20.w.heightBox), + ), + ); + } + + Widget _buidTile(String iconPath, String text, bool isBorrow) { + return Row( + children: [ + SizedBox( + width: 32.w, + height: 32.w, + child: Image.asset(iconPath), + ), + 28.w.widthBox, + text.text.black.size(30.sp).make(), + Spacer(), + Icon( + CupertinoIcons.chevron_forward, + size: 32.w, + ), + ], + ) + .box + .color(Colors.white) + .padding(EdgeInsets.symmetric(vertical: 40.w, horizontal: 32.w)) + .withRounded(value: 8.w) + .make() + .onInkTap(() { + Get.to(() => GoodsManagePage( + isBorrow: isBorrow, + )); + }); + } +}