From 1575da2f9687b2655cb066fb680ebfe9e75f3c55 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Fri, 29 Jan 2021 10:22:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E6=8E=A5=E5=8F=A3=EF=BC=9A?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=89=A9=E5=93=81=E5=87=BA=E6=88=B7=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../deto_code_page/deto_code_page.dart | 3 +- .../goods_deto_page/goods_deto_page.dart | 4 +- .../widget/goods_info_card.dart | 115 ++++++++++-------- .../widget/goods_info_card_button.dart | 16 ++- lib/utils/bee_map.dart | 10 ++ 5 files changed, 92 insertions(+), 56 deletions(-) diff --git a/lib/pages/goods_deto_page/deto_code_page/deto_code_page.dart b/lib/pages/goods_deto_page/deto_code_page/deto_code_page.dart index 87cb3a67..bdd58129 100644 --- a/lib/pages/goods_deto_page/deto_code_page/deto_code_page.dart +++ b/lib/pages/goods_deto_page/deto_code_page/deto_code_page.dart @@ -12,7 +12,8 @@ import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/dotted_line.dart'; class DetoCodePage extends StatelessWidget { - const DetoCodePage({Key key}) : super(key: key); + final int id; + const DetoCodePage({Key key, this.id}) : super(key: key); Widget _header() { return Container( diff --git a/lib/pages/goods_deto_page/goods_deto_page.dart b/lib/pages/goods_deto_page/goods_deto_page.dart index 5b97888c..fee118b8 100644 --- a/lib/pages/goods_deto_page/goods_deto_page.dart +++ b/lib/pages/goods_deto_page/goods_deto_page.dart @@ -42,7 +42,9 @@ class _GoodsDetoPageState extends State { builder: (items) { return ListView.builder( itemBuilder: (context, index) { - return GoodsInfoCard(); + return GoodsInfoCard( + model: items[index], + ); }, itemCount: items.length, ); diff --git a/lib/pages/goods_deto_page/widget/goods_info_card.dart b/lib/pages/goods_deto_page/widget/goods_info_card.dart index 9f54b7c1..6c19d315 100644 --- a/lib/pages/goods_deto_page/widget/goods_info_card.dart +++ b/lib/pages/goods_deto_page/widget/goods_info_card.dart @@ -1,4 +1,7 @@ // Flutter imports: +import 'package:akuCommunity/base/base_style.dart'; +import 'package:akuCommunity/model/manager/goods_out_model.dart'; +import 'package:akuCommunity/utils/bee_map.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -8,11 +11,46 @@ import 'goods_info_card_button.dart'; import 'image_horizontal_list.dart'; class GoodsInfoCard extends StatelessWidget { - final List listImage; - final String status; - final List> detoInfoList; - GoodsInfoCard({Key key,this.listImage,this.status,this.detoInfoList}) : super(key: key); + final GoodsOutModel model; + GoodsInfoCard({ + Key key, + this.model, + }) : super(key: key); + Widget _builTile(String title, String text) { + return Container( + padding: EdgeInsets.only(top: 8.w), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + title, + style: TextStyle(fontSize: 28.sp, color: Color(0xff999999)), + ), + Text( + text, + style: TextStyle(fontSize: 28.sp, color: Color(0xff333333)), + ), + ], + ), + ); + } + +Color _getColor(int state) { + switch (state) { + case 1: + case 2: + case 3: + return kDarkPrimaryColor; + case 4: + case 5: + case 6: + case 7: + return ktextSubColor; + default: + return kDangerColor; + } + } @override Widget build(BuildContext context) { return Container( @@ -41,18 +79,15 @@ class GoodsInfoCard extends StatelessWidget { blurRadius: 10.0), ], ), - padding: EdgeInsets.only( - top: 25.w, - left: 24.w, - right: 24.w), + padding: EdgeInsets.only(top: 25.w, left: 24.w, right: 24.w), child: Column( children: [ Container( padding: EdgeInsets.only(bottom: 24.w), decoration: BoxDecoration( border: Border( - bottom: BorderSide( - color: Color(0xffeeeeee), width: 0.5)), + bottom: + BorderSide(color: Color(0xffeeeeee), width: 0.5)), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -64,13 +99,11 @@ class GoodsInfoCard extends StatelessWidget { fontSize: 32.sp, color: Color(0xff333333)), ), - Text( - status, - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 28.sp, - color: Color(0xff333333)) - ), + Text(BeeMap().fixState[model.status], + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 28.sp, + color: _getColor(model.status))), ], ), ), @@ -81,35 +114,16 @@ class GoodsInfoCard extends StatelessWidget { ), decoration: BoxDecoration( border: Border( - bottom: BorderSide( - color: Color(0xffeeeeee), width: 0.5)), - ), - child: Column( - children: detoInfoList - .map( - (item) => Container( - padding: EdgeInsets.only(top: 8.w), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - item['title'], - style: TextStyle( - fontSize: 28.sp, - color: Color(0xff999999)), - ), - Text( - item['content'], - style: TextStyle( - fontSize: 28.sp, - color: Color(0xff333333)), - ), - ], - ), - ), - ) - .toList(), + bottom: + BorderSide(color: Color(0xffeeeeee), width: 0.5)), ), + child: Column(children: [ + _builTile('物品重量', BeeMap().goodsOutweight[model.weight]), + _builTile('出户时间', model.expectedTime), + _builTile('物品名称', model.name), + _builTile( + '搬运方式', BeeMap().goodsOutApproach[model.approach]), + ]), ), Container( margin: EdgeInsets.only( @@ -120,22 +134,25 @@ class GoodsInfoCard extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( + alignment: Alignment.centerLeft, margin: EdgeInsets.only(bottom: 25.w), child: Text( '图片信息', style: TextStyle( - fontSize: 28.sp, - color: Color(0xff333333)), + fontSize: 28.sp, color: Color(0xff333333)), ), ), - ImageHorizontalList(imageUrl: listImage), + ImageHorizontalList(imageUrl: []), ], ), ), ], ), ), - GoodsInfoCardButton() + GoodsInfoCardButton( + id:model.id, + tel: model.movingCompanyTel, + ) ], ), ); diff --git a/lib/pages/goods_deto_page/widget/goods_info_card_button.dart b/lib/pages/goods_deto_page/widget/goods_info_card_button.dart index 8a2ba73e..c07c23da 100644 --- a/lib/pages/goods_deto_page/widget/goods_info_card_button.dart +++ b/lib/pages/goods_deto_page/widget/goods_info_card_button.dart @@ -13,7 +13,9 @@ import 'package:akuCommunity/pages/goods_deto_page/deto_code_page/deto_code_page import 'package:akuCommunity/utils/headers.dart'; class GoodsInfoCardButton extends StatelessWidget { - GoodsInfoCardButton({Key key}) : super(key: key); + final String tel; + final int id; + GoodsInfoCardButton({Key key, this.tel, this.id}) : super(key: key); final List> _listButton = [ {'title': '查看二维码', 'icon': MaterialCommunityIcons.qrcode}, @@ -92,10 +94,15 @@ class GoodsInfoCardButton extends StatelessWidget { onTap: () { switch (_listButton[index]['title']) { case '查看二维码': - DetoCodePage().to; + DetoCodePage( + id: id, + ).to(); break; case '搬家公司': - _showDialog(context, '0574-88467897'); + if (tel.isEmptyOrNull) { + return null; + } else + _showDialog(context, tel); break; default: } @@ -122,8 +129,7 @@ class GoodsInfoCardButton extends StatelessWidget { color: Color(0xff333333), ), Container( - margin: - EdgeInsets.only(left: 14.w), + margin: EdgeInsets.only(left: 14.w), child: Text( _listButton[index]['title'], style: TextStyle( diff --git a/lib/utils/bee_map.dart b/lib/utils/bee_map.dart index b933179d..25c21f30 100644 --- a/lib/utils/bee_map.dart +++ b/lib/utils/bee_map.dart @@ -26,4 +26,14 @@ class BeeMap { 8: '作废', 9: '取消' }; + + Map goodsOutweight = { + 1: '< 50kg', + 2: '50kg-100kg', + 3: '> 100kg', + }; + Map goodsOutApproach={ + 1:'自己搬运', + 2:'搬家公司', + }; }