Browse Source

safety

master
fmk 3 years ago
parent
commit
f27b1aca3c
  1. 32
      lib/retrofit/data/miNiDetail.dart
  2. 7
      lib/retrofit/min_api.dart
  3. 33
      lib/retrofit/min_api.g.dart
  4. 193
      lib/store/store_order.dart
  5. 384
      lib/store/store_view/product_sku.dart
  6. 274
      lib/store/store_view/shop_car.dart
  7. 278
      lib/store/store_view/store_order_list.dart

32
lib/retrofit/data/miNiDetail.dart

@ -83,7 +83,7 @@ class MiNiDetail {
dynamic namePinyin;
dynamic nameInitials;
static MiNiDetail fromMap(Map<String, dynamic> map) {
static MiNiDetail fromJson(Map<String, dynamic> map) {
if (map == null) return null;
MiNiDetail miNiDetailBean = MiNiDetail();
miNiDetailBean.id = map['id'];
@ -115,15 +115,15 @@ class MiNiDetail {
miNiDetailBean.isDelete = map['isDelete'];
miNiDetailBean.printerFlag = map['printerFlag'];
miNiDetailBean.materialId = map['materialId'];
miNiDetailBean.imgs = List()..addAll(
miNiDetailBean.imgs = []..addAll(
(map['imgs'] as List ?? []).map((o) => o.toString())
);
miNiDetailBean.storeDTO = StoreDTOBean.fromMap(map['storeDTO']);
miNiDetailBean.attrList = List()..addAll(
(map['attrList'] as List ?? []).map((o) => AttrListBean.fromMap(o))
miNiDetailBean.storeDTO = StoreDTOBean.fromJson(map['storeDTO']);
miNiDetailBean.attrList = []..addAll(
(map['attrList'] as List ?? []).map((o) => AttrListBean.fromJson(o))
);
miNiDetailBean.productSkuVOList = List()..addAll(
(map['productSkuVOList'] as List ?? []).map((o) => ProductSkuVOListBean.fromMap(o))
miNiDetailBean.productSkuVOList = []..addAll(
(map['productSkuVOList'] as List ?? []).map((o) => ProductSkuVOListBean.fromJson(o))
);
miNiDetailBean.shipAddress = map['shipAddress'];
miNiDetailBean.buyCount = map['buyCount'];
@ -232,7 +232,7 @@ class ProductSkuVOListBean {
List<SkuAttrListBean> skuAttrList;
dynamic setMealDTOList;
static ProductSkuVOListBean fromMap(Map<String, dynamic> map) {
static ProductSkuVOListBean fromJson(Map<String, dynamic> map) {
if (map == null) return null;
ProductSkuVOListBean productSkuVOListBean = ProductSkuVOListBean();
productSkuVOListBean.id = map['id'];
@ -257,8 +257,8 @@ class ProductSkuVOListBean {
productSkuVOListBean.material = map['material'];
productSkuVOListBean.version = map['version'];
productSkuVOListBean.skuAttrCodeDTOList = map['skuAttrCodeDTOList'];
productSkuVOListBean.skuAttrList = List()..addAll(
(map['skuAttrList'] as List ?? []).map((o) => SkuAttrListBean.fromMap(o))
productSkuVOListBean.skuAttrList = []..addAll(
(map['skuAttrList'] as List ?? []).map((o) => SkuAttrListBean.fromJson(o))
);
productSkuVOListBean.setMealDTOList = map['setMealDTOList'];
return productSkuVOListBean;
@ -315,7 +315,7 @@ class SkuAttrListBean {
dynamic sortOrder;
int isDelete;
static SkuAttrListBean fromMap(Map<String, dynamic> map) {
static SkuAttrListBean fromJson(Map<String, dynamic> map) {
if (map == null) return null;
SkuAttrListBean skuAttrListBean = SkuAttrListBean();
skuAttrListBean.id = map['id'];
@ -364,7 +364,7 @@ class AttrListBean {
String id;
List<AttrValueListBean> attrValueList;
static AttrListBean fromMap(Map<String, dynamic> map) {
static AttrListBean fromJson(Map<String, dynamic> map) {
if (map == null) return null;
AttrListBean attrListBean = AttrListBean();
attrListBean.productId = map['productId'];
@ -374,8 +374,8 @@ class AttrListBean {
attrListBean.isDelete = map['isDelete'];
attrListBean.attrCode = map['attrCode'];
attrListBean.id = map['id'];
attrListBean.attrValueList = List()..addAll(
(map['attrValueList'] as List ?? []).map((o) => AttrValueListBean.fromMap(o))
attrListBean.attrValueList = []..addAll(
(map['attrValueList'] as List ?? []).map((o) => AttrValueListBean.fromJson(o))
);
return attrListBean;
}
@ -410,7 +410,7 @@ class AttrValueListBean {
dynamic attrValueCode;
bool isSelected;
static AttrValueListBean fromMap(Map<String, dynamic> map) {
static AttrValueListBean fromJson(Map<String, dynamic> map) {
if (map == null) return null;
AttrValueListBean attrValueListBean = AttrValueListBean();
attrValueListBean.id = map['id'];
@ -449,7 +449,7 @@ class StoreDTOBean {
int productCount;
int soldNum;
static StoreDTOBean fromMap(Map<String, dynamic> map) {
static StoreDTOBean fromJson(Map<String, dynamic> map) {
if (map == null) return null;
StoreDTOBean storeDTOBean = StoreDTOBean();
storeDTOBean.id = map['id'];

7
lib/retrofit/min_api.dart

@ -71,14 +71,17 @@ abstract class MinApiService {
EasyLoading.dismiss();
}
debugPrint("code = ${response.statusCode}");
p(jsonEncode(response.data));
// p(jsonEncode(response.data));
debugPrint(jsonEncode(response.data), wrapWidth: response.data.toString().length);
Map map = response.data;
if (map["code"] != 0) {
EasyLoading.dismiss();
}
if (map["code"] == 40005 || map["code"] == 40001) {
if (!LoginTipsDialog().isShow) {
print("show: ${LoginTipsDialog().isShow}");
// print("show: ${LoginTipsDialog().isShow}");
LoginTipsDialog().show(context);
}
} else if (map["code"] != 0 && response.request.baseUrl == baseUrl) {

33
lib/retrofit/min_api.g.dart

@ -17,22 +17,18 @@ class _MinApiService implements MinApiService {
String baseUrl;
@override
Future<BaseData<List<FindMiNiGroupList>>> findMiNiGroupList(
param, header) async {
Future<BaseData<List<FindMiNiGroupList>>> findMiNiGroupList(param) async {
ArgumentError.checkNotNull(param, 'param');
ArgumentError.checkNotNull(header, 'header');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _header= <String, dynamic>{};
_header.addAll(header ?? <String,dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>(
'product/findMiNiGroupList',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: _header,
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
@ -62,7 +58,30 @@ class _MinApiService implements MinApiService {
data: _data);
final value = BaseData<MiNiDetail>.fromJson(
_result.data,
(json) => MiNiDetail.fromMap(json),
(json) => MiNiDetail.fromJson(json),
);
return value;
}
@override
Future<BaseData<FindMiNiGroupList>> shoppingCart(param, header) async {
ArgumentError.checkNotNull(param, 'param');
ArgumentError.checkNotNull(header, 'header');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>('shoppingcart',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<FindMiNiGroupList>.fromJson(
_result.data,
(json) => FindMiNiGroupList.fromJson(json),
);
return value;
}

193
lib/store/store_order.dart

@ -176,12 +176,6 @@ class _StoreOrderPage extends State<StoreOrderPage>
Positioned(
child: Column(
children: [
// Image.asset(
// "assets/image/share_image_bg.png",
// fit: BoxFit.cover,
// width: MediaQuery.of(context).size.width,
// height: 180.h,
// ),
buildSwiper(),
Expanded(
child: Container(
@ -203,77 +197,78 @@ class _StoreOrderPage extends State<StoreOrderPage>
///
StoreInfoView(storeInfo),
///
if (storeInfo != null &&
storeInfo.couponVOList != null)
UnionCoupon(
storeInfo,
(a) {},
coupon: true,
),
///
if (storeInfo != null &&
storeInfo.couponVOList != null)
UnionCoupon(
storeInfo,
(a) {},
coupon: true,
),
SizedBox(
height: 8,
),
SizedBox(
height: 8,
),
///VIP信息
Vip(storeInfo, () {}, false),
],
///VIP信息
Vip(storeInfo, () {}, false),
],
),
),
top: 110.h,
bottom: 0,
left: 0,
right: 0,
),
top: 110.h,
bottom: 0,
left: 0,
right: 0,
),
],
),
),
backgroundColor: Color(0x33FAFAFA),
centerTitle: false,
elevation: 0,
bottom: PreferredSize(
preferredSize: Size(
MediaQuery.of(context).size.width,
38,
],
),
),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 10.w),
width: MediaQuery.of(context).size.width,
child: TabBar(
controller: tabcontroller,
automaticIndicatorColorAdjustment: true,
isScrollable: true,
indicatorWeight: 1,
indicatorColor: Color(0xFFFAFAFA),
labelPadding:
EdgeInsets.only(left: 8.w, right: 8.w),
indicatorSize: TabBarIndicatorSize.label,
unselectedLabelStyle: TextStyle(
fontSize: 15.sp,
fontWeight: FontWeight.w400,
),
labelStyle: TextStyle(
color: Colors.black,
fontSize: 18.sp,
fontWeight: FontWeight.bold,
backgroundColor: Color(0x33FAFAFA),
centerTitle: false,
elevation: 0,
bottom: PreferredSize(
preferredSize: Size(
MediaQuery.of(context).size.width,
38,
),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 10.w),
width: MediaQuery.of(context).size.width,
child: TabBar(
controller: tabcontroller,
automaticIndicatorColorAdjustment: true,
isScrollable: true,
indicatorWeight: 1,
indicatorColor: Color(0xFFFAFAFA),
labelPadding:
EdgeInsets.only(left: 8.w, right: 8.w),
indicatorSize: TabBarIndicatorSize.label,
unselectedLabelStyle: TextStyle(
fontSize: 15.sp,
fontWeight: FontWeight.w400,
),
labelStyle: TextStyle(
color: Colors.black,
fontSize: 18.sp,
fontWeight: FontWeight.bold,
),
labelColor: Colors.black,
tabs: [
MyTab(text: S.current.diancan),
MyTab(text: S.current.xindianhuodong),
],
),
labelColor: Colors.black,
tabs: [
MyTab(text: S.current.diancan),
MyTab(text: S.current.xindianhuodong),
],
),
),
),
),
),
];
},
body: TabBarView(
physics: BouncingScrollPhysics(),
children: _widgetOptions,
controller: tabcontroller,
];
},
body: TabBarView(
physics: BouncingScrollPhysics(),
children: _widgetOptions,
controller: tabcontroller,
),
),
),
),
@ -363,7 +358,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
),
],
),
)
),
],
);
}
@ -373,34 +368,35 @@ class _StoreOrderPage extends State<StoreOrderPage>
width: double.infinity,
height: 180.h,
child: Swiper(
pagination: SwiperPagination(
alignment: Alignment.bottomCenter,
builder: DotSwiperPaginationBuilder(
size: 8.w,
activeSize: 8.w,
space: 5.w,
activeColor: Colors.white,
color: Colors.white.withAlpha(76),
),
pagination: SwiperPagination(
alignment: Alignment.bottomCenter,
builder: DotSwiperPaginationBuilder(
size: 8.w,
activeSize: 8.w,
space: 5.w,
activeColor: Colors.white,
color: Colors.white.withAlpha(76),
),
itemBuilder: (context, position) {
return Container(
child: MImage(
(storeInfo != null &&
storeInfo.bannerList != null &&
position < storeInfo.bannerList.length)
? storeInfo.bannerList[position].imgUrl
: "",
fit: BoxFit.cover,
radius: BorderRadius.zero,
errorSrc: "assets/image/default_2_1.png",
fadeSrc: "assets/image/default_2_1.png",
),
);
},
itemCount: (storeInfo != null && storeInfo.bannerList != null)
? storeInfo.bannerList.length
: 1),
),
itemBuilder: (context, position) {
return Container(
child: MImage(
(storeInfo != null &&
storeInfo.bannerList != null &&
position < storeInfo.bannerList.length)
? storeInfo.bannerList[position].imgUrl
: "",
fit: BoxFit.cover,
radius: BorderRadius.zero,
errorSrc: "assets/image/default_2_1.png",
fadeSrc: "assets/image/default_2_1.png",
),
);
},
itemCount: (storeInfo != null && storeInfo.bannerList != null)
? storeInfo.bannerList.length
: 1,
),
);
}
@ -412,9 +408,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
context: context,
backgroundColor: Colors.transparent,
builder: (context) {
return StatefulBuilder(builder: (context1, state) {
return ShopCar(productLists);
});
return ShopCar(productLists);
},
);
}
@ -454,7 +448,8 @@ class _Title extends State<Title> {
if (alphaProgress <= 1) {
alphatemp = 1;
} else if (alphaProgress <= alphaHeight) {
alphatemp = (((alphaHeight - alphaProgress) / alphaHeight) > 0.5) ? 1 : 0;
alphatemp =
(((alphaHeight - alphaProgress) / alphaHeight) > 0.5) ? 1 : 0;
} else {
alphatemp = 0;
}

384
lib/store/store_view/product_sku.dart

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/retrofit/data/miNiDetail.dart';
@ -23,190 +24,248 @@ class _ProductSku extends State<ProductSku> {
@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.topCenter,
padding: EdgeInsets.only(top: 16, left: 16, right: 16),
width: double.infinity,
decoration: BoxDecoration(
color: Color(0xFFFAFAFA),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
String selectSku = "";
int selectCount = 1;
return StatefulBuilder(builder: (context1, state) {
return Container(
alignment: Alignment.topCenter,
padding: EdgeInsets.only(
top: 16,
left: 16,
right: 16,
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
MImage(
widget.miNiDetail.imgs[0],
width: 70,
height: 70,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
SizedBox(
width: 10,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.miNiDetail.productName,
style: TextStyle(
color: Colors.black,
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
),
),
Padding(
padding: EdgeInsets.only(top: 4, bottom: 7),
child: Text(
"已选:正常冰",
width: double.infinity,
decoration: BoxDecoration(
color: Color(0xFFFAFAFA),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
MImage(
widget.miNiDetail.imgs[0],
width: 70,
height: 70,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
SizedBox(
width: 10,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.miNiDetail.productName,
style: TextStyle(
color: Color(0xFF727272),
fontSize: 11.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
),
),
),
Row(
children: [
Text(
S.of(context).huiyuanjia,
Padding(
padding: EdgeInsets.only(top: 4, bottom: 7),
child: Text(
"已选:" + selectSku,
style: TextStyle(
color: Color(0xFFFF7A1A),
fontSize: 13.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF727272),
fontSize: 11.sp,
fontWeight: MyFontWeight.regular,
),
),
Text(
widget.miNiDetail.price,
style: TextStyle(
color: Color(0xFFFF7A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
Row(
children: [
Text(
S.of(context).huiyuanjia,
style: TextStyle(
color: Color(0xFFFF7A1A),
fontSize: 13.sp,
fontWeight: MyFontWeight.medium,
),
),
),
],
Text(
widget.miNiDetail.price,
style: TextStyle(
color: Color(0xFFFF7A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
),
],
),
],
),
Spacer(),
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: Image.asset(
"assets/image/icon_order_cancel.png",
width: 22,
height: 22,
),
],
),
Spacer(),
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: Image.asset(
"assets/image/icon_order_cancel.png",
width: 22,
height: 22,
),
],
),
SizedBox(
height: 23,
),
Expanded(
child: ListView.builder(
itemCount: widget.miNiDetail.attrList.length,
scrollDirection: Axis.vertical,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return attrItem(
() {
state(() {
for (var i = 0;
i <
widget.miNiDetail.attrList[position]
.attrValueList.length;
i++) {
if (tempClickIndex == i)
widget.miNiDetail.attrList[position]
.attrValueList[i].isSelected = true;
else
widget.miNiDetail.attrList[position]
.attrValueList[i].isSelected = false;
}
selectSku = "";
widget.miNiDetail.attrList.forEach((e0) {
e0.attrValueList.forEach((e1) {
if (e1.isSelected ?? false)
selectSku += e1.attrValue + " ";
});
});
});
},
widget.miNiDetail.attrList[position],
);
},
),
],
),
SizedBox(
height: 23,
),
Expanded(
child: ListView.builder(
itemCount: widget.miNiDetail.attrList.length,
scrollDirection: Axis.vertical,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return attrItem(
() {
setState(() {
for (var i = 0;
i <
widget.miNiDetail.attrList[position].attrValueList
.length;
i++) {
if (tempClickIndex == i)
widget.miNiDetail.attrList[position].attrValueList[i]
.isSelected = true;
else
widget.miNiDetail.attrList[position].attrValueList[i]
.isSelected = false;
}
});
},
widget.miNiDetail.attrList[position],
);
},
),
),
SizedBox(
height: 24,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Text(
"数量",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
SizedBox(
height: 24,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Text(
"数量",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
),
),
InkWell(
onTap: () {},
child: Image.asset(
"assets/image/reduce.png",
width: 22,
height: 22,
InkWell(
onTap: () {
state(() {
if (selectCount > 1) selectCount--;
});
},
child: Image.asset(
"assets/image/reduce.png",
width: 22,
height: 22,
),
),
),
Padding(
padding: EdgeInsets.only(left: 8, right: 8),
child: Text(
"1",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
Padding(
padding: EdgeInsets.only(left: 8, right: 8),
child: Text(
selectCount.toString(),
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
),
),
),
InkWell(
onTap: () {},
child: Image.asset(
"assets/image/add.png",
width: 22,
height: 22,
InkWell(
onTap: () {
state(() {
selectCount++;
});
},
child: Image.asset(
"assets/image/add.png",
width: 22,
height: 22,
),
),
],
),
SizedBox(
height: 24,
),
GestureDetector(
onTap: () {
bool flag = false;
widget.miNiDetail.productSkuVOList.forEach((element) {
if (selectSku.trim() == element.skuNameStr) {
Navigator.of(context).pop();
flag = true;
}
});
if (!flag)
SmartDialog.showToast("请选择規格!", alignment: Alignment.center);
},
child: RoundButton(
width: double.infinity,
height: 54.h,
text: "加入购物车",
textColor: Colors.white,
fontWeight: MyFontWeight.semi_bold,
radius: 27,
backgroup: Color(0xFF32A060),
fontSize: 16.sp,
// padding: EdgeInsets.symmetric(vertical: 5.h),
),
],
),
SizedBox(
height: 24,
),
RoundButton(
width: double.infinity,
height: 54.h,
text: "加入购物车",
textColor: Colors.white,
fontWeight: MyFontWeight.semi_bold,
radius: 27,
backgroup: Color(0xFF32A060),
fontSize: 16.sp,
// padding: EdgeInsets.symmetric(vertical: 5.h),
callback: () { },
),
SizedBox(
height: 21.h,
),
],
),
);
});
}
Widget attrItem(Function fc, AttrListBean attrListBean) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(top: 24, bottom: 16),
child: Text(
attrListBean.attrName,
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
],
),
),
sweetnessStore(fc, attrListBean.attrValueList),
],
);
}
Widget sweetnessStore(Function fc, List<testModel> arrays) {
Widget sweetnessStore(Function fc, List<AttrValueListBean> arrays) {
return GridView.builder(
itemCount: arrays.length,
shrinkWrap: true,
@ -227,7 +286,8 @@ class _ProductSku extends State<ProductSku> {
tempClickIndex = index;
fc();
},
child: sweetnessItem(arrays[index].name, arrays[index].isSelected),
child: sweetnessItem(
arrays[index].attrValue, arrays[index].isSelected ?? false),
);
},
);

274
lib/store/store_view/shop_car.dart

@ -22,158 +22,160 @@ class ShopCar extends StatefulWidget {
class _ShopCar extends State<ShopCar> {
@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.topCenter,
width: double.infinity,
height: MediaQuery.of(context).size.height / 2,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.only(
top: 16,
left: 16,
right: 16,
bottom: 8,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"已选商品",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
),
InkWell(
onTap: () {},
child: Image.asset(
"assets/image/delete.png",
width: 22,
height: 22,
),
),
],
),
return StatefulBuilder(builder: (context1, state) {
return Container(
alignment: Alignment.topCenter,
width: double.infinity,
height: MediaQuery.of(context).size.height / 2,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
),
Expanded(
child: Container(
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.only(
top: 8,
top: 16,
left: 16,
right: 16,
bottom: 8,
),
child: ListView.builder(
itemCount: widget.productLists == null ? 0 : widget.productLists.length,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
// return shoppGoodsItem();
return GestureDetector(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"已选商品",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
),
InkWell(
onTap: () {},
child: ShopGoods(widget.productLists[position], position),
);
},
child: Image.asset(
"assets/image/delete.png",
width: 22,
height: 22,
),
),
],
),
),
),
Stack(
alignment: Alignment.bottomLeft,
children: [
Container(
height: 54.h,
decoration: BoxDecoration(
color: Color(0xFFFAFAFA),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(8),
offset: Offset(0, -1),
blurRadius: 3,
spreadRadius: 0,
),
],
Expanded(
child: Container(
padding: EdgeInsets.only(
top: 8,
left: 16,
right: 16,
),
child: Row(
children: [
Spacer(),
Text(
S.of(context).heji,
style: TextStyle(
fontSize: 12.sp,
child: ListView.builder(
itemCount: widget.productLists == null ? 0 : widget.productLists.length,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
// return shoppGoodsItem();
return GestureDetector(
onTap: () {},
child: ShopGoods(widget.productLists[position], position),
);
},
),
),
),
Stack(
alignment: Alignment.bottomLeft,
children: [
Container(
height: 54.h,
decoration: BoxDecoration(
color: Color(0xFFFAFAFA),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(8),
offset: Offset(0, -1),
blurRadius: 3,
spreadRadius: 0,
),
],
),
child: Row(
children: [
Spacer(),
Text(
S.of(context).heji,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
),
),
Text(
"¥19.00",
style: TextStyle(
fontSize: 20.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF32A060),
),
),
Spacer(),
RoundButton(
width: 103.w,
height: 54.h,
text: S.current.jiesuan,
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
color: Colors.black,
backgroup: Color(0xFF32A060),
radius: 0,
fontSize: 16.sp,
padding: EdgeInsets.symmetric(vertical: 5.h),
),
),
Text(
"¥19.00",
style: TextStyle(
fontSize: 20.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF32A060),
],
),
),
Stack(
children: [
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: Image.asset(
"assets/image/shopp.png",
width: 88,
height: 88,
),
),
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),
Positioned(
right: 15,
top: 14,
child: RoundButton(
width: 17,
height: 17,
text: "1",
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFF32A060),
fontSize: 12.sp,
radius: 100,
callback: () {
Navigator.of(context)
.pushNamed('/router/test_page');
},
),
),
],
),
),
Stack(
children: [
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: Image.asset(
"assets/image/shopp.png",
width: 88,
height: 88,
),
),
Positioned(
right: 15,
top: 14,
child: RoundButton(
width: 17,
height: 17,
text: "1",
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFF32A060),
fontSize: 12.sp,
radius: 100,
callback: () {
Navigator.of(context)
.pushNamed('/router/test_page');
},
),
),
],
),
],
),
],
),
);
],
),
],
),
);
});
}
}

278
lib/store/store_view/store_order_list.dart

@ -35,6 +35,7 @@ class StoreOrderListPage extends StatefulWidget {
class _StoreOrderListPage extends State<StoreOrderListPage> {
int isSelected = 0;
int tempClickIndex = 0;
ApiService apiService;
MinApiService minService;
List<FindMiNiGroupList> appletProducts;
@ -403,288 +404,13 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
///
showStoreSelector(MiNiDetail miNiDetail) {
String selectSku = "";
int selectCount = 1;
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (context) {
return StatefulBuilder(builder: (context1, state) {
return Container(
alignment: Alignment.topCenter,
padding: EdgeInsets.only(top: 16, left: 16, right: 16),
width: double.infinity,
decoration: BoxDecoration(
color: Color(0xFFFAFAFA),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
MImage(
miNiDetail.imgs[0],
width: 70,
height: 70,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
SizedBox(width: 10),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
miNiDetail.productName,
style: TextStyle(
color: Colors.black,
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
),
),
Padding(
padding: EdgeInsets.only(top: 4, bottom: 7),
child: Text(
"已选:" + selectSku,
style: TextStyle(
color: Color(0xFF727272),
fontSize: 11.sp,
fontWeight: MyFontWeight.regular,
),
),
),
Row(
children: [
Text(
S.of(context).huiyuanjia,
style: TextStyle(
color: Color(0xFFFF7A1A),
fontSize: 13.sp,
fontWeight: MyFontWeight.medium,
),
),
Text(
miNiDetail.price,
style: TextStyle(
color: Color(0xFFFF7A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
)
],
),
],
),
Spacer(),
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: Image.asset(
"assets/image/icon_order_cancel.png",
width: 22,
height: 22,
),
),
],
),
SizedBox(
height: 23,
),
Expanded(
child: ListView.builder(
itemCount: miNiDetail.attrList.length,
scrollDirection: Axis.vertical,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return attrItem(() {
state(() {
for (var i = 0;
i <
miNiDetail
.attrList[position].attrValueList.length;
i++) {
if (tempClickIndex == i)
miNiDetail.attrList[position].attrValueList[i]
.isSelected = true;
else
miNiDetail.attrList[position].attrValueList[i]
.isSelected = false;
}
selectSku = "";
miNiDetail.attrList.forEach((e0) {
e0.attrValueList.forEach((e1) {
if (e1.isSelected ?? false)
selectSku += e1.attrValue + " ";
});
});
});
}, miNiDetail.attrList[position]);
},
)),
SizedBox(
height: 24,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Text(
"数量",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
)),
InkWell(
onTap: () {
state(() {
if (selectCount > 1) selectCount--;
});
},
child: Image.asset(
"assets/image/reduce.png",
width: 22,
height: 22,
),
),
Padding(
padding: EdgeInsets.only(left: 8, right: 8),
child: Text(
selectCount.toString(),
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
),
),
InkWell(
onTap: () {
state(() {
selectCount++;
});
},
child: Image.asset(
"assets/image/add.png",
width: 22,
height: 22,
),
),
],
),
SizedBox(
height: 24,
),
GestureDetector(
onTap: () {
bool flag = false;
miNiDetail.productSkuVOList.forEach((element) {
if (selectSku.trim() == element.skuNameStr) {
Navigator.of(context).pop();
flag = true;
}
});
if (!flag)
SmartDialog.showToast("请选择規格!",
alignment: Alignment.center);
},
child: RoundButton(
width: double.infinity,
height: 54.h,
text: "加入购物车",
textColor: Colors.white,
fontWeight: MyFontWeight.semi_bold,
radius: 27,
backgroup: Color(0xFF32A060),
fontSize: 16.sp,
// padding: EdgeInsets.symmetric(vertical: 5.h),
),
),
SizedBox(
height: 21.h,
),
],
),
);
});
},
);
}
Widget attrItem(Function fc, AttrListBean attrListBean) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(top: 24, bottom: 16),
child: Text(
attrListBean.attrName,
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
)),
sweetnessStore(fc, attrListBean.attrValueList),
],
);
}
Widget sweetnessStore(Function fc, List<AttrValueListBean> arrays) {
return GridView.builder(
itemCount: arrays.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
//Widget数量
crossAxisCount: 4,
//Widget之间间距
crossAxisSpacing: 6.w,
//Widget之间间距
mainAxisSpacing: 12.w,
//Widget之间间距
childAspectRatio: 3 / 1),
itemBuilder: (contetx, index) {
return GestureDetector(
onTap: () {
tempClickIndex = index;
fc();
},
child: sweetnessItem(
arrays[index].attrValue, arrays[index].isSelected ?? false),
);
return ProductSku(miNiDetail);
},
);
}
Widget sweetnessItem(String name, bool isCheck) {
return Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RoundButton(
width: 68.w,
height: 29.h,
text: name,
textColor: !isCheck ? Color(0xFF727272) : Colors.white,
fontWeight: MyFontWeight.regular,
radius: 4,
backgroup: !isCheck ? Color(0xFFE5E5E5) : Color(0xFF32A060),
fontSize: 12.sp,
),
],
),
);
}
}

Loading…
Cancel
Save