|
|
|
@ -8,19 +8,21 @@ import 'package:huixiang/view_widget/custom_image.dart';
|
|
|
|
|
import 'package:huixiang/view_widget/round_button.dart'; |
|
|
|
|
|
|
|
|
|
class ShopGoods extends StatefulWidget { |
|
|
|
|
|
|
|
|
|
final Function(String id) queryMiNiDetail; |
|
|
|
|
final Function(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) add; |
|
|
|
|
final Function(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) reduce; |
|
|
|
|
final Function(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) |
|
|
|
|
reduce; |
|
|
|
|
final ProductListBean productListBean; |
|
|
|
|
final ShoppingCartSkuItemListBean shoppingCartSkuItemListBean; |
|
|
|
|
final int count; |
|
|
|
|
final bool isShopCart; |
|
|
|
|
|
|
|
|
|
ShopGoods( |
|
|
|
|
this.add, |
|
|
|
|
this.reduce, { |
|
|
|
|
this.productListBean, |
|
|
|
|
this.productListBean, |
|
|
|
|
this.count = 0, |
|
|
|
|
this.isShopCart = false, |
|
|
|
|
this.queryMiNiDetail, |
|
|
|
|
this.shoppingCartSkuItemListBean, |
|
|
|
|
}); |
|
|
|
@ -48,10 +50,11 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
children: [ |
|
|
|
|
SizedBox(width: 12.w), |
|
|
|
|
MImage( |
|
|
|
|
widget.productListBean != null ? widget.productListBean.imgPath : |
|
|
|
|
(widget.shoppingCartSkuItemListBean != null |
|
|
|
|
? widget.shoppingCartSkuItemListBean.skuImg |
|
|
|
|
: ""), |
|
|
|
|
widget.productListBean != null |
|
|
|
|
? widget.productListBean.imgPath |
|
|
|
|
: (widget.shoppingCartSkuItemListBean != null |
|
|
|
|
? widget.shoppingCartSkuItemListBean.skuImg |
|
|
|
|
: ""), |
|
|
|
|
width: 70, |
|
|
|
|
height: 70, |
|
|
|
|
fit: BoxFit.cover, |
|
|
|
@ -66,7 +69,9 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
widget.productListBean != null ? widget.productListBean.productName : widget.shoppingCartSkuItemListBean.productName, |
|
|
|
|
widget.productListBean != null |
|
|
|
|
? widget.productListBean.productName |
|
|
|
|
: widget.shoppingCartSkuItemListBean.productName, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Colors.black, |
|
|
|
|
fontSize: 13.sp, |
|
|
|
@ -76,13 +81,16 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
SizedBox( |
|
|
|
|
height: 2, |
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
///{"id":"1442420413828169728","productId":"1432652566000304128","productName":"桂花乌龙茶","skuName":null,"buyNum":1,"skuStock":1000,"skuImg":"https://pos.upload.gznl.top/1177/2021/08/f855ffb8-d473-4f5f-93c9-5907b539b2fd.jpg", |
|
|
|
|
///"skuPrice":"0.00","selected":1,"storeId":null,"groupId":"1426067376096411648","createTime":"2021-10-20 10:27:46","tableId":null,"platterList":null} |
|
|
|
|
Row( |
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
(widget.productListBean != null ? widget.productListBean.shortName : widget.shoppingCartSkuItemListBean.skuName ?? ""), |
|
|
|
|
(widget.productListBean != null |
|
|
|
|
? widget.productListBean.shortName |
|
|
|
|
: widget.shoppingCartSkuItemListBean.skuName ?? ""), |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
maxLines: 2, |
|
|
|
|
style: TextStyle( |
|
|
|
@ -154,22 +162,48 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
Spacer(), |
|
|
|
|
if (widget.count == 0) |
|
|
|
|
RoundButton( |
|
|
|
|
width: 49.w, |
|
|
|
|
text: S.of(context).xuanguige, |
|
|
|
|
textColor: Colors.white, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
radius: 11, |
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 5.h), |
|
|
|
|
callback: () { |
|
|
|
|
widget.queryMiNiDetail( |
|
|
|
|
widget.productListBean != null ? widget.productListBean.id : widget.shoppingCartSkuItemListBean.productId); |
|
|
|
|
}, |
|
|
|
|
if (!widget.isShopCart) |
|
|
|
|
Stack( |
|
|
|
|
children: [ |
|
|
|
|
Container( |
|
|
|
|
margin: EdgeInsets.only(right: 8, top: 4), |
|
|
|
|
child: RoundButton( |
|
|
|
|
width: 49.w, |
|
|
|
|
text: S.of(context).xuanguige, |
|
|
|
|
textColor: Colors.white, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
radius: 11, |
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 5.h), |
|
|
|
|
callback: () { |
|
|
|
|
widget.queryMiNiDetail( |
|
|
|
|
widget.productListBean != null |
|
|
|
|
? widget.productListBean.id |
|
|
|
|
: widget.shoppingCartSkuItemListBean |
|
|
|
|
.productId); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Positioned( |
|
|
|
|
right: 0, |
|
|
|
|
child: Visibility( |
|
|
|
|
visible: widget.count > 0, |
|
|
|
|
child: RoundButton( |
|
|
|
|
width: 17, |
|
|
|
|
height: 17, |
|
|
|
|
text: "${widget.count}", |
|
|
|
|
textColor: Color(0xFF32A060), |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
backgroup: Colors.white, |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
radius: 100, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
if (widget.count > 0) |
|
|
|
|
if (widget.isShopCart) |
|
|
|
|
InkWell( |
|
|
|
|
onTap: () { |
|
|
|
|
widget.reduce(widget.shoppingCartSkuItemListBean); |
|
|
|
@ -180,7 +214,7 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
height: 22, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
if (widget.count > 0) |
|
|
|
|
if (widget.isShopCart) |
|
|
|
|
Container( |
|
|
|
|
width: 30, |
|
|
|
|
alignment: Alignment.center, |
|
|
|
@ -193,7 +227,7 @@ class _ShopGoods extends State<ShopGoods> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
if (widget.count > 0) |
|
|
|
|
if (widget.isShopCart) |
|
|
|
|
InkWell( |
|
|
|
|
onTap: () { |
|
|
|
|
widget.add(widget.shoppingCartSkuItemListBean); |
|
|
|
|