Browse Source

safety

master
fmk 3 years ago
parent
commit
e294a1647c
  1. 6
      lib/store/store_order.dart
  2. 20
      lib/store/store_view/shop_car.dart
  3. 4
      lib/store/store_view/shop_goods.dart
  4. 1
      lib/store/store_view/store_order_list.dart

6
lib/store/store_order.dart

@ -466,10 +466,10 @@ class _StoreOrderPage extends State<StoreOrderPage>
return ShopCar( return ShopCar(
productLists, productLists,
_queryMiNiDetail, _queryMiNiDetail,
(allCount, allPrice) { (ProductListBean productListBeans) {
setState(() { setState(() {
this.allCount = allCount; // this.allCount = allCount;
this.allPrice = allPrice; // this.allPrice = allPrice;
}); });
}, },
); );

20
lib/store/store_view/shop_car.dart

@ -11,7 +11,7 @@ class ShopCar extends StatefulWidget {
final List<ProductListBean> productLists; final List<ProductListBean> productLists;
final Function(String id) queryMiNiDetail; final Function(String id) queryMiNiDetail;
final Function(int allCount, double allPrice) fc; final Function(ProductListBean productListBeans) fc;
ShopCar( ShopCar(
this.productLists, this.productLists,
@ -27,12 +27,11 @@ class ShopCar extends StatefulWidget {
class _ShopCar extends State<ShopCar> { class _ShopCar extends State<ShopCar> {
int allCount;
double allPrice;
int allCount = 0; int allCount = 0;
double allPrice = 0; double allPrice = 0;
ProductListBean productListBeans;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -59,8 +58,7 @@ class _ShopCar extends State<ShopCar> {
} }
widget.productLists.forEach((element) { widget.productLists.forEach((element) {
allCount += element.buyNum; allCount += element.buyNum;
allPrice += double.parse(element.price) * allPrice += double.parse(element.price) * element.buyNum;
element.buyNum;
}); });
}); });
} }
@ -125,8 +123,7 @@ class _ShopCar extends State<ShopCar> {
), ),
child: ListView.builder( child: ListView.builder(
itemCount: widget.productLists == null itemCount: widget.productLists == null
? 0 ? 0 : widget.productLists.length,
: widget.productLists.length,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
@ -135,11 +132,10 @@ class _ShopCar extends State<ShopCar> {
widget.productLists, widget.productLists,
position, position,
widget.queryMiNiDetail, widget.queryMiNiDetail,
(int allCount, double allPrice){ (ProductListBean productListBeans){
widget.fc(allCount, allPrice); widget.fc(productListBeans);
setState(() { setState(() {
this.allCount = allCount; this.productListBeans = productListBeans;
this.allPrice = allPrice;
}); });
}, },
), ),

4
lib/store/store_view/shop_goods.dart

@ -10,7 +10,7 @@ class ShopGoods extends StatefulWidget {
final List<ProductListBean> productListBeans; final List<ProductListBean> productListBeans;
final int position; final int position;
final Function(String id) queryMiNiDetail; final Function(String id) queryMiNiDetail;
final Function(int allCount, double allPrice) fc; final Function(ProductListBean productListBeans) fc;
ShopGoods( ShopGoods(
this.productListBeans, this.productListBeans,
@ -205,7 +205,7 @@ class _ShopGoods extends State<ShopGoods> {
), ),
], ],
), ),
) ),
], ],
), ),
); );

1
lib/store/store_view/store_order_list.dart

@ -67,7 +67,6 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
appletGoods(); appletGoods();
widget.controller.addListener(() {});
} }
/// ///

Loading…
Cancel
Save