Browse Source

safety

master
fmk 3 years ago
parent
commit
74623d38fe
  1. 121
      lib/store/store_view/product_sku.dart
  2. 10
      lib/store/store_view/store_order_list.dart

121
lib/store/store_view/product_sku.dart

@ -2,15 +2,16 @@ import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/findMiNiGroupList.dart'; import 'package:huixiang/retrofit/data/findMiNiGroupList.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/retrofit/data/miNiDetail.dart';
import 'package:huixiang/store/store_view/store_order_list.dart'; import 'package:huixiang/store/store_view/store_order_list.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
class ProductSku extends StatefulWidget { class ProductSku extends StatefulWidget {
final ProductListBean productListBean; final MiNiDetail miNiDetail;
ProductSku(this.productListBean); ProductSku(this.miNiDetail);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -19,13 +20,6 @@ class ProductSku extends StatefulWidget {
} }
class _ProductSku extends State<ProductSku> { class _ProductSku extends State<ProductSku> {
List<testModel> temperatureStoreList = [
testModel("正常冰"),
testModel("少冰"),
testModel("多冰"),
testModel("去冰")
];
List<testModel> sweetnessStoreList = [testModel("正常糖"), testModel("5分糖")];
int isChoice = 0; int isChoice = 0;
int tempClickIndex = 0; int tempClickIndex = 0;
@ -33,11 +27,7 @@ class _ProductSku extends State<ProductSku> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
padding: EdgeInsets.only( padding: EdgeInsets.only(top: 16, left: 16, right: 16),
top: 16,
left: 16,
right: 16,
),
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFFFAFAFA), color: Color(0xFFFAFAFA),
@ -55,21 +45,19 @@ class _ProductSku extends State<ProductSku> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
MImage( MImage(
widget.productListBean.imgPath, widget.miNiDetail.imgs[0],
width: 70, width: 70,
height: 70, height: 70,
fit: BoxFit.cover, fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png", errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png", fadeSrc: "assets/image/default_1.png",
), ),
SizedBox( SizedBox(width: 10),
width: 10,
),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
widget.productListBean.productName, widget.miNiDetail.productName,
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontSize: 16.sp, fontSize: 16.sp,
@ -98,7 +86,7 @@ class _ProductSku extends State<ProductSku> {
), ),
), ),
Text( Text(
widget.productListBean.applyPrice, widget.miNiDetail.price,
style: TextStyle( style: TextStyle(
color: Color(0xFFFF7A1A), color: Color(0xFFFF7A1A),
fontSize: 14.sp, fontSize: 14.sp,
@ -125,57 +113,33 @@ class _ProductSku extends State<ProductSku> {
SizedBox( SizedBox(
height: 23, height: 23,
), ),
Text( Expanded(
"温度", child: ListView.builder(
style: TextStyle( itemCount: widget.miNiDetail.attrList.length,
color: Colors.black, scrollDirection: Axis.vertical,
fontSize: 14.sp, physics: BouncingScrollPhysics(),
fontWeight: MyFontWeight.regular, itemBuilder: (context, position) {
), return attrItem(
), () {
SizedBox( setState(() {
height: 15, for (var i = 0;
), i <
sweetnessStore( widget.miNiDetail.attrList[position].attrValueList
() { .length;
setState(() { i++) {
for (var i = 0; i < temperatureStoreList.length; i++) { if (tempClickIndex == i)
if (tempClickIndex == i) widget.miNiDetail.attrList[position].attrValueList[i]
temperatureStoreList[i].isSelected = true; .isSelected = true;
else else
temperatureStoreList[i].isSelected = false; widget.miNiDetail.attrList[position].attrValueList[i]
} .isSelected = false;
}); }
}, });
temperatureStoreList, },
), widget.miNiDetail.attrList[position],
SizedBox( );
height: 24,
),
Text(
"甜度",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
SizedBox(
height: 15,
),
sweetnessStore(
() {
setState(() {
for (var i = 0; i < sweetnessStoreList.length; i++) {
if (tempClickIndex == i)
sweetnessStoreList[i].isSelected = true;
else
sweetnessStoreList[i].isSelected = false;
}
});
}, },
sweetnessStoreList, )),
),
SizedBox( SizedBox(
height: 24, height: 24,
), ),
@ -183,15 +147,14 @@ class _ProductSku extends State<ProductSku> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
"数量", "数量",
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
),
), ),
), )),
InkWell( InkWell(
onTap: () {}, onTap: () {},
child: Image.asset( child: Image.asset(
@ -203,7 +166,7 @@ class _ProductSku extends State<ProductSku> {
Padding( Padding(
padding: EdgeInsets.only(left: 8, right: 8), padding: EdgeInsets.only(left: 8, right: 8),
child: Text( child: Text(
widget.productListBean.buyNum.toString(), "1",
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontSize: 14.sp, fontSize: 14.sp,

10
lib/store/store_view/store_order_list.dart

@ -368,8 +368,12 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
context: context, context: context,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
builder: (context) { builder: (context) {
return StatefulBuilder(builder: (context1, state) { return StatefulBuilder(builder: (context1, state)
return ProductSku(productListBean); {
return ProductSku(miNiDetail);
});
}
);
}
} }

Loading…
Cancel
Save