From af927986bb695bbc512dca172b63eeffc1a99267 Mon Sep 17 00:00:00 2001 From: fmk Date: Wed, 13 Oct 2021 13:38:03 +0800 Subject: [PATCH] safety --- lib/store/store_view/settlement.dart | 439 ++++++++++++++------------- lib/store/store_view/shop_goods.dart | 28 +- 2 files changed, 247 insertions(+), 220 deletions(-) diff --git a/lib/store/store_view/settlement.dart b/lib/store/store_view/settlement.dart index 26d7ad34..5e913352 100644 --- a/lib/store/store_view/settlement.dart +++ b/lib/store/store_view/settlement.dart @@ -16,7 +16,7 @@ class Settlement extends StatefulWidget { final arguments; final OrderInfo orderInfo; - Settlement({this.arguments,this.orderInfo}); + Settlement({this.arguments, this.orderInfo}); @override State createState() { @@ -51,7 +51,8 @@ class _Settlement extends State { // String storeType = "NORMALSTORE"; //NORMALSTORE FASTSTORE RETAILSTORE queryDetails() async { - BaseData baseData = await apiService.orderDetail(widget.arguments["id"]); + BaseData baseData = + await apiService.orderDetail(widget.arguments["id"]); if (baseData != null && baseData.isSuccess) { orderInfo = baseData.data; payStatus = orderInfo.payStatus; @@ -95,7 +96,7 @@ class _Settlement extends State { appBar: MyAppBar( background: Color(0xFF3A405A), leadingColor: Colors.white, - title:S.of(context).dingdanjiesuan, + title: S.of(context).dingdanjiesuan, titleColor: Colors.white, brightness: Brightness.dark, titleSize: 18.sp, @@ -106,10 +107,11 @@ class _Settlement extends State { child: Container( child: Column( children: [ - distributionMode(), - SizedBox(height: 14,), + SizedBox( + height: 14, + ), ///订单商品 OrderCommodity(orderInfo), @@ -120,7 +122,6 @@ class _Settlement extends State { activityRemarks(), payMethod(), - ], ), ), @@ -136,50 +137,49 @@ class _Settlement extends State { bottom: 0, left: 0, right: 0, - child: - Container( - height: 54.h, - color: Colors.white, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Spacer(), - Text( - S.of(context).heji, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Colors.black, - ), - ), - Text( - "¥19.00", - style: TextStyle( - fontSize: 20.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xFF32A060), - ), - ), - SizedBox(width: 28,), - GestureDetector( - onTap: () { - - }, - child: RoundButton( - width: 103.w, - height: 54.h, - text: S.current.jiesuan, - textColor: Colors.white, - fontWeight: MyFontWeight.regular, - backgroup: Color(0xFF32A060), - fontSize: 16.sp, - padding: EdgeInsets.symmetric(vertical: 5.h), - ), - ), - ], + child: Container( + height: 54.h, + color: Colors.white, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Spacer(), + Text( + S.of(context).heji, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.black, + ), ), - ), - ) + Text( + "¥19.00", + style: TextStyle( + fontSize: 20.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF32A060), + ), + ), + SizedBox( + width: 28, + ), + GestureDetector( + onTap: () {}, + child: RoundButton( + width: 103.w, + height: 54.h, + text: S.current.jiesuan, + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFF32A060), + fontSize: 16.sp, + padding: EdgeInsets.symmetric(vertical: 5.h), + ), + ), + ], + ), + ), + ), ], ); } @@ -289,7 +289,11 @@ class _Settlement extends State { borderRadius: BorderRadius.circular(8), ), height: 175.h, - margin: EdgeInsets.only(left: 16, right: 16, top: 15), + margin: EdgeInsets.only( + left: 16, + right: 16, + top: 15, + ), child: Stack( children: [ Column( @@ -310,37 +314,40 @@ class _Settlement extends State { Expanded( flex: 1, child: Container( - height: 50.h, - decoration: BoxDecoration( - image: selectedBtn == 0 - ? DecorationImage( - image: AssetImage( - "assets/image/order_btn1.png"), - fit: BoxFit.fill, - ) - : null, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8))), - child: GestureDetector( - onTap: () { - setState(() { - selectedBtn = 0; - }); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Text( - S.of(context).daodianziqu, - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.semi_bold, - color: Colors.black, - ), + height: 50.h, + decoration: BoxDecoration( + image: selectedBtn == 0 + ? DecorationImage( + image: + AssetImage("assets/image/order_btn1.png"), + fit: BoxFit.fill, + ) + : null, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + ), + ), + child: GestureDetector( + onTap: () { + setState(() { + selectedBtn = 0; + }); + }, + child: Stack( + alignment: Alignment.center, + children: [ + Text( + S.of(context).daodianziqu, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, ), - ], - ), - )), + ), + ], + ), + ), + ), ), Expanded( flex: 1, @@ -360,7 +367,7 @@ class _Settlement extends State { fit: BoxFit.fill, ), Text( - S.of(context).waimaipeisong, + S.of(context).waimaipeisong, style: TextStyle( fontSize: 14.sp, fontWeight: MyFontWeight.regular, @@ -374,37 +381,40 @@ class _Settlement extends State { Expanded( flex: 1, child: Container( - height: 50.h, - decoration: BoxDecoration( - image: selectedBtn == 2 - ? DecorationImage( - image: AssetImage( - "assets/image/order_btn3.png"), - fit: BoxFit.fill, - ) - : null, - borderRadius: BorderRadius.only( - topRight: Radius.circular(8))), - child: GestureDetector( - onTap: () { - setState(() { - selectedBtn = 2; - }); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Text( - S.of(context).kuaidiwuliu, - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, - color: Colors.black, - ), + height: 50.h, + decoration: BoxDecoration( + image: selectedBtn == 2 + ? DecorationImage( + image: + AssetImage("assets/image/order_btn3.png"), + fit: BoxFit.fill, + ) + : null, + borderRadius: BorderRadius.only( + topRight: Radius.circular(8), + ), + ), + child: GestureDetector( + onTap: () { + setState(() { + selectedBtn = 2; + }); + }, + child: Stack( + alignment: Alignment.center, + children: [ + Text( + S.of(context).kuaidiwuliu, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + color: Colors.black, ), - ], - ), - )), + ), + ], + ), + ), + ), ), ], ), @@ -416,37 +426,39 @@ class _Settlement extends State { children: [ Row( children: [ - Expanded(child:Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "前进麦味·天然烘焙(凯德1818店)", - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xFF4C4C4C), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "前进麦味·天然烘焙(凯德1818店)", + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF4C4C4C), + ), ), - ), - SizedBox( - height: 4, - ), - Text( - "武昌区中国铁建凯德1818蓝调步行街中北路109附33门牌号05", - overflow: TextOverflow.ellipsis, - maxLines: 2, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF727272), + SizedBox( + height: 4, ), - ), - SizedBox( - height: 12, - ), - ], - ),), + Text( + "武昌区中国铁建凯德1818蓝调步行街中北路109附33门牌号05", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF727272), + ), + ), + SizedBox( + height: 12, + ), + ], + ), + ), SizedBox( width: 18, ), @@ -458,42 +470,46 @@ class _Settlement extends State { Image.asset( "assets/image/map.png", height: 61.h, - width:61.w, + width: 61.w, + ), + ], + ), + Column( + children: [ + RoundButton( + width: 41.w, + height: 13, + text: "距离您11m", + textColor: Color(0xFF34A262), + fontWeight: MyFontWeight.semi_bold, + radius: 7.5, + backgroup: Colors.white, + fontSize: 7.sp, + ), + Image.asset( + "assets/image/landmark.png", + height: 24.h, + width: 24.w, ), ], ), - Column(children: [ - RoundButton( - width: 41.w, - height: 13, - text: "距离您11m", - textColor:Color(0xFF34A262), - fontWeight: MyFontWeight.semi_bold, - radius:7.5, - backgroup:Colors.white, - fontSize:7.sp, - ), - Image.asset( - "assets/image/landmark.png", - height: 24.h, - width:24.w, - ), - ],), ], ) ], ), Row( children: [ - Expanded(child: Text( - S.of(context).yuliudianhua, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF4C4C4C), + Expanded( + child: Text( + S.of(context).yuliudianhua, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF4C4C4C), + ), ), - )), + ), Text( "12309090909", style: TextStyle( @@ -504,8 +520,8 @@ class _Settlement extends State { ), Image.asset( "assets/image/pen.png", - height:14.h, - width:14.w, + height: 14.h, + width: 14.w, ), ], ) @@ -514,18 +530,12 @@ class _Settlement extends State { ), ], ), - // Image.asset( - // "assets/image/shadow.png", - // width: 24.w, - // height: 24.h, - // fit: BoxFit.contain, - // ), ], ), ); } - Widget activityRemarks(){ + Widget activityRemarks() { return Container( decoration: BoxDecoration( color: Colors.white, @@ -540,29 +550,40 @@ class _Settlement extends State { borderRadius: BorderRadius.circular(8), ), height: 86.h, - margin: EdgeInsets.only(left: 16, right: 16, top: 15), - padding: EdgeInsets.only(left: 16, right: 16, top: 16), + margin: EdgeInsets.only( + left: 16, + right: 16, + top: 15, + ), + padding: EdgeInsets.only( + left: 16, + right: 16, + top: 16, + ), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Expanded(flex: 1,child:Text( - S.of(context).youhuiquan, - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 14.sp, - color: Color(0xFF353535), + Expanded( + flex: 1, + child: Text( + S.of(context).youhuiquan, + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 14.sp, + color: Color(0xFF353535), + ), ), - )), + ), Text( "满30减10", textAlign: TextAlign.end, style: TextStyle( fontSize: 14.sp, color: Color(0xFF32A060), - fontWeight: MyFontWeight.semi_bold + fontWeight: MyFontWeight.semi_bold, ), ), Icon( @@ -571,27 +592,31 @@ class _Settlement extends State { ), ], ), - SizedBox(height: 13, + SizedBox( + height: 13, ), Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Expanded(flex: 1,child:Text( - S.of(context).beizhu, - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 14.sp, - color: Color(0xFF353535), + Expanded( + flex: 1, + child: Text( + S.of(context).beizhu, + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 14.sp, + color: Color(0xFF353535), + ), ), - )), + ), Text( "口味、面包硬度等", textAlign: TextAlign.end, style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF353535), - fontWeight: MyFontWeight.semi_bold + fontSize: 14.sp, + color: Color(0xFF353535), + fontWeight: MyFontWeight.semi_bold, ), ), Icon( @@ -605,7 +630,7 @@ class _Settlement extends State { ); } - Widget payMethod(){ + Widget payMethod() { return Container( width: double.infinity, margin: EdgeInsets.only( @@ -642,14 +667,14 @@ class _Settlement extends State { style: TextStyle( fontSize: 16.sp, color: Colors.black, - fontWeight:MyFontWeight.regular, + fontWeight: MyFontWeight.regular, ), ), ), GestureDetector( onTap: () { setState(() { - checkIndex =1; + checkIndex = 1; }); }, child: Row( @@ -662,17 +687,19 @@ class _Settlement extends State { style: TextStyle( fontSize: 14.sp, color: Color(0xff353535), - fontWeight: MyFontWeight.semi_bold + fontWeight: MyFontWeight.semi_bold, ), ), ], ), ), - SizedBox(height: 10,), + SizedBox( + height: 10, + ), GestureDetector( onTap: () { setState(() { - checkIndex =2; + checkIndex = 2; }); }, child: Row( @@ -685,13 +712,15 @@ class _Settlement extends State { style: TextStyle( fontSize: 14.sp, color: Color(0xff353535), - fontWeight: MyFontWeight.semi_bold, + fontWeight: MyFontWeight.semi_bold, ), ), ], ), ), - SizedBox(height: 10,), + SizedBox( + height: 10, + ), GestureDetector( onTap: () { setState(() { @@ -712,7 +741,7 @@ class _Settlement extends State { style: TextStyle( fontSize: 14.sp, color: Color(0xff353535), - fontWeight: MyFontWeight.semi_bold, + fontWeight: MyFontWeight.semi_bold, ), ), ), diff --git a/lib/store/store_view/shop_goods.dart b/lib/store/store_view/shop_goods.dart index b912ffd4..a68c7b76 100644 --- a/lib/store/store_view/shop_goods.dart +++ b/lib/store/store_view/shop_goods.dart @@ -159,21 +159,19 @@ class _ShopGoods extends State { : InkWell( onTap: () { setState(() { - { - if (widget.productListBeans[widget.position] - .buyNum > - 0) - widget.productListBeans[widget.position] - .buyNum--; - int allCount = 0; - double allPrice = 0; - widget.productListBeans.forEach((element) { - allCount += element.buyNum; - allPrice += double.parse(element.price) * - element.buyNum; - }); - widget.fc(allCount, allPrice); - } + if (widget.productListBeans[widget.position] + .buyNum > + 0) + widget.productListBeans[widget.position] + .buyNum--; + int allCount = 0; + double allPrice = 0; + widget.productListBeans.forEach((element) { + allCount += element.buyNum; + allPrice += double.parse(element.price) * + element.buyNum; + }); + widget.fc(allCount, allPrice); }); }, child: Image.asset(