|
|
@ -1,6 +1,7 @@ |
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
|
|
|
import 'package:flutter_slidable/flutter_slidable.dart'; |
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart'; |
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart'; |
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
@ -387,7 +388,8 @@ class _ShoppingCartPage extends State<ShoppingCartPage> |
|
|
|
) |
|
|
|
) |
|
|
|
: Container( |
|
|
|
: Container( |
|
|
|
margin: EdgeInsets.only(bottom: 50.h), |
|
|
|
margin: EdgeInsets.only(bottom: 50.h), |
|
|
|
child: ListView.builder( |
|
|
|
child: SlidableAutoCloseBehavior( |
|
|
|
|
|
|
|
child:ListView.builder( |
|
|
|
itemCount: ((shopCarGoods?.length ?? 0) > 0) |
|
|
|
itemCount: ((shopCarGoods?.length ?? 0) > 0) |
|
|
|
? (shopCarGoods[0]?.shoppingCartSkuItemList?.length ?? 0) |
|
|
|
? (shopCarGoods[0]?.shoppingCartSkuItemList?.length ?? 0) |
|
|
|
: 0, |
|
|
|
: 0, |
|
|
@ -402,18 +404,52 @@ class _ShoppingCartPage extends State<ShoppingCartPage> |
|
|
|
onTap: () { |
|
|
|
onTap: () { |
|
|
|
bIndex = position; |
|
|
|
bIndex = position; |
|
|
|
}, |
|
|
|
}, |
|
|
|
child: cartGoodsItem(position), |
|
|
|
child:Padding( |
|
|
|
|
|
|
|
padding: EdgeInsets.all(8), |
|
|
|
|
|
|
|
child: ClipRRect( |
|
|
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(4)), |
|
|
|
|
|
|
|
child: Slidable( |
|
|
|
|
|
|
|
endActionPane: ActionPane( |
|
|
|
|
|
|
|
extentRatio: 0.22, |
|
|
|
|
|
|
|
motion: ScrollMotion(), |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
SlidableAction( |
|
|
|
|
|
|
|
onPressed: (bc) { |
|
|
|
|
|
|
|
shopCarGoods[0].shoppingCartSkuItemList[position].selected = |
|
|
|
|
|
|
|
(shopCarGoods[0].shoppingCartSkuItemList[position].selected == |
|
|
|
|
|
|
|
0) |
|
|
|
|
|
|
|
? 1 |
|
|
|
|
|
|
|
: 0; |
|
|
|
|
|
|
|
shopCartAdd(shopCarGoods[0].shoppingCartSkuItemList[position], 0, |
|
|
|
|
|
|
|
shopCarGoods[0].shoppingCartSkuItemList[position].selected); |
|
|
|
|
|
|
|
if(isAllItemUnSelected()) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
clearShopCar(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
backgroundColor: Color(0xFFFB312B), |
|
|
|
|
|
|
|
foregroundColor: Colors.white, |
|
|
|
|
|
|
|
label: '删除', |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
child:cartGoodsItem(position), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
) |
|
|
|
); |
|
|
|
); |
|
|
|
}), |
|
|
|
}) , |
|
|
|
|
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Widget cartGoodsItem(index) { |
|
|
|
Widget cartGoodsItem(index) { |
|
|
|
return Container( |
|
|
|
return Container( |
|
|
|
margin: EdgeInsets.all(16), |
|
|
|
// margin: EdgeInsets.all(16), |
|
|
|
padding: EdgeInsets.all(16), |
|
|
|
padding: EdgeInsets.all(16), |
|
|
|
decoration: BoxDecoration( |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.circular(8), |
|
|
|
borderRadius: BorderRadius.only( |
|
|
|
|
|
|
|
topLeft: Radius.circular(4), |
|
|
|
|
|
|
|
bottomLeft: Radius.circular(4),), |
|
|
|
boxShadow: [ |
|
|
|
boxShadow: [ |
|
|
|
BoxShadow( |
|
|
|
BoxShadow( |
|
|
|
color: Colors.black.withAlpha(12), |
|
|
|
color: Colors.black.withAlpha(12), |
|
|
@ -476,7 +512,7 @@ class _ShoppingCartPage extends State<ShoppingCartPage> |
|
|
|
maxLines: 2, |
|
|
|
maxLines: 2, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
fontSize: 16.sp, |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
color: Color(0xFF353535), |
|
|
|
color: Color(0xFF353535), |
|
|
|
), |
|
|
|
), |
|
|
@ -486,7 +522,7 @@ class _ShoppingCartPage extends State<ShoppingCartPage> |
|
|
|
shopCarGoods[0].shoppingCartSkuItemList[index]?.skuName ?? |
|
|
|
shopCarGoods[0].shoppingCartSkuItemList[index]?.skuName ?? |
|
|
|
"", |
|
|
|
"", |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 10.sp, |
|
|
|
fontSize: 12.sp, |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
color: Color(0xFF727272), |
|
|
|
color: Color(0xFF727272), |
|
|
|
), |
|
|
|
), |
|
|
@ -503,7 +539,7 @@ class _ShoppingCartPage extends State<ShoppingCartPage> |
|
|
|
TextSpan( |
|
|
|
TextSpan( |
|
|
|
text: "¥", |
|
|
|
text: "¥", |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 10.sp, |
|
|
|
fontSize: 12.sp, |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
color: Color(0xFF32A060), |
|
|
|
color: Color(0xFF32A060), |
|
|
|
), |
|
|
|
), |
|
|
@ -514,7 +550,7 @@ class _ShoppingCartPage extends State<ShoppingCartPage> |
|
|
|
?.skuPrice ?? |
|
|
|
?.skuPrice ?? |
|
|
|
"", |
|
|
|
"", |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
fontSize: 16.sp, |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
color: Color(0xFF32A060), |
|
|
|
color: Color(0xFF32A060), |
|
|
|
), |
|
|
|
), |
|
|
@ -559,7 +595,7 @@ class _ShoppingCartPage extends State<ShoppingCartPage> |
|
|
|
0, |
|
|
|
0, |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
color: Colors.black, |
|
|
|
color: Colors.black, |
|
|
|
fontSize: 14.sp, |
|
|
|
fontSize: 16.sp, |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|