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(
productLists,
_queryMiNiDetail,
(allCount, allPrice) {
(ProductListBean productListBeans) {
setState(() {
this.allCount = allCount;
this.allPrice = allPrice;
// this.allCount = allCount;
// this.allPrice = allPrice;
});
},
);

20
lib/store/store_view/shop_car.dart

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

4
lib/store/store_view/shop_goods.dart

@ -10,7 +10,7 @@ class ShopGoods extends StatefulWidget {
final List<ProductListBean> productListBeans;
final int position;
final Function(String id) queryMiNiDetail;
final Function(int allCount, double allPrice) fc;
final Function(ProductListBean productListBeans) fc;
ShopGoods(
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();
widget.controller.addListener(() {});
}
///

Loading…
Cancel
Save