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

7
lib/retrofit/min_api.dart

@ -71,14 +71,17 @@ abstract class MinApiService {
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
debugPrint("code = ${response.statusCode}"); 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; Map map = response.data;
if (map["code"] != 0) { if (map["code"] != 0) {
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
if (map["code"] == 40005 || map["code"] == 40001) { if (map["code"] == 40005 || map["code"] == 40001) {
if (!LoginTipsDialog().isShow) { if (!LoginTipsDialog().isShow) {
print("show: ${LoginTipsDialog().isShow}"); // print("show: ${LoginTipsDialog().isShow}");
LoginTipsDialog().show(context); LoginTipsDialog().show(context);
} }
} else if (map["code"] != 0 && response.request.baseUrl == baseUrl) { } 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; String baseUrl;
@override @override
Future<BaseData<List<FindMiNiGroupList>>> findMiNiGroupList( Future<BaseData<List<FindMiNiGroupList>>> findMiNiGroupList(param) async {
param, header) async {
ArgumentError.checkNotNull(param, 'param'); ArgumentError.checkNotNull(param, 'param');
ArgumentError.checkNotNull(header, 'header');
const _extra = <String, dynamic>{}; const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{}; final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{}; final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{}); _data.addAll(param ?? <String, dynamic>{});
final _header= <String, dynamic>{};
_header.addAll(header ?? <String,dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>( final _result = await _dio.request<Map<String, dynamic>>(
'product/findMiNiGroupList', 'product/findMiNiGroupList',
queryParameters: queryParameters, queryParameters: queryParameters,
options: RequestOptions( options: RequestOptions(
method: 'POST', method: 'POST',
headers: _header, headers: <String, dynamic>{},
extra: _extra, extra: _extra,
baseUrl: baseUrl), baseUrl: baseUrl),
data: _data); data: _data);
@ -62,7 +58,30 @@ class _MinApiService implements MinApiService {
data: _data); data: _data);
final value = BaseData<MiNiDetail>.fromJson( final value = BaseData<MiNiDetail>.fromJson(
_result.data, _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; return value;
} }

193
lib/store/store_order.dart

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

384
lib/store/store_view/product_sku.dart

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.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/retrofit/data/miNiDetail.dart';
@ -23,190 +24,248 @@ class _ProductSku extends State<ProductSku> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( String selectSku = "";
alignment: Alignment.topCenter, int selectCount = 1;
padding: EdgeInsets.only(top: 16, left: 16, right: 16), return StatefulBuilder(builder: (context1, state) {
width: double.infinity, return Container(
decoration: BoxDecoration( alignment: Alignment.topCenter,
color: Color(0xFFFAFAFA), padding: EdgeInsets.only(
borderRadius: BorderRadius.only( top: 16,
topLeft: Radius.circular(8), left: 16,
topRight: Radius.circular(8), right: 16,
), ),
), width: double.infinity,
child: Column( decoration: BoxDecoration(
mainAxisAlignment: MainAxisAlignment.start, color: Color(0xFFFAFAFA),
crossAxisAlignment: CrossAxisAlignment.start, borderRadius: BorderRadius.only(
children: [ topLeft: Radius.circular(8),
Row( topRight: Radius.circular(8),
mainAxisAlignment: MainAxisAlignment.start, ),
crossAxisAlignment: CrossAxisAlignment.start, ),
children: [ child: Column(
MImage( mainAxisAlignment: MainAxisAlignment.start,
widget.miNiDetail.imgs[0], crossAxisAlignment: CrossAxisAlignment.start,
width: 70, children: [
height: 70, Row(
fit: BoxFit.cover, mainAxisAlignment: MainAxisAlignment.start,
errorSrc: "assets/image/default_1.png", crossAxisAlignment: CrossAxisAlignment.start,
fadeSrc: "assets/image/default_1.png", children: [
), MImage(
SizedBox( widget.miNiDetail.imgs[0],
width: 10, width: 70,
), height: 70,
Column( fit: BoxFit.cover,
crossAxisAlignment: CrossAxisAlignment.start, errorSrc: "assets/image/default_1.png",
children: [ fadeSrc: "assets/image/default_1.png",
Text( ),
widget.miNiDetail.productName, SizedBox(
style: TextStyle( width: 10,
color: Colors.black, ),
fontSize: 16.sp, Column(
fontWeight: MyFontWeight.medium, crossAxisAlignment: CrossAxisAlignment.start,
), children: [
), Text(
Padding( widget.miNiDetail.productName,
padding: EdgeInsets.only(top: 4, bottom: 7),
child: Text(
"已选:正常冰",
style: TextStyle( style: TextStyle(
color: Color(0xFF727272), color: Colors.black,
fontSize: 11.sp, fontSize: 16.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.medium,
), ),
), ),
), Padding(
Row( padding: EdgeInsets.only(top: 4, bottom: 7),
children: [ child: Text(
Text( "已选:" + selectSku,
S.of(context).huiyuanjia,
style: TextStyle( style: TextStyle(
color: Color(0xFFFF7A1A), color: Color(0xFF727272),
fontSize: 13.sp, fontSize: 11.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.regular,
), ),
), ),
Text( ),
widget.miNiDetail.price, Row(
style: TextStyle( children: [
color: Color(0xFFFF7A1A), Text(
fontSize: 14.sp, S.of(context).huiyuanjia,
fontWeight: MyFontWeight.medium, 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(
SizedBox( height: 24,
height: 24, ),
), Row(
Row( 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: () {}, state(() {
child: Image.asset( if (selectCount > 1) selectCount--;
"assets/image/reduce.png", });
width: 22, },
height: 22, child: Image.asset(
"assets/image/reduce.png",
width: 22,
height: 22,
),
), ),
), Padding(
Padding( padding: EdgeInsets.only(left: 8, right: 8),
padding: EdgeInsets.only(left: 8, right: 8), child: Text(
child: Text( selectCount.toString(),
"1", style: TextStyle(
style: TextStyle( color: Colors.black,
color: Colors.black, fontSize: 14.sp,
fontSize: 14.sp, fontWeight: MyFontWeight.medium,
fontWeight: MyFontWeight.medium, ),
), ),
), ),
), InkWell(
InkWell( onTap: () {
onTap: () {}, state(() {
child: Image.asset( selectCount++;
"assets/image/add.png", });
width: 22, },
height: 22, 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(
SizedBox( height: 21.h,
height: 24, ),
), ],
RoundButton( ),
width: double.infinity, );
height: 54.h, });
text: "加入购物车", }
textColor: Colors.white,
fontWeight: MyFontWeight.semi_bold, Widget attrItem(Function fc, AttrListBean attrListBean) {
radius: 27, return Column(
backgroup: Color(0xFF32A060), crossAxisAlignment: CrossAxisAlignment.start,
fontSize: 16.sp, children: [
// padding: EdgeInsets.symmetric(vertical: 5.h), Padding(
callback: () { }, 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( return GridView.builder(
itemCount: arrays.length, itemCount: arrays.length,
shrinkWrap: true, shrinkWrap: true,
@ -227,7 +286,8 @@ class _ProductSku extends State<ProductSku> {
tempClickIndex = index; tempClickIndex = index;
fc(); 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> { class _ShopCar extends State<ShopCar> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return StatefulBuilder(builder: (context1, state) {
alignment: Alignment.topCenter, return Container(
width: double.infinity, alignment: Alignment.topCenter,
height: MediaQuery.of(context).size.height / 2, width: double.infinity,
decoration: BoxDecoration( height: MediaQuery.of(context).size.height / 2,
color: Colors.white, decoration: BoxDecoration(
borderRadius: BorderRadius.only( color: Colors.white,
topLeft: Radius.circular(8), borderRadius: BorderRadius.only(
topRight: Radius.circular(8), 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,
),
),
],
),
), ),
Expanded( ),
child: Container( child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 8, top: 16,
left: 16, left: 16,
right: 16, right: 16,
bottom: 8,
), ),
child: ListView.builder( child: Row(
itemCount: widget.productLists == null ? 0 : widget.productLists.length, mainAxisAlignment: MainAxisAlignment.spaceBetween,
physics: BouncingScrollPhysics(), crossAxisAlignment: CrossAxisAlignment.start,
itemBuilder: (context, position) { children: [
// return shoppGoodsItem(); Text(
return GestureDetector( "已选商品",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
),
InkWell(
onTap: () {}, onTap: () {},
child: ShopGoods(widget.productLists[position], position), child: Image.asset(
); "assets/image/delete.png",
}, width: 22,
height: 22,
),
),
],
), ),
), ),
), Expanded(
Stack( child: Container(
alignment: Alignment.bottomLeft, padding: EdgeInsets.only(
children: [ top: 8,
Container( left: 16,
height: 54.h, right: 16,
decoration: BoxDecoration(
color: Color(0xFFFAFAFA),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(8),
offset: Offset(0, -1),
blurRadius: 3,
spreadRadius: 0,
),
],
), ),
child: Row( child: ListView.builder(
children: [ itemCount: widget.productLists == null ? 0 : widget.productLists.length,
Spacer(), physics: BouncingScrollPhysics(),
Text( itemBuilder: (context, position) {
S.of(context).heji, // return shoppGoodsItem();
style: TextStyle( return GestureDetector(
fontSize: 12.sp, 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, 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( Stack(
fontSize: 20.sp, children: [
fontWeight: MyFontWeight.medium, InkWell(
color: Color(0xFF32A060), onTap: () {
Navigator.of(context).pop();
},
child: Image.asset(
"assets/image/shopp.png",
width: 88,
height: 88,
), ),
), ),
Spacer(), Positioned(
RoundButton( right: 15,
width: 103.w, top: 14,
height: 54.h, child: RoundButton(
text: S.current.jiesuan, width: 17,
textColor: Colors.white, height: 17,
fontWeight: MyFontWeight.regular, text: "1",
backgroup: Color(0xFF32A060), textColor: Colors.white,
radius: 0, fontWeight: MyFontWeight.regular,
fontSize: 16.sp, backgroup: Color(0xFF32A060),
padding: EdgeInsets.symmetric(vertical: 5.h), 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> { class _StoreOrderListPage extends State<StoreOrderListPage> {
int isSelected = 0; int isSelected = 0;
int tempClickIndex = 0;
ApiService apiService; ApiService apiService;
MinApiService minService; MinApiService minService;
List<FindMiNiGroupList> appletProducts; List<FindMiNiGroupList> appletProducts;
@ -403,288 +404,13 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
/// ///
showStoreSelector(MiNiDetail miNiDetail) { showStoreSelector(MiNiDetail miNiDetail) {
String selectSku = "";
int selectCount = 1;
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
builder: (context) { builder: (context) {
return StatefulBuilder(builder: (context1, state) { return ProductSku(miNiDetail);
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),
);
}, },
); );
} }
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