|
|
|
@ -8,21 +8,27 @@ import 'package:huixiang/view_widget/round_button.dart';
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
|
|
|
|
|
|
class ShopCar extends StatefulWidget { |
|
|
|
|
|
|
|
|
|
final List<ProductListBean> productLists; |
|
|
|
|
final Function(String id) queryMiNiDetail; |
|
|
|
|
final Function(int allCount, double allPrice) fc; |
|
|
|
|
|
|
|
|
|
ShopCar(this.productLists, this.queryMiNiDetail, this.fc); |
|
|
|
|
ShopCar( |
|
|
|
|
this.productLists, |
|
|
|
|
this.queryMiNiDetail, |
|
|
|
|
this.fc, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
State<StatefulWidget> createState() { |
|
|
|
|
return _ShopCar(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class _ShopCar extends State<ShopCar> { |
|
|
|
|
|
|
|
|
|
int allCount; |
|
|
|
|
double allPrice; |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
return StatefulBuilder(builder: (context1, state) { |
|
|
|
@ -32,8 +38,9 @@ class _ShopCar extends State<ShopCar> {
|
|
|
|
|
height: MediaQuery.of(context).size.height / 2, |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Colors.white, |
|
|
|
|
borderRadius: BorderRadius.vertical( |
|
|
|
|
top: Radius.circular(8), |
|
|
|
|
borderRadius: BorderRadius.only( |
|
|
|
|
topLeft: Radius.circular(8), |
|
|
|
|
topRight: Radius.circular(8), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
child: Column( |
|
|
|
@ -78,12 +85,25 @@ class _ShopCar extends State<ShopCar> {
|
|
|
|
|
right: 16, |
|
|
|
|
), |
|
|
|
|
child: ListView.builder( |
|
|
|
|
itemCount: widget.productLists == null ? 0 : widget.productLists.length, |
|
|
|
|
itemCount: widget.productLists == null |
|
|
|
|
? 0 |
|
|
|
|
: widget.productLists.length, |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
itemBuilder: (context, position) { |
|
|
|
|
return GestureDetector( |
|
|
|
|
onTap: () {}, |
|
|
|
|
child: ShopGoods(widget.productLists, position, widget.queryMiNiDetail, widget.fc), |
|
|
|
|
child: ShopGoods( |
|
|
|
|
widget.productLists, |
|
|
|
|
position, |
|
|
|
|
widget.queryMiNiDetail, |
|
|
|
|
(int allCount, double allPrice){ |
|
|
|
|
widget.fc(allCount, allPrice); |
|
|
|
|
setState(() { |
|
|
|
|
this.allCount = allCount; |
|
|
|
|
this.allPrice = allPrice; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
@ -117,7 +137,7 @@ class _ShopCar extends State<ShopCar> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
"¥19.00", |
|
|
|
|
"¥" + allPrice.toString(), |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 20.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
@ -125,16 +145,24 @@ class _ShopCar extends State<ShopCar> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Spacer(), |
|
|
|
|
RoundButton( |
|
|
|
|
width: 103.w, |
|
|
|
|
height: 54.h, |
|
|
|
|
text: S.current.jiesuan, |
|
|
|
|
textColor: Colors.white, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
|
radius: 0, |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 5.h), |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
Navigator.of(context).pushNamed( |
|
|
|
|
'/router/settlement', |
|
|
|
|
arguments: {}, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
child: RoundButton( |
|
|
|
|
width: 103.w, |
|
|
|
|
height: 54.h, |
|
|
|
|
text: S.current.jiesuan, |
|
|
|
|
textColor: Colors.white, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
|
radius: 0, |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 5.h), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
@ -157,15 +185,14 @@ class _ShopCar extends State<ShopCar> {
|
|
|
|
|
child: RoundButton( |
|
|
|
|
width: 17, |
|
|
|
|
height: 17, |
|
|
|
|
text: "1", |
|
|
|
|
text: allCount.toString(), |
|
|
|
|
textColor: Colors.white, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
radius: 100, |
|
|
|
|
callback: () { |
|
|
|
|
Navigator.of(context) |
|
|
|
|
.pushNamed('/router/test_page'); |
|
|
|
|
Navigator.of(context).pushNamed('/router/test_page'); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
@ -178,5 +205,4 @@ class _ShopCar extends State<ShopCar> {
|
|
|
|
|
); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|