|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
|
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
@ -9,24 +10,18 @@ import 'package:huixiang/view_widget/custom_image.dart';
|
|
|
|
|
import 'package:huixiang/view_widget/round_button.dart'; |
|
|
|
|
|
|
|
|
|
class ProductSku extends StatefulWidget { |
|
|
|
|
|
|
|
|
|
final MiNiDetail miNiDetail; |
|
|
|
|
final String productId; |
|
|
|
|
final Function(MiNiDetail miNiDetail, List<String> selectSkus, int count) addShopCar; |
|
|
|
|
final Function(MiNiDetail miNiDetail, List<String> selectSkus, int count) |
|
|
|
|
addShopCar; |
|
|
|
|
final Function(MiNiDetail miNiDetail, List<String> selectSkus) add; |
|
|
|
|
final Function(MiNiDetail miNiDetail, List<String> selectSkus) reduce; |
|
|
|
|
final ShoppingCart shopCarGoods; |
|
|
|
|
final int buttonType; |
|
|
|
|
final int buttonType; |
|
|
|
|
|
|
|
|
|
ProductSku( |
|
|
|
|
this.miNiDetail, |
|
|
|
|
this.shopCarGoods, |
|
|
|
|
this.productId, |
|
|
|
|
this.addShopCar, |
|
|
|
|
this.add, |
|
|
|
|
this.reduce, |
|
|
|
|
{ this.buttonType} |
|
|
|
|
); |
|
|
|
|
ProductSku(this.miNiDetail, this.shopCarGoods, this.productId, |
|
|
|
|
this.addShopCar, this.add, this.reduce, |
|
|
|
|
{this.buttonType}); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
State<StatefulWidget> createState() { |
|
|
|
@ -36,8 +31,9 @@ class ProductSku extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
class _ProductSku extends State<ProductSku> { |
|
|
|
|
List<String> selectSkus = []; |
|
|
|
|
int count = 1; |
|
|
|
|
int count = 1, realCount = 0; |
|
|
|
|
String selectedPrice = ""; |
|
|
|
|
bool _isTapEd = false; |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void initState() { |
|
|
|
@ -57,16 +53,19 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
productSku = widget.miNiDetail.productSkuVOList.firstWhere((element) { |
|
|
|
|
return skuY(element, selectSkus); |
|
|
|
|
}); |
|
|
|
|
}catch(ex){ |
|
|
|
|
} catch (ex) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (productSku == null) return; |
|
|
|
|
selectedPrice = productSku.skuPrice; |
|
|
|
|
String skuId = productSku.id; |
|
|
|
|
if (widget.shopCarGoods == null || widget.shopCarGoods.shoppingCartSkuItemList == null) return; |
|
|
|
|
int shopSkuIndex = widget.shopCarGoods.shoppingCartSkuItemList.indexWhere((element) => skuId == element.id); |
|
|
|
|
if (widget.shopCarGoods == null || |
|
|
|
|
widget.shopCarGoods.shoppingCartSkuItemList == null) return; |
|
|
|
|
int shopSkuIndex = widget.shopCarGoods.shoppingCartSkuItemList |
|
|
|
|
.indexWhere((element) => skuId == element.id); |
|
|
|
|
if (shopSkuIndex >= 0) { |
|
|
|
|
count = widget.shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum; |
|
|
|
|
realCount = count; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -81,19 +80,19 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
return gg; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
return WillPopScope( |
|
|
|
|
onWillPop: () async { |
|
|
|
|
debugPrint("ssssasdadsasdadasd"); |
|
|
|
|
SmartDialog.dismiss(); |
|
|
|
|
// debugPrint("ssssasdadsasdadasd"); |
|
|
|
|
// SmartDialog.dismiss(); |
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
return true; |
|
|
|
|
}, |
|
|
|
|
child: StatefulBuilder(builder: (context1, state) { |
|
|
|
|
return Container( |
|
|
|
|
alignment: Alignment.topCenter, |
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 14.w,vertical: 16), |
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 16), |
|
|
|
|
height: MediaQuery.of(context).size.height / 3 * 2, |
|
|
|
|
width: double.infinity, |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
@ -124,7 +123,8 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
SizedBox( |
|
|
|
|
width: 10, |
|
|
|
|
), |
|
|
|
|
Expanded(child:Column( |
|
|
|
|
Expanded( |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
@ -136,12 +136,15 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
if(widget.miNiDetail.attrList[0].attrName!="") |
|
|
|
|
if (widget.miNiDetail.attrList[0].attrName != "") |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsets.only(top: 4, bottom: 7), |
|
|
|
|
child: Text( |
|
|
|
|
"已选: " + |
|
|
|
|
(selectSkus.map((e) => "$e").toList().toString()), |
|
|
|
|
(selectSkus |
|
|
|
|
.map((e) => "$e") |
|
|
|
|
.toList() |
|
|
|
|
.toString()), |
|
|
|
|
maxLines: 1, |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
style: TextStyle( |
|
|
|
@ -175,8 +178,8 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
)), |
|
|
|
|
InkWell( |
|
|
|
|
onTap: () { |
|
|
|
|
// Navigator.of(context).pop(); |
|
|
|
|
SmartDialog.dismiss(); |
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
// SmartDialog.dismiss(); |
|
|
|
|
}, |
|
|
|
|
child: Image.asset( |
|
|
|
|
"assets/image/cancel.webp", |
|
|
|
@ -187,11 +190,14 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
if (widget.miNiDetail.attrList != null && widget.miNiDetail.attrList.length > 0) |
|
|
|
|
if (widget.miNiDetail.attrList != null && |
|
|
|
|
widget.miNiDetail.attrList.length > 0) |
|
|
|
|
SizedBox( |
|
|
|
|
height:10, |
|
|
|
|
height: 10, |
|
|
|
|
), |
|
|
|
|
if (widget.miNiDetail.attrList != null && widget.miNiDetail.attrList.length > 0 && widget.miNiDetail.attrList[0].attrName!="") |
|
|
|
|
if (widget.miNiDetail.attrList != null && |
|
|
|
|
widget.miNiDetail.attrList.length > 0 && |
|
|
|
|
widget.miNiDetail.attrList[0].attrName != "") |
|
|
|
|
Expanded( |
|
|
|
|
child: ListView.builder( |
|
|
|
|
itemCount: widget.miNiDetail.attrList.length, |
|
|
|
@ -200,7 +206,7 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
padding: EdgeInsets.zero, |
|
|
|
|
itemBuilder: (context, position) { |
|
|
|
|
return attrItem( |
|
|
|
|
(attrValue) { |
|
|
|
|
(attrValue) { |
|
|
|
|
state(() { |
|
|
|
|
selectSkus[position] = attrValue; |
|
|
|
|
buildCount(); |
|
|
|
@ -212,8 +218,8 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
if (widget.miNiDetail.attrList[0].attrName=="") |
|
|
|
|
Expanded(child: Container()), |
|
|
|
|
if (widget.miNiDetail.attrList[0].attrName == "") |
|
|
|
|
Expanded(child: Container()), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 24, |
|
|
|
|
), |
|
|
|
@ -231,12 +237,15 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
InkWell( |
|
|
|
|
onTap: () { |
|
|
|
|
if (count > 1) |
|
|
|
|
setState(() { |
|
|
|
|
count -= 1; |
|
|
|
|
}); |
|
|
|
|
widget.reduce(widget.miNiDetail, selectSkus); |
|
|
|
|
onTap: () async { |
|
|
|
|
if(count == 1) |
|
|
|
|
return; |
|
|
|
|
_isTapEd = true; |
|
|
|
|
EasyLoading.show(status: S.current.zhengzaijiazai); |
|
|
|
|
await widget.reduce(widget.miNiDetail, selectSkus); |
|
|
|
|
count -= 1; |
|
|
|
|
setState(() {}); |
|
|
|
|
EasyLoading.dismiss(); |
|
|
|
|
}, |
|
|
|
|
child: Image.asset( |
|
|
|
|
"assets/image/reduce.webp", |
|
|
|
@ -256,11 +265,17 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
InkWell( |
|
|
|
|
onTap: () { |
|
|
|
|
setState(() { |
|
|
|
|
count += 1; |
|
|
|
|
}); |
|
|
|
|
widget.add(widget.miNiDetail, selectSkus); |
|
|
|
|
onTap: () async { |
|
|
|
|
_isTapEd = true; |
|
|
|
|
EasyLoading.show(status: S.current.zhengzaijiazai); |
|
|
|
|
if (count == 1 && realCount == 0) |
|
|
|
|
await widget.addShopCar( |
|
|
|
|
widget.miNiDetail, selectSkus, 2); |
|
|
|
|
else |
|
|
|
|
await widget.add(widget.miNiDetail, selectSkus); |
|
|
|
|
count += 1; |
|
|
|
|
setState(() {}); |
|
|
|
|
EasyLoading.dismiss(); |
|
|
|
|
}, |
|
|
|
|
child: Image.asset( |
|
|
|
|
"assets/image/add.webp", |
|
|
|
@ -273,7 +288,7 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
SizedBox( |
|
|
|
|
height: 24, |
|
|
|
|
), |
|
|
|
|
if(widget.buttonType != 1) |
|
|
|
|
if (widget.buttonType != 1) |
|
|
|
|
RoundButton( |
|
|
|
|
width: double.infinity, |
|
|
|
|
height: 54.h, |
|
|
|
@ -284,12 +299,13 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
callback: () { |
|
|
|
|
// Navigator.of(context).pop(); |
|
|
|
|
SmartDialog.dismiss(); |
|
|
|
|
widget.addShopCar(widget.miNiDetail, selectSkus, 1); |
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
// SmartDialog.dismiss(); |
|
|
|
|
if (!_isTapEd) |
|
|
|
|
widget.addShopCar(widget.miNiDetail, selectSkus, 1); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
if(widget.buttonType == 1) |
|
|
|
|
if (widget.buttonType == 1) |
|
|
|
|
RoundButton( |
|
|
|
|
width: double.infinity, |
|
|
|
|
height: 54.h, |
|
|
|
@ -300,72 +316,21 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
callback: () { |
|
|
|
|
// Navigator.of(context).pop(); |
|
|
|
|
SmartDialog.dismiss(); |
|
|
|
|
widget.addShopCar(widget.miNiDetail, selectSkus,count); |
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
// SmartDialog.dismiss(); |
|
|
|
|
widget.addShopCar(widget.miNiDetail, selectSkus, count); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
///秒杀按钮 |
|
|
|
|
if(widget.buttonType == 2) |
|
|
|
|
if (widget.buttonType == 2) |
|
|
|
|
Row( |
|
|
|
|
children: [ |
|
|
|
|
Expanded(child: GestureDetector( |
|
|
|
|
onTap: (){ |
|
|
|
|
Navigator.of(context).pushReplacementNamed('/router/group_details'); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
width: 120.w, |
|
|
|
|
height:40.h, |
|
|
|
|
margin: EdgeInsets.only(left: 6.w), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.circular(16), |
|
|
|
|
border: Border.all( |
|
|
|
|
width: 1, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
style: BorderStyle.solid, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Text.rich( |
|
|
|
|
TextSpan( |
|
|
|
|
children: [ |
|
|
|
|
TextSpan( |
|
|
|
|
text: "¥", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 7.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text: "284.00", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Expanded(child: |
|
|
|
|
Text( |
|
|
|
|
"原价购买", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
),), |
|
|
|
|
Expanded(child: GestureDetector( |
|
|
|
|
onTap: (){ |
|
|
|
|
Navigator.of(context).popAndPushNamed('/router/bargain_details'); |
|
|
|
|
Expanded( |
|
|
|
|
child: GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
Navigator.of(context) |
|
|
|
|
.pushReplacementNamed('/router/group_details'); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
@ -373,16 +338,12 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
height: 40.h, |
|
|
|
|
margin: EdgeInsets.only(left: 6.w), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
borderRadius: BorderRadius.circular(16), |
|
|
|
|
boxShadow: [ |
|
|
|
|
BoxShadow( |
|
|
|
|
color: Colors.black.withAlpha(12), |
|
|
|
|
offset: Offset(0, 3), |
|
|
|
|
blurRadius: 14, |
|
|
|
|
spreadRadius: 0, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
border: Border.all( |
|
|
|
|
width: 1, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
style: BorderStyle.solid, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
@ -394,7 +355,7 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 7.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Colors.white, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
@ -402,89 +363,99 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Colors.white, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Expanded(child: |
|
|
|
|
Text( |
|
|
|
|
"我要砍价", |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
"原价购买", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Colors.white, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
),), |
|
|
|
|
)), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
)),), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
///砍价 |
|
|
|
|
if(widget.buttonType == 3) |
|
|
|
|
Row( |
|
|
|
|
children: [ |
|
|
|
|
Expanded(child:GestureDetector( |
|
|
|
|
onTap: (){ |
|
|
|
|
Navigator.of(context).popAndPushNamed('/router/group_details'); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
width: 120.w, |
|
|
|
|
height:40.h, |
|
|
|
|
margin: EdgeInsets.only(left: 6.w), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.circular(16), |
|
|
|
|
border: Border.all( |
|
|
|
|
width: 1, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
style: BorderStyle.solid, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Text.rich( |
|
|
|
|
TextSpan( |
|
|
|
|
children: [ |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
Navigator.of(context) |
|
|
|
|
.popAndPushNamed('/router/bargain_details'); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
width: 120.w, |
|
|
|
|
height: 40.h, |
|
|
|
|
margin: EdgeInsets.only(left: 6.w), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
borderRadius: BorderRadius.circular(16), |
|
|
|
|
boxShadow: [ |
|
|
|
|
BoxShadow( |
|
|
|
|
color: Colors.black.withAlpha(12), |
|
|
|
|
offset: Offset(0, 3), |
|
|
|
|
blurRadius: 14, |
|
|
|
|
spreadRadius: 0, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Text.rich( |
|
|
|
|
TextSpan( |
|
|
|
|
text: "¥", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 7.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
children: [ |
|
|
|
|
TextSpan( |
|
|
|
|
text: "¥", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 7.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Colors.white, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text: "284.00", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Colors.white, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text: "284.00", |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
"我要砍价", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
color: Colors.white, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
Expanded(child: |
|
|
|
|
Text( |
|
|
|
|
"原价购买", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
),), |
|
|
|
|
Expanded(child:GestureDetector( |
|
|
|
|
onTap: (){ |
|
|
|
|
Navigator.of(context).popAndPushNamed('/router/bargain_details'); |
|
|
|
|
)), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
///砍价 |
|
|
|
|
if (widget.buttonType == 3) |
|
|
|
|
Row( |
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
|
child: GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
Navigator.of(context) |
|
|
|
|
.popAndPushNamed('/router/group_details'); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
@ -492,16 +463,12 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
height: 40.h, |
|
|
|
|
margin: EdgeInsets.only(left: 6.w), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
borderRadius: BorderRadius.circular(16), |
|
|
|
|
boxShadow: [ |
|
|
|
|
BoxShadow( |
|
|
|
|
color: Colors.black.withAlpha(12), |
|
|
|
|
offset: Offset(0, 3), |
|
|
|
|
blurRadius: 14, |
|
|
|
|
spreadRadius: 0, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
border: Border.all( |
|
|
|
|
width: 1, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
style: BorderStyle.solid, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
@ -513,7 +480,7 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 7.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Colors.white, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
@ -521,87 +488,99 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Colors.white, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Expanded(child: |
|
|
|
|
Text( |
|
|
|
|
"我要秒杀", |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
"原价购买", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Colors.white, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
),), |
|
|
|
|
)), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
)),), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
///拼团按钮 |
|
|
|
|
if(widget.buttonType == 4) |
|
|
|
|
Row( |
|
|
|
|
children: [ |
|
|
|
|
Expanded(child: GestureDetector( |
|
|
|
|
onTap: (){ |
|
|
|
|
Navigator.of(context).popAndPushNamed('/router/group_details'); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
width: 120.w, |
|
|
|
|
height:40.h, |
|
|
|
|
margin: EdgeInsets.only(left: 6.w), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.circular(16), |
|
|
|
|
border: Border.all( |
|
|
|
|
width: 1, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
style: BorderStyle.solid, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Text.rich( |
|
|
|
|
TextSpan( |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
Navigator.of(context) |
|
|
|
|
.popAndPushNamed('/router/bargain_details'); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
width: 120.w, |
|
|
|
|
height: 40.h, |
|
|
|
|
margin: EdgeInsets.only(left: 6.w), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
borderRadius: BorderRadius.circular(16), |
|
|
|
|
boxShadow: [ |
|
|
|
|
BoxShadow( |
|
|
|
|
color: Colors.black.withAlpha(12), |
|
|
|
|
offset: Offset(0, 3), |
|
|
|
|
blurRadius: 14, |
|
|
|
|
spreadRadius: 0, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
TextSpan( |
|
|
|
|
text: "¥", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 7.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
Text.rich( |
|
|
|
|
TextSpan( |
|
|
|
|
children: [ |
|
|
|
|
TextSpan( |
|
|
|
|
text: "¥", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 7.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Colors.white, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text: "284.00", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Colors.white, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text: "284.00", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
"我要秒杀", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Colors.white, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Expanded(child: |
|
|
|
|
Text( |
|
|
|
|
"单人购买", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
Expanded(child:GestureDetector( |
|
|
|
|
onTap: (){ |
|
|
|
|
Navigator.of(context).popAndPushNamed('/router/bargain_details'); |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
///拼团按钮 |
|
|
|
|
if (widget.buttonType == 4) |
|
|
|
|
Row( |
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
|
child: GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
Navigator.of(context) |
|
|
|
|
.popAndPushNamed('/router/group_details'); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
@ -609,16 +588,12 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
height: 40.h, |
|
|
|
|
margin: EdgeInsets.only(left: 6.w), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
borderRadius: BorderRadius.circular(16), |
|
|
|
|
boxShadow: [ |
|
|
|
|
BoxShadow( |
|
|
|
|
color: Colors.black.withAlpha(12), |
|
|
|
|
offset: Offset(0, 3), |
|
|
|
|
blurRadius: 14, |
|
|
|
|
spreadRadius: 0, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
border: Border.all( |
|
|
|
|
width: 1, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
style: BorderStyle.solid, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
@ -630,7 +605,7 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 7.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Colors.white, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
@ -638,26 +613,88 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Colors.white, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Expanded(child: |
|
|
|
|
Text( |
|
|
|
|
"我要开团", |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
"单人购买", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Colors.white, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
),), |
|
|
|
|
)), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
)),), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
Expanded( |
|
|
|
|
child: GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
Navigator.of(context) |
|
|
|
|
.popAndPushNamed('/router/bargain_details'); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
width: 120.w, |
|
|
|
|
height: 40.h, |
|
|
|
|
margin: EdgeInsets.only(left: 6.w), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
borderRadius: BorderRadius.circular(16), |
|
|
|
|
boxShadow: [ |
|
|
|
|
BoxShadow( |
|
|
|
|
color: Colors.black.withAlpha(12), |
|
|
|
|
offset: Offset(0, 3), |
|
|
|
|
blurRadius: 14, |
|
|
|
|
spreadRadius: 0, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Text.rich( |
|
|
|
|
TextSpan( |
|
|
|
|
children: [ |
|
|
|
|
TextSpan( |
|
|
|
|
text: "¥", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 7.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Colors.white, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text: "284.00", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Colors.white, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
"我要开团", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Colors.white, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 21.h, |
|
|
|
|
), |
|
|
|
@ -669,7 +706,8 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Widget attrItem(Function fc, AttrListBean attrListBean, position) { |
|
|
|
|
if (attrListBean.attrValueList != null && attrListBean.attrValueList.length > 0) |
|
|
|
|
if (attrListBean.attrValueList != null && |
|
|
|
|
attrListBean.attrValueList.length > 0) |
|
|
|
|
return Column( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
@ -684,7 +722,7 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
sweetnessStore(fc,attrListBean.attrValueList, position), |
|
|
|
|
sweetnessStore(fc, attrListBean.attrValueList, position), |
|
|
|
|
// sweetnessStore(fc, attrListBean.attrValueList, position), |
|
|
|
|
], |
|
|
|
|
); |
|
|
|
@ -723,16 +761,17 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
// ); |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
Widget sweetnessStore(Function fc,List<AttrValueListBean> arrays, position){ |
|
|
|
|
Widget sweetnessStore(Function fc, List<AttrValueListBean> arrays, position) { |
|
|
|
|
return Wrap( |
|
|
|
|
runSpacing: 10.0, |
|
|
|
|
spacing: 10.0, |
|
|
|
|
children: arrays.take(arrays.length).map<Widget>((AttrValueListBean tag) { |
|
|
|
|
children: |
|
|
|
|
arrays.take(arrays.length).map<Widget>((AttrValueListBean tag) { |
|
|
|
|
return GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
fc(tag.attrValue); |
|
|
|
|
}, |
|
|
|
|
child:sweetnessItem( |
|
|
|
|
child: sweetnessItem( |
|
|
|
|
tag.attrValue, |
|
|
|
|
(tag.attrValue == selectSkus[position]) ?? false, |
|
|
|
|
)); |
|
|
|
@ -741,27 +780,26 @@ class _ProductSku extends State<ProductSku> {
|
|
|
|
|
|
|
|
|
|
Widget sweetnessItem(String name, bool isCheck) { |
|
|
|
|
return Container( |
|
|
|
|
padding: const EdgeInsets.symmetric(vertical:5.0,horizontal: 12.0), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: !isCheck ? Color(0xFFF2F2F2) : Color(0xFFF0FAF4), |
|
|
|
|
border: Border.all( |
|
|
|
|
width: !isCheck ? 0:1, |
|
|
|
|
color: !isCheck ? Color(0xFFF2F2F2):Color(0xFF32A060), |
|
|
|
|
style: BorderStyle.solid, |
|
|
|
|
), |
|
|
|
|
borderRadius: const BorderRadius.all( |
|
|
|
|
Radius.circular(4.0), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
child: Text( |
|
|
|
|
name, |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color:!isCheck ? Color(0xFF4D4D4D) : Color(0xFF32A060), |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 5.0, horizontal: 12.0), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: !isCheck ? Color(0xFFF2F2F2) : Color(0xFFF0FAF4), |
|
|
|
|
border: Border.all( |
|
|
|
|
width: !isCheck ? 0 : 1, |
|
|
|
|
color: !isCheck ? Color(0xFFF2F2F2) : Color(0xFF32A060), |
|
|
|
|
style: BorderStyle.solid, |
|
|
|
|
), |
|
|
|
|
borderRadius: const BorderRadius.all( |
|
|
|
|
Radius.circular(4.0), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
)); |
|
|
|
|
child: Text( |
|
|
|
|
name, |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: !isCheck ? Color(0xFF4D4D4D) : Color(0xFF32A060), |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
), |
|
|
|
|
)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|