|
|
|
import 'package:dio/dio.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
|
|
import 'package:flutter_html/flutter_html.dart';
|
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart';
|
|
|
|
import 'package:huixiang/generated/l10n.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/miNiDetail.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/shoppingCart.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/store_info.dart';
|
|
|
|
import 'package:huixiang/retrofit/min_api.dart';
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart';
|
|
|
|
import 'package:huixiang/store/store_view/product_sku.dart';
|
|
|
|
import 'package:huixiang/store/store_view/shop_car.dart';
|
|
|
|
import 'package:huixiang/utils/font_weight.dart';
|
|
|
|
import 'package:huixiang/view_widget/classic_header.dart';
|
|
|
|
import 'package:huixiang/view_widget/custom_image.dart';
|
|
|
|
import 'package:huixiang/view_widget/my_footer.dart';
|
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
|
|
|
|
class ShopDetailsPage extends StatefulWidget {
|
|
|
|
final Map<String, dynamic> arguments;
|
|
|
|
|
|
|
|
ShopDetailsPage({this.arguments});
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _ShopDetailsPage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _ShopDetailsPage extends State<ShopDetailsPage> {
|
|
|
|
ApiService apiService;
|
|
|
|
MinApiService minService;
|
|
|
|
final ScrollController scrollController = ScrollController();
|
|
|
|
final RefreshController refreshController = RefreshController();
|
|
|
|
String id;
|
|
|
|
MiNiDetail miNiDetail;
|
|
|
|
ShoppingCart shopCarGoods;
|
|
|
|
bool dialogShowing = false;
|
|
|
|
StoreInfo storeInfo;
|
|
|
|
String parentCode = "";
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
id = widget.arguments["id"];
|
|
|
|
SharedPreferences.getInstance().then((value) {
|
|
|
|
String minToken = value.getString("minToken");
|
|
|
|
String tenant = value.getString("tenant");
|
|
|
|
String storeId = value.getString("storeId");
|
|
|
|
minService = MinApiService(Dio(),
|
|
|
|
context: context,
|
|
|
|
token: minToken,
|
|
|
|
tenant: tenant,
|
|
|
|
storeId: storeId,
|
|
|
|
showLoading: true);
|
|
|
|
queryMiNiDetail(id);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
///商品详情
|
|
|
|
queryMiNiDetail(id) async {
|
|
|
|
BaseData<MiNiDetail> baseData =
|
|
|
|
await minService.miNiDetail(id).catchError((error) {
|
|
|
|
refreshController.refreshFailed();
|
|
|
|
});
|
|
|
|
if (baseData != null && baseData.isSuccess) {
|
|
|
|
setState(() {
|
|
|
|
miNiDetail = baseData.data;
|
|
|
|
});
|
|
|
|
refreshController.refreshCompleted();
|
|
|
|
} else {
|
|
|
|
refreshController.refreshFailed();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_onRefresh() {
|
|
|
|
queryMiNiDetail(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ///选规格
|
|
|
|
// _queryMiNiDetail(String id, int count) async {
|
|
|
|
// EasyLoading.show(status: S.current.zhengzaijiazai);
|
|
|
|
// if(count < 0){
|
|
|
|
// shopCarGoods.shoppingCartSkuItemList.forEach((element) {
|
|
|
|
// if(element.productId == id){
|
|
|
|
// shopCartReduce(element);
|
|
|
|
// setState(() {
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// BaseData<MiNiDetail> baseData = await minService.miNiDetail(id);
|
|
|
|
// if (baseData != null && baseData.isSuccess) {
|
|
|
|
// showStoreSelector(baseData.data, id, count);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// ///选规格弹窗
|
|
|
|
// showStoreSelector(MiNiDetail miNiDetail, String id, int count) async {
|
|
|
|
// if (miNiDetail.attrList != null &&
|
|
|
|
// miNiDetail.attrList.length == 1 &&
|
|
|
|
// miNiDetail.attrList[0].attrValueList.length == 1) {
|
|
|
|
// _addShopCar(miNiDetail, [], count);
|
|
|
|
// } else {
|
|
|
|
// EasyLoading.dismiss();
|
|
|
|
// dialogShowing = true;
|
|
|
|
// SmartDialog.show(
|
|
|
|
// widget: ProductSku(
|
|
|
|
// miNiDetail,
|
|
|
|
// shopCarGoods,
|
|
|
|
// id,
|
|
|
|
// _addShopCar,
|
|
|
|
// add,
|
|
|
|
// reduce,
|
|
|
|
// ),
|
|
|
|
// onDismiss: () {
|
|
|
|
// dialogShowing = false;
|
|
|
|
// },
|
|
|
|
// alignmentTemp: Alignment.bottomCenter,
|
|
|
|
// );
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// ///添加购物车
|
|
|
|
// Future _addShopCar(MiNiDetail miNiDetail, selectSkus, int count) async {
|
|
|
|
// ProductSkuVOListBean productSku;
|
|
|
|
// if (selectSkus != null && selectSkus.length == 0) {
|
|
|
|
// productSku = miNiDetail.productSkuVOList.first;
|
|
|
|
// } else {
|
|
|
|
// productSku = miNiDetail.productSkuVOList.firstWhere((element) {
|
|
|
|
// bool gg = true;
|
|
|
|
// selectSkus.forEach((element1) {
|
|
|
|
// if (element.skuNameStr.indexOf(element1) < 0) {
|
|
|
|
// gg = false;
|
|
|
|
// return gg;
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// return gg;
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// if (productSku == null) return;
|
|
|
|
// String skuId = productSku.id;
|
|
|
|
// String skuValue = selectSkus
|
|
|
|
// .toString()
|
|
|
|
// .replaceAll("[", "")
|
|
|
|
// .replaceAll("]", "")
|
|
|
|
// .replaceAll(",", "");
|
|
|
|
//
|
|
|
|
// if (miNiDetail != null) {
|
|
|
|
// BaseData<List<ShoppingCart>> baseDate = await minService.addShoppingCart({
|
|
|
|
// "storeId": storeInfo.id,
|
|
|
|
// "storeName": storeInfo.storeName ?? "",
|
|
|
|
// "parentId": miNiDetail.id,
|
|
|
|
// "parentCode": parentCode,
|
|
|
|
// "shoppingCartSkuItemList": [
|
|
|
|
// {
|
|
|
|
// "buyNum": count,
|
|
|
|
// "id": skuId,
|
|
|
|
// "productId": miNiDetail.id,
|
|
|
|
// "productName": miNiDetail.productName,
|
|
|
|
// "skuName": skuValue,
|
|
|
|
// "storeId": storeInfo.id,
|
|
|
|
// "skuPrice": productSku.skuPrice,
|
|
|
|
// "skuStock": productSku.skuStock,
|
|
|
|
// },
|
|
|
|
// ],
|
|
|
|
// });
|
|
|
|
// EasyLoading.dismiss();
|
|
|
|
// if (baseDate != null && baseDate.isSuccess) {
|
|
|
|
// queryShopCar().then((value) {
|
|
|
|
// this.shopCarGoods = value;
|
|
|
|
// setState(() {});
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// /// 购物车的key,用于刷新UI
|
|
|
|
// GlobalKey shopCartKey = GlobalKey();
|
|
|
|
//
|
|
|
|
// ///购物车弹窗
|
|
|
|
// showShoppingCart() {
|
|
|
|
// queryShopCar().then((value) {
|
|
|
|
// this.shopCarGoods = value;
|
|
|
|
// dialogShowing = true;
|
|
|
|
// SmartDialog.show(
|
|
|
|
// widget: ShopCar(
|
|
|
|
// shopCartKey,
|
|
|
|
// this.shopCarGoods,
|
|
|
|
// clearShopCar,
|
|
|
|
// toDownOrder,
|
|
|
|
// shopCartAdd,
|
|
|
|
// shopCartReduce,
|
|
|
|
// ),
|
|
|
|
// onDismiss: () {
|
|
|
|
// dialogShowing = false;
|
|
|
|
// },
|
|
|
|
// alignmentTemp: Alignment.bottomCenter,
|
|
|
|
// );
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// ///计算个数
|
|
|
|
// int count() {
|
|
|
|
// if (shopCarGoods == null ||
|
|
|
|
// shopCarGoods.shoppingCartSkuItemList == null ||
|
|
|
|
// shopCarGoods.shoppingCartSkuItemList.length == 0) return 0;
|
|
|
|
// int count = 0;
|
|
|
|
// shopCarGoods.shoppingCartSkuItemList.forEach((element) {
|
|
|
|
// count += element.buyNum;
|
|
|
|
// });
|
|
|
|
// return count;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// ///去下单结算页面
|
|
|
|
// toDownOrder() async {
|
|
|
|
// int num = count();
|
|
|
|
//
|
|
|
|
// if (miNiDetail.id == null || miNiDetail.id == "") {
|
|
|
|
// if (num == 0) {
|
|
|
|
// SmartDialog.showToast("请先选择您要购买的商品!~");
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// await Navigator.of(context).pushNamed(
|
|
|
|
// '/router/settlement',
|
|
|
|
// arguments: {
|
|
|
|
// "storeInfo": storeInfo,
|
|
|
|
// "parentCode": parentCode,
|
|
|
|
// "parentId": miNiDetail.id,
|
|
|
|
// // "pName": pName,
|
|
|
|
// // "pid": pid,
|
|
|
|
// // "cName": cName,
|
|
|
|
// // "cid": cid,
|
|
|
|
// "shoppingCart": shopCarGoods,
|
|
|
|
// },
|
|
|
|
// );
|
|
|
|
// queryShopCar().then((value) {
|
|
|
|
// this.shopCarGoods = value;
|
|
|
|
// setState(() {});
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// ///清空购物车
|
|
|
|
// clearShopCar() async {
|
|
|
|
// BaseData<bool> baseData = await minService.clearShoppingCart();
|
|
|
|
// if (baseData.isSuccess) {
|
|
|
|
// shopCarGoods = null;
|
|
|
|
// setState(() {});
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// ///查询购物车
|
|
|
|
// Future<ShoppingCart> queryShopCar() async {
|
|
|
|
// // pName = ""; //活动
|
|
|
|
// // pid = ""; //活动
|
|
|
|
// // cName = ""; //优惠券
|
|
|
|
// // cid = ""; //优惠券
|
|
|
|
// BaseData<List<ShoppingCart>> baseDate =
|
|
|
|
// await minService.getShoppingCart(tableId);
|
|
|
|
// if (baseDate != null &&
|
|
|
|
// baseDate.isSuccess &&
|
|
|
|
// baseDate.data != null &&
|
|
|
|
// baseDate.data.length > 0) {
|
|
|
|
// if (baseDate.data[0].selectDiscount == 1) {
|
|
|
|
// baseDate.data[0].couponList.forEach((element) {
|
|
|
|
// if (element.isMaxCoupon) {
|
|
|
|
// cName = element.promotionName;
|
|
|
|
// cid = element.id;
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// } else if (baseDate.data[0].selectDiscount == 2) {
|
|
|
|
// baseDate.data[0].promotionInfoList.forEach((element) {
|
|
|
|
// if (element.isMaxPromotion) {
|
|
|
|
// pName = element.name;
|
|
|
|
// pid = element.id;
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// return baseDate.data[0];
|
|
|
|
// } else {
|
|
|
|
// return null;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// ///购物车➕1
|
|
|
|
// Future<ShoppingCart> shopCartAdd(
|
|
|
|
// ShoppingCartSkuItemListBean cartSkuItem) async {
|
|
|
|
// Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
|
|
|
|
// cartSkuItem.buyNum += 1;
|
|
|
|
// shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
|
|
|
|
// BaseData<List<ShoppingCart>> baseDate =
|
|
|
|
// await minService.shoppingCartSingle(shopCarTemp);
|
|
|
|
// if (baseDate.isSuccess) {
|
|
|
|
// this.shopCarGoods = await queryShopCar();
|
|
|
|
// if (shopCartKey != null) {
|
|
|
|
// shopCartKey.currentState.setState(() {});
|
|
|
|
// }
|
|
|
|
// setState(() {});
|
|
|
|
// }
|
|
|
|
// return this.shopCarGoods;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// ///购物车➖1
|
|
|
|
// Future<ShoppingCart> shopCartReduce(
|
|
|
|
// ShoppingCartSkuItemListBean cartSkuItem) async {
|
|
|
|
// Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
|
|
|
|
// cartSkuItem.buyNum -= 1;
|
|
|
|
// shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
|
|
|
|
// BaseData<List<ShoppingCart>> baseDate =
|
|
|
|
// await minService.shoppingCartSingle(shopCarTemp);
|
|
|
|
// if (baseDate.isSuccess) {
|
|
|
|
// EasyLoading.dismiss();
|
|
|
|
// this.shopCarGoods = await queryShopCar();
|
|
|
|
// if (shopCartKey?.currentState != null) {
|
|
|
|
// shopCartKey.currentState.setState(() {});
|
|
|
|
// }
|
|
|
|
// setState(() {
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// return this.shopCarGoods;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// ///商品➕1
|
|
|
|
// add(MiNiDetail miNiDetail, selectSkus) async {
|
|
|
|
// ProductSkuVOListBean productSku =
|
|
|
|
// miNiDetail.productSkuVOList.firstWhere((element) {
|
|
|
|
// return skuY(element, selectSkus);
|
|
|
|
// });
|
|
|
|
//
|
|
|
|
// if (productSku == null) return;
|
|
|
|
// String skuId = productSku.id;
|
|
|
|
// if (shopCarGoods == null) {
|
|
|
|
// await _addShopCar(miNiDetail, selectSkus, 2);
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList
|
|
|
|
// .indexWhere((element) => skuId == element.id);
|
|
|
|
// Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
|
|
|
|
// shopCarGoods.tableId = "$tableId";
|
|
|
|
//
|
|
|
|
// if (shopSkuIndex >= 0) {
|
|
|
|
// shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum += 1;
|
|
|
|
// ShoppingCartSkuItemListBean cartSkuItem = shopCarGoods
|
|
|
|
// .shoppingCartSkuItemList
|
|
|
|
// .firstWhere((element) => skuId == element.id);
|
|
|
|
// shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
|
|
|
|
// } else {
|
|
|
|
// await _addShopCar(miNiDetail, selectSkus, 2);
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// BaseData<List<ShoppingCart>> baseDate =
|
|
|
|
// await minService.shoppingCartSingle(shopCarTemp);
|
|
|
|
// if (baseDate.isSuccess) {
|
|
|
|
// queryShopCar().then((value) {
|
|
|
|
// this.shopCarGoods = value;
|
|
|
|
// setState(() {});
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// ///商品➖1
|
|
|
|
// reduce(MiNiDetail miNiDetail, selectSkus) async {
|
|
|
|
// ProductSkuVOListBean productSku =
|
|
|
|
// miNiDetail.productSkuVOList.firstWhere((element) {
|
|
|
|
// return skuY(element, selectSkus);
|
|
|
|
// });
|
|
|
|
//
|
|
|
|
// if (productSku == null) return;
|
|
|
|
// String skuId = productSku.id;
|
|
|
|
// if (shopCarGoods == null) {
|
|
|
|
// await _addShopCar(miNiDetail, selectSkus, 2);
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// ShoppingCartSkuItemListBean shopSkuItem = shopCarGoods
|
|
|
|
// .shoppingCartSkuItemList
|
|
|
|
// .firstWhere((element) => skuId == element.id);
|
|
|
|
// int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList
|
|
|
|
// .indexWhere((element) => skuId == element.id);
|
|
|
|
//
|
|
|
|
// if (shopSkuItem != null) {
|
|
|
|
// if (shopSkuItem.buyNum > 1) {
|
|
|
|
// shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum -= 1;
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// await _addShopCar(miNiDetail, selectSkus, 2);
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// shopCarGoods.tableId = "$tableId";
|
|
|
|
//
|
|
|
|
// Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
|
|
|
|
// ShoppingCartSkuItemListBean cartSkuItem = shopCarGoods
|
|
|
|
// .shoppingCartSkuItemList
|
|
|
|
// .firstWhere((element) => skuId == element.id);
|
|
|
|
// shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
|
|
|
|
//
|
|
|
|
// BaseData<List<ShoppingCart>> baseDate =
|
|
|
|
// await minService.shoppingCartSingle(shopCarTemp);
|
|
|
|
// if (baseDate.isSuccess) {
|
|
|
|
// queryShopCar().then((value) {
|
|
|
|
// this.shopCarGoods = value;
|
|
|
|
// setState(() {});
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
body: Container(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: SmartRefresher(
|
|
|
|
controller: refreshController,
|
|
|
|
enablePullDown: true,
|
|
|
|
enablePullUp: false,
|
|
|
|
header: MyHeader(),
|
|
|
|
footer: CustomFooter(
|
|
|
|
builder: (context, mode) {
|
|
|
|
return MyFooter(mode);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
onRefresh: () {
|
|
|
|
setState(() {
|
|
|
|
_onRefresh();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
scrollController: scrollController,
|
|
|
|
child: Container(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
buildProduct(),
|
|
|
|
SizedBox(height: 16.h,),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 14.w,vertical: 16.h),
|
|
|
|
color: Colors.white,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"商品详情",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 15.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
color: Color(0xFF000000),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 14.h,
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
color: Colors.white,
|
|
|
|
child: Html(
|
|
|
|
data: miNiDetail?.detail ?? "",
|
|
|
|
customImageRenders: {
|
|
|
|
networkSourceMatcher(): networkImageRender(
|
|
|
|
loadingWidget: () {
|
|
|
|
return Container();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
flex: 1,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget buildProduct() {
|
|
|
|
return Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.vertical(
|
|
|
|
bottom: Radius.circular(8.h),
|
|
|
|
),
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Colors.black.withAlpha(12),
|
|
|
|
offset: Offset(0, 3),
|
|
|
|
blurRadius: 14,
|
|
|
|
spreadRadius: 0,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
color: Color(0xFFFFFFFF)),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
swiper(),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: 16.h, left: 14.w, right: 14.w,bottom: 16.h),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
miNiDetail?.price ?? "",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 24.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
color: Color(0xFFF85400),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 2,
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Text(
|
|
|
|
miNiDetail?.applyPrice ?? "",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16.sp,
|
|
|
|
decoration: TextDecoration.lineThrough,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFFA29E9E),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
showDeleteDialog();
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
width: 92.w,
|
|
|
|
height: 32.h,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(4),
|
|
|
|
color: Color(0xFF32A060),
|
|
|
|
),
|
|
|
|
margin: EdgeInsets.only(bottom: 8),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/goods_shopp.webp",
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
width: 18,
|
|
|
|
height: 18,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 2,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"加入购物车",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFFFFFFFF),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
miNiDetail?.productName ?? "",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 15.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
color: Color(0xFF000000),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 12.h,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
miNiDetail?.shortName ?? "",
|
|
|
|
maxLines: 3,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
height: 1.5,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF4D4D4D),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget swiper() {
|
|
|
|
return Container(
|
|
|
|
child: AspectRatio(
|
|
|
|
aspectRatio: 1.3698,
|
|
|
|
child: Stack(
|
|
|
|
children: [
|
|
|
|
Swiper(
|
|
|
|
pagination: SwiperPagination(
|
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
|
builder: DotSwiperPaginationBuilder(
|
|
|
|
size: 8,
|
|
|
|
activeSize: 8,
|
|
|
|
space: 5,
|
|
|
|
activeColor: Colors.black,
|
|
|
|
color: Colors.black.withAlpha(76),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
itemBuilder: (context, position) {
|
|
|
|
return MImage(
|
|
|
|
miNiDetail?.imgs != null ? miNiDetail.imgs[position]:"",
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
radius: BorderRadius.zero,
|
|
|
|
errorSrc: "assets/image/default_2_1.webp",
|
|
|
|
fadeSrc: "assets/image/default_2_1.webp",
|
|
|
|
);
|
|
|
|
},
|
|
|
|
itemCount: miNiDetail?.imgs?.length ?? 1,
|
|
|
|
),
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(left: 16, top: 52),
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
child: Icon(
|
|
|
|
Icons.arrow_back_ios,
|
|
|
|
size: 24,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///选择規格弹窗
|
|
|
|
showDeleteDialog() {
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (context) {
|
|
|
|
return AlertDialog(
|
|
|
|
content: Container(
|
|
|
|
width: MediaQuery.of(context).size.width - 84,
|
|
|
|
height: 500.h,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
ClipRRect(
|
|
|
|
child: MImage(
|
|
|
|
miNiDetail.imgs[0],
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
width: 70,
|
|
|
|
height: 70,
|
|
|
|
errorSrc: "assets/image/default_2_1.webp",
|
|
|
|
fadeSrc: "assets/image/default_2_1.webp",
|
|
|
|
),
|
|
|
|
borderRadius: BorderRadius.circular(4),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 10.w,
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
height: 70,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
miNiDetail?.productName ?? "",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 13.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: Color(0xFF000000),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/cancel.webp",
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
height: 24,
|
|
|
|
width: 24,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"¥${miNiDetail?.price ?? ""}",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: Color(0xFFF65720),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|