对接购物车删除接口

hmxc
张萌 3 years ago
parent 9415b8e39a
commit 559fb691e7

@ -1,6 +1,7 @@
// import 'package:aku_community/base/base_style.dart'; // import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/common/img_model.dart'; import 'package:aku_community/model/common/img_model.dart';
import 'package:aku_community/model/community/swiper_model.dart'; import 'package:aku_community/model/community/swiper_model.dart';
import 'package:aku_community/models/market/goods_classification.dart'; import 'package:aku_community/models/market/goods_classification.dart';
@ -9,37 +10,22 @@ import 'package:aku_community/models/market/order/goods_home_model.dart';
import 'package:aku_community/provider/app_provider.dart'; import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/ui/community/community_func.dart'; import 'package:aku_community/ui/community/community_func.dart';
import 'package:aku_community/ui/home/public_infomation/public_information_detail_page.dart'; import 'package:aku_community/ui/home/public_infomation/public_information_detail_page.dart';
import 'package:aku_community/ui/market/search/search_goods_page.dart';
import 'package:aku_community/ui/market/shop_car/shop_car_page.dart';
import 'package:aku_community/ui/market/widget/animated_home_background.dart'; import 'package:aku_community/ui/market/widget/animated_home_background.dart';
import 'package:aku_community/ui/search/bee_search.dart'; import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/utils/network/base_list_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:aku_community/widget/home/home_sliver_app_bar.dart'; import 'package:aku_community/widget/home/home_sliver_app_bar.dart';
import 'package:aku_community/widget/others/rectIndicator.dart'; import 'package:aku_community/widget/others/rectIndicator.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart'; import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:waterfall_flow/waterfall_flow.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/market/display_category_model.dart';
import 'package:aku_community/models/market/goods_item.dart';
import 'package:aku_community/models/market/market_category_model.dart';
import 'package:aku_community/ui/market/category/category_card.dart';
import 'package:aku_community/ui/market/category/category_page.dart';
import 'package:aku_community/ui/market/goods/goods_card.dart';
import 'package:aku_community/ui/market/order/my_order_page.dart';
import 'package:aku_community/ui/market/search/search_goods_page.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/utils/network/base_list_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:aku_community/provider/app_provider.dart';
import 'market_home_goods_card.dart'; import 'market_home_goods_card.dart';
// import 'package:aku_community/ui/market/goods/goods_detail_page.dart'; // import 'package:aku_community/ui/market/goods/goods_detail_page.dart';
@ -54,7 +40,7 @@ class MarketPage extends StatefulWidget {
} }
class _MarketPageState extends State<MarketPage> class _MarketPageState extends State<MarketPage>
with TickerProviderStateMixin,AutomaticKeepAliveClientMixin{ with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
late EasyRefreshController _refreshController; late EasyRefreshController _refreshController;
late ScrollController _sliverListController; late ScrollController _sliverListController;
GlobalKey<HomeSliverAppBarState> _sliverAppBarGlobalKey = GlobalKey(); GlobalKey<HomeSliverAppBarState> _sliverAppBarGlobalKey = GlobalKey();
@ -88,11 +74,14 @@ class _MarketPageState extends State<MarketPage>
int? orderByPrice; int? orderByPrice;
Future updateMarketInfo() async { Future updateMarketInfo() async {
BaseListModel baseListModel = await NetUtil().getList(
BaseListModel baseListModel = API.market.findRecommendGoodsList,
await NetUtil().getList( API.market.findRecommendGoodsList, params: {
params: {'pageNum': _pageNum, 'size': _size, 'pageNum': _pageNum,
'orderBySalesVolume': orderBySalesVolume,'orderByPrice': orderByPrice,}, 'size': _size,
'orderBySalesVolume': orderBySalesVolume,
'orderByPrice': orderByPrice,
},
); );
if (baseListModel.tableList!.isNotEmpty) { if (baseListModel.tableList!.isNotEmpty) {
_goodsHomeModelList = (baseListModel.tableList as List) _goodsHomeModelList = (baseListModel.tableList as List)
@ -103,10 +92,14 @@ class _MarketPageState extends State<MarketPage>
} }
Future loadMarketInfo() async { Future loadMarketInfo() async {
BaseListModel baseListModel = BaseListModel baseListModel = await NetUtil().getList(
await NetUtil().getList( API.market.findRecommendGoodsList, API.market.findRecommendGoodsList,
params: {'pageNum': _pageNum, 'size': _size, params: {
'orderBySalesVolume': orderBySalesVolume,'orderByPrice': orderByPrice,}, 'pageNum': _pageNum,
'size': _size,
'orderBySalesVolume': orderBySalesVolume,
'orderByPrice': orderByPrice,
},
); );
if (baseListModel.tableList!.isNotEmpty) { if (baseListModel.tableList!.isNotEmpty) {
_goodsHomeModelList = (baseListModel.tableList as List) _goodsHomeModelList = (baseListModel.tableList as List)
@ -119,18 +112,19 @@ class _MarketPageState extends State<MarketPage>
@override @override
void initState() { void initState() {
super.initState(); super.initState();
for(int i=0;i<10;i++){ for (int i = 0; i < 10; i++) {
_goodsClassificationList.add(GoodsClassification(id: 0,name: '',imgUrls: null)); _goodsClassificationList
.add(GoodsClassification(id: 0, name: '', imgUrls: null));
} }
for(int i=0;i<6;i++){ for (int i = 0; i < 6; i++) {
_goodsPopularModelList.add(GoodsPopularModel(id: 0,skuName: '',mainPhoto: '',viewsNum: 0)); _goodsPopularModelList.add(
GoodsPopularModel(id: 0, skuName: '', mainPhoto: '', viewsNum: 0));
} }
_refreshController = EasyRefreshController(); _refreshController = EasyRefreshController();
_sliverListController = ScrollController(); _sliverListController = ScrollController();
_tabController = TabController( _tabController = TabController(initialIndex: 0, length: 3, vsync: this);
initialIndex: 0, length: 3, vsync: this);
///appbar refresh ///appbar refresh
Future.delayed(Duration(milliseconds: 0), () async { Future.delayed(Duration(milliseconds: 0), () async {
await updateMarketInfo(); await updateMarketInfo();
@ -149,11 +143,11 @@ class _MarketPageState extends State<MarketPage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// super.build(context); super.build(context);
final mediaWidth = MediaQuery.of(context).size.width; final mediaWidth = MediaQuery.of(context).size.width;
return Scaffold( return Scaffold(
body:EasyRefresh( body: EasyRefresh(
firstRefresh: false, firstRefresh: false,
enableControlFinishLoad: false, enableControlFinishLoad: false,
header: MaterialHeader(), header: MaterialHeader(),
@ -170,31 +164,25 @@ class _MarketPageState extends State<MarketPage>
} }
setState(() {}); setState(() {});
}, },
child: _buildBody(context), child: _buildBody(context),
), ),
); );
} }
_refresh() async {
_refresh() async{
_pageNum = 1; _pageNum = 1;
await updateMarketInfo(); await updateMarketInfo();
_swiperModels = await CommunityFunc.swiper(); _swiperModels = await CommunityFunc.swiper();
_newTotal = await CommunityFunc.getNewProductsTodayNum(); _newTotal = await CommunityFunc.getNewProductsTodayNum();
_total = await CommunityFunc.getSkuTotal(); _total = await CommunityFunc.getSkuTotal();
_brandTotal = await CommunityFunc.getSettledBrandsNum(); _brandTotal = await CommunityFunc.getSettledBrandsNum();
_goodsClassificationList = await CommunityFunc.getGoodsClassificationList(0);//0 _goodsClassificationList =
await CommunityFunc.getGoodsClassificationList(0); //0
//_goodsPopularModelList = await CommunityFunc.getGoodsPopularModel(6); //_goodsPopularModelList = await CommunityFunc.getGoodsPopularModel(6);
setState(() {}); setState(() {});
} }
Widget _buildBody(BuildContext context) { Widget _buildBody(BuildContext context) {
final normalTypeButton = MaterialButton( final normalTypeButton = MaterialButton(
onPressed: () async { onPressed: () async {
@ -208,11 +196,10 @@ class _MarketPageState extends State<MarketPage>
child: Text( child: Text(
'综合', '综合',
style: TextStyle( style: TextStyle(
color: color: _orderType == OrderType.NORMAL ? kBalckSubColor : ktextPrimary,
_orderType == OrderType.NORMAL ? kBalckSubColor : ktextPrimary,
fontSize: _orderType == OrderType.NORMAL ? 32.sp : 28.sp, fontSize: _orderType == OrderType.NORMAL ? 32.sp : 28.sp,
fontWeight: _orderType == OrderType.NORMAL fontWeight: _orderType == OrderType.NORMAL
?FontWeight.bold ? FontWeight.bold
: FontWeight.normal, : FontWeight.normal,
), ),
), ),
@ -231,11 +218,10 @@ class _MarketPageState extends State<MarketPage>
child: Text( child: Text(
'销量', '销量',
style: TextStyle( style: TextStyle(
color: color: _orderType == OrderType.SALES ? kBalckSubColor : ktextPrimary,
_orderType == OrderType.SALES ? kBalckSubColor : ktextPrimary,
fontSize: _orderType == OrderType.SALES ? 32.sp : 28.sp, fontSize: _orderType == OrderType.SALES ? 32.sp : 28.sp,
fontWeight: _orderType == OrderType.SALES fontWeight: _orderType == OrderType.SALES
?FontWeight.bold ? FontWeight.bold
: FontWeight.normal, : FontWeight.normal,
), ),
), ),
@ -275,16 +261,16 @@ class _MarketPageState extends State<MarketPage>
'价格', '价格',
style: TextStyle( style: TextStyle(
color: _orderType == OrderType.PRICE_HIGH || color: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW _orderType == OrderType.PRICE_LOW
? kBalckSubColor ? kBalckSubColor
: ktextPrimary, : ktextPrimary,
fontSize: _orderType == OrderType.PRICE_HIGH || fontSize: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW _orderType == OrderType.PRICE_LOW
? 32.sp ? 32.sp
: 28.sp, : 28.sp,
fontWeight: _orderType == OrderType.PRICE_HIGH || fontWeight: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW _orderType == OrderType.PRICE_LOW
?FontWeight.bold ? FontWeight.bold
: FontWeight.normal, : FontWeight.normal,
), ),
), ),
@ -292,7 +278,7 @@ class _MarketPageState extends State<MarketPage>
priceIcon, priceIcon,
size: 32.w, size: 32.w,
color: _orderType == OrderType.PRICE_HIGH || color: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW _orderType == OrderType.PRICE_LOW
? kBalckSubColor ? kBalckSubColor
: ktextPrimary, : ktextPrimary,
), ),
@ -309,63 +295,67 @@ class _MarketPageState extends State<MarketPage>
actions: _actionsWidget(), actions: _actionsWidget(),
title: _buildTitle(), title: _buildTitle(),
backgroundColor: Colors.red, backgroundColor: Colors.red,
expandedHeight: MessageHeight+ expandedHeight: MessageHeight +
bannerHeight + bannerHeight +
buttonsHeight+ buttonsHeight +
searchHeight +tabBarHeight+ScreenUtil().statusBarHeight +kToolbarHeight+280.w, searchHeight +
tabBarHeight +
ScreenUtil().statusBarHeight +
kToolbarHeight +
280.w,
flexibleSpace: _flexibleSpaceBar(context), flexibleSpace: _flexibleSpaceBar(context),
bottom: PreferredSize(
bottom: PreferredSize( preferredSize: Size.fromHeight(tabBarHeight),
preferredSize: Size.fromHeight(tabBarHeight), child: _goodsTitle(
child: _goodsTitle( normalTypeButton, salesTypeButton, priceButton,) normalTypeButton,
)), salesTypeButton,
priceButton,
))),
SliverPadding( SliverPadding(
padding: EdgeInsets.all(10.w), padding: EdgeInsets.all(10.w),
), ),
SliverPadding( SliverPadding(
padding: EdgeInsets.only(left: 20.w,right: 20.w), padding: EdgeInsets.only(left: 20.w, right: 20.w),
sliver: buildSliverGrid(), sliver: buildSliverGrid(),
), ),
], ],
); );
} }
SliverGrid buildSliverGrid() { SliverGrid buildSliverGrid() {
return SliverGrid( return SliverGrid(
// child: WaterfallFlow.builder(
// child: WaterfallFlow.builder( // gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
// gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount( // crossAxisCount: 2,
// crossAxisCount: 2, // mainAxisSpacing: 20.w,
// mainAxisSpacing: 20.w, // crossAxisSpacing: 20.w,
// crossAxisSpacing: 20.w, // ),
// ), // padding: EdgeInsets.all(32.w),
// padding: EdgeInsets.all(32.w), // itemBuilder: (context, index) {
// itemBuilder: (context, index) { // final item = _hotItems[index];
// final item = _hotItems[index]; // return GoodsCard(item: item);
// return GoodsCard(item: item); // },
// }, // itemCount: _hotItems.length,
// itemCount: _hotItems.length, // ),
// ),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, crossAxisCount: 2,
mainAxisSpacing: 20.w, mainAxisSpacing: 20.w,
crossAxisSpacing: 20.w, crossAxisSpacing: 20.w,
childAspectRatio:0.57, childAspectRatio: 0.57,
), ),
///Item ///Item
delegate: new SliverChildBuilderDelegate( delegate: new SliverChildBuilderDelegate(
(BuildContext context, int index) { (BuildContext context, int index) {
///Item ///Item
return MarketHomeGoodsCard(item: _goodsHomeModelList[index]); return MarketHomeGoodsCard(item: _goodsHomeModelList[index]);
// return Container( // return Container(
// width: 200.w, // width: 200.w,
// height: 200.w, // height: 200.w,
// color: Colors.blue, // color: Colors.blue,
// ); // );
}, },
///Item ///Item
childCount: _goodsHomeModelList.length, childCount: _goodsHomeModelList.length,
), ),
@ -376,13 +366,13 @@ class _MarketPageState extends State<MarketPage>
return <Widget>[ return <Widget>[
GestureDetector( GestureDetector(
onTap: () { onTap: () {
//Get.to(() => BeeSearch()); Get.to(() => ShopCarPage()); //
}, },
child: Image.asset(R.ASSETS_ICONS_SHOP_CAR_PNG, child:
height: 40.w, width: 40.w), Image.asset(R.ASSETS_ICONS_SHOP_CAR_PNG, height: 40.w, width: 40.w),
), ),
Padding( Padding(
padding: EdgeInsets.only( left: 32.w,right: 32.w), padding: EdgeInsets.only(left: 32.w, right: 32.w),
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
//Get.to(() => BeeSearch()); //Get.to(() => BeeSearch());
@ -403,36 +393,36 @@ class _MarketPageState extends State<MarketPage>
//color: Colors.blue, //color: Colors.blue,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children:[ children: [
Container( Container(
height: 40.w, height: 40.w,
child: Flex( child: Flex(
direction: Axis.horizontal, direction: Axis.horizontal,
children: <Widget>[ children: <Widget>[
Row( Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
crossAxisAlignment: CrossAxisAlignment.center, if (appProvider.location != null)
children: [ Padding(
if (appProvider.location != null) padding: EdgeInsets.only(right: 5.w, top: 5.w),
Padding( child: Image.asset(
padding:EdgeInsets.only(right: 5.w,top: 5.w), R.ASSETS_ICONS_SHOP_LOCATION_PNG,
child: Image.asset( width: 40.w,
R.ASSETS_ICONS_SHOP_LOCATION_PNG, height: 40.w,
width: 40.w, fit: BoxFit.fitHeight,
height: 40.w, //color: Colors.white,
fit: BoxFit.fitHeight,
//color: Colors.white,
),
),
Text(
appProvider.location?['city']==null?'':appProvider.location?['city'] as String? ?? '',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 28.sp,
color: Colors.white,
),
//textAlign: TextAlign.center,
), ),
]), ),
Text(
appProvider.location?['city'] == null
? ''
: appProvider.location?['city'] as String? ?? '',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 28.sp,
color: Colors.white,
),
//textAlign: TextAlign.center,
),
]),
// Expanded( // Expanded(
// child: ges, // child: ges,
// ) // )
@ -449,25 +439,24 @@ class _MarketPageState extends State<MarketPage>
} }
FlexibleSpaceBar _flexibleSpaceBar(context) { FlexibleSpaceBar _flexibleSpaceBar(context) {
return FlexibleSpaceBar( return FlexibleSpaceBar(
collapseMode: CollapseMode.pin, collapseMode: CollapseMode.pin,
background: Container( background: Container(
// //
height: double.infinity, height: double.infinity,
color: Color(0xFFF9F9F9), color: Color(0xFFF9F9F9),
// color: Colors.white, // color: Colors.white,
child: Stack( child: Stack(
children: <Widget>[ children: <Widget>[
AnimatedHomeBackground( AnimatedHomeBackground(
key: _animatedBackgroundState, key: _animatedBackgroundState,
height: 530.w, height: 530.w,
backgroundColor: Colors.white , backgroundColor: Colors.white,
), ),
Column( Column(
children: <Widget>[ children: <Widget>[
Container( Container(
height: ScreenUtil().statusBarHeight +kToolbarHeight, height: ScreenUtil().statusBarHeight + kToolbarHeight,
), ),
geSearch(), geSearch(),
20.hb, 20.hb,
@ -478,7 +467,6 @@ class _MarketPageState extends State<MarketPage>
_buttonTitle(), _buttonTitle(),
20.hb, 20.hb,
_recommend(), _recommend(),
], ],
), ),
], ],
@ -486,11 +474,10 @@ class _MarketPageState extends State<MarketPage>
); );
} }
geSearch() {
geSearch(){ return Container(
return Container( margin: EdgeInsets.symmetric(horizontal: 24.w),
margin: EdgeInsets.symmetric(horizontal: 24.w), child: MaterialButton(
child: MaterialButton(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
height: 74.w, height: 74.w,
shape: StadiumBorder(), shape: StadiumBorder(),
@ -512,63 +499,73 @@ class _MarketPageState extends State<MarketPage>
], ],
), ),
), ),
); );
} }
getNum(){ getNum() {
return Container( return Container(
margin: EdgeInsets.only(left: 18.w,right: 18.w), margin: EdgeInsets.only(left: 18.w, right: 18.w),
padding: EdgeInsets.only(right:8.w ), padding: EdgeInsets.only(right: 8.w),
height: 76.w, height: 76.w,
width: double.infinity, width: double.infinity,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.horizontal(right: Radius.circular(12),left:Radius.circular(12), ), borderRadius: BorderRadius.horizontal(
right: Radius.circular(12),
left: Radius.circular(12),
),
gradient: LinearGradient( gradient: LinearGradient(
begin: FractionalOffset.centerRight, begin: FractionalOffset.centerRight,
end: FractionalOffset.centerLeft, end: FractionalOffset.centerLeft,
colors: <Color>[Color(0xFFAD2222), Color(0xFFCD392B)], colors: <Color>[Color(0xFFAD2222), Color(0xFFCD392B)],
), ),
), ),
child: Stack( child: Stack(
children: [ children: [
Positioned( Positioned(
bottom: 5, bottom: 5,
right: 0, right: 0,
top: 5, top: 5,
child: Container( child: Container(
padding: EdgeInsets.only(top: 5.w,bottom: 5.w), padding: EdgeInsets.only(top: 5.w, bottom: 5.w),
alignment: Alignment.center, alignment: Alignment.center,
height: 61.w, height: 61.w,
width: 694.w, width: 694.w,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFFFDEEBF), color: Color(0xFFFDEEBF),
borderRadius: BorderRadius.horizontal(right: Radius.circular(12),left:Radius.circular(12) ), borderRadius: BorderRadius.horizontal(
right: Radius.circular(12), left: Radius.circular(12)),
), ),
child: Container( child: Container(
height: 50.w, height: 50.w,
width: 682.w, width: 682.w,
decoration: BoxDecoration( decoration: BoxDecoration(
//color: Color(0x99F5AF16), //color: Color(0x99F5AF16),
borderRadius: BorderRadius.horizontal(right: Radius.circular(12),left:Radius.circular(12)), borderRadius: BorderRadius.horizontal(
border: Border.all(width: 2.w,color: Color(0x99F5AF16)), right: Radius.circular(12), left: Radius.circular(12)),
border: Border.all(width: 2.w, color: Color(0x99F5AF16)),
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
80.wb, 80.wb,
Image.asset(R.ASSETS_ICONS_SHOP_LABA_PNG,width: 36.w,height: 34.w,), Image.asset(
R.ASSETS_ICONS_SHOP_LABA_PNG,
width: 36.w,
height: 34.w,
),
20.wb, 20.wb,
Text('今日上新${_total}',style: TextStyle(color: Color(0xFFD0564B),fontSize: 24.sp,height: 1.05),), Text(
'今日上新${_total}',
style: TextStyle(
color: Color(0xFFD0564B),
fontSize: 24.sp,
height: 1.05),
),
], ],
), ),
), ),
) )),
),
Positioned( Positioned(
left: 0, left: 0,
top: 0, top: 0,
@ -577,25 +574,28 @@ class _MarketPageState extends State<MarketPage>
height: 76.w, height: 76.w,
width: 258.w, width: 258.w,
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
begin: FractionalOffset.centerLeft, begin: FractionalOffset.centerLeft,
end: FractionalOffset.centerRight, end: FractionalOffset.centerRight,
colors: <Color>[Color(0xFFAD2222), Color(0xFFCD392B)], colors: <Color>[Color(0xFFAD2222), Color(0xFFCD392B)],
), ),
borderRadius: BorderRadius.horizontal(right: Radius.circular(50),left: Radius.circular(24)) borderRadius: BorderRadius.horizontal(
), right: Radius.circular(50), left: Radius.circular(24))),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text('SKU总数${_newTotal}',style: TextStyle(color: Colors.white,fontSize: 24.sp),), Text(
Text('入驻品牌数:${_brandTotal}',style: TextStyle(color: Colors.white,fontSize: 24.sp),) 'SKU总数${_newTotal}',
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
Text(
'入驻品牌数:${_brandTotal}',
style: TextStyle(color: Colors.white, fontSize: 24.sp),
)
], ],
), ),
)), )),
], ],
), ),
); );
@ -618,21 +618,21 @@ class _MarketPageState extends State<MarketPage>
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
builder: SwiperCustomPagination( builder: SwiperCustomPagination(
builder: (BuildContext context, SwiperPluginConfig config) { builder: (BuildContext context, SwiperPluginConfig config) {
return RectIndicator( return RectIndicator(
position: config.activeIndex, position: config.activeIndex,
count: _swiperModels.length, count: _swiperModels.length,
activeColor: Color(0x99FFFFFF), activeColor: Color(0x99FFFFFF),
color: Color(0xD9FFFFFF), color: Color(0xD9FFFFFF),
// keyColor // keyColor
width: 4, width: 4,
// //
activeWidth: 14, activeWidth: 14,
// //
radius: 4, radius: 4,
// //
height: 4, height: 4,
); // ); //
})), })),
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
// control: new SwiperControl(), // control: new SwiperControl(),
autoplay: true, autoplay: true,
@ -652,12 +652,10 @@ class _MarketPageState extends State<MarketPage>
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(12.w)), borderRadius: BorderRadius.all(Radius.circular(12.w)),
), ),
child: child: FadeInImage.assetNetwork(
FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(ImgModel.first(swiperModel.voResourcesImgList)), image: API.image(ImgModel.first(swiperModel.voResourcesImgList)),
fit: BoxFit.fill, fit: BoxFit.fill,
imageErrorBuilder: (context, error, stackTrace) { imageErrorBuilder: (context, error, stackTrace) {
return Image.asset( return Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP, R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
@ -668,7 +666,6 @@ class _MarketPageState extends State<MarketPage>
); );
} }
_buttonTitle() { _buttonTitle() {
Container titles = Container( Container titles = Container(
alignment: Alignment.center, alignment: Alignment.center,
@ -676,23 +673,21 @@ class _MarketPageState extends State<MarketPage>
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(12.w), borderRadius: BorderRadius.circular(12.w),
), ),
child: child: GridView.builder(
GridView.builder(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
gridDelegate: gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 5), SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 5),
itemBuilder: (context, index) { itemBuilder: (context, index) {
if(index == 9){ if (index == 9) {
return _buildAllTile(); return _buildAllTile();
}else{ } else {
return _buildTile(_goodsClassificationList[index]); return _buildTile(_goodsClassificationList[index]);
} }
}, },
itemCount: 10, itemCount: 10,
shrinkWrap: true, shrinkWrap: true,
), ),
); );
return Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,
@ -703,10 +698,8 @@ class _MarketPageState extends State<MarketPage>
); );
} }
_buildTile(GoodsClassification item) { _buildTile(GoodsClassification item) {
return GestureDetector( return GestureDetector(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -716,15 +709,18 @@ class _MarketPageState extends State<MarketPage>
height: 88.w, height: 88.w,
image: API.image(ImgModel.first(item.imgUrls)), image: API.image(ImgModel.first(item.imgUrls)),
imageErrorBuilder: (context, error, stackTrace) { imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,height: 88.w, return Image.asset(
width: 88.w,); R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
height: 88.w,
width: 88.w,
);
}, },
), ),
8.hb, 8.hb,
Text( (item.name??'').replaceAll('', ''),style: TextStyle( Text(
fontSize: 28.sp, (item.name ?? '').replaceAll('', ''),
color: ktextPrimary style: TextStyle(fontSize: 28.sp, color: ktextPrimary),
),) )
], ],
), ),
); );
@ -735,13 +731,16 @@ class _MarketPageState extends State<MarketPage>
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Image.asset(R.ASSETS_ICONS_TEST_KINGCION_PNG,height: 88.w, Image.asset(
width: 88.w,), R.ASSETS_ICONS_TEST_KINGCION_PNG,
height: 88.w,
width: 88.w,
),
8.hb, 8.hb,
Text( '全部分类',style: TextStyle( Text(
fontSize: 28.sp, '全部分类',
color: ktextPrimary style: TextStyle(fontSize: 28.sp, color: ktextPrimary),
),) )
], ],
), ),
); );
@ -750,14 +749,13 @@ class _MarketPageState extends State<MarketPage>
Widget getkingCoin() { Widget getkingCoin() {
return Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: 20.w,vertical: 20.w), padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 20.w),
width: double.infinity, width: double.infinity,
height: buttonsHeight, height: buttonsHeight,
child:_buttonTitleRow(), child: _buttonTitleRow(),
); );
} }
_buttonTitleRow({onPressed}) { _buttonTitleRow({onPressed}) {
return Expanded( return Expanded(
child: CupertinoButton( child: CupertinoButton(
@ -765,21 +763,22 @@ class _MarketPageState extends State<MarketPage>
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Container( Container(
width: 88.w,
height: 88.w,
child: Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
width: 88.w, width: 88.w,
height: 88.w, height: 88.w,
child: Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,width: 88.w,height: 88.w,), ),
// FadeInImage.assetNetwork( // FadeInImage.assetNetwork(
// placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, // placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
// image: Api.getImgUrl(kingCoin.url),) // image: Api.getImgUrl(kingCoin.url),)
), ),
Container( Container(
margin: EdgeInsets.only(top: 6.w), margin: EdgeInsets.only(top: 6.w),
child: Text( child: Text(
'数码产品', '数码产品',
style: TextStyle( style: TextStyle(fontSize: 28.sp, color: Color(0xFF333333)),
fontSize: 28.sp,
color: Color(0xFF333333)),
), ),
) )
], ],
@ -793,122 +792,110 @@ class _MarketPageState extends State<MarketPage>
); );
} }
_recommend() {
_recommend(){
return Container( return Container(
height: 184.w, height: 184.w,
margin: EdgeInsets.only(left: 20.w,right: 20.w), margin: EdgeInsets.only(left: 20.w, right: 20.w),
padding: EdgeInsets.only(top: 8.w,left: 16.w,right: 16.w), padding: EdgeInsets.only(top: 8.w, left: 16.w, right: 16.w),
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(12.w), borderRadius: BorderRadius.circular(12.w),
), ),
child: child: Column(
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Text( Row(
'爆款推荐', mainAxisAlignment: MainAxisAlignment.start,
style: TextStyle( children: [
fontWeight: FontWeight.bold, Text(
fontSize: 28.sp, '爆款推荐',
color: ktextPrimary), style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 28.sp,
color: ktextPrimary),
),
],
), ),
], GridView.builder(
), padding: EdgeInsets.zero,
GridView.builder( physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.zero, gridDelegate:
physics: NeverScrollableScrollPhysics(), SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 6),
gridDelegate: itemBuilder: (context, index) {
SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 6), return Row(
itemBuilder: (context, index) { mainAxisAlignment: MainAxisAlignment.center,
return Row( children: [
mainAxisAlignment: MainAxisAlignment.center, Container(
children: [ width: 96.w,
Container( height: 96.w,
width: 96.w, child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: _goodsPopularModelList[index].mainPhoto ?? '',
imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
height: 96.w, height: 96.w,
child:FadeInImage.assetNetwork( width: 96.w,
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, );
image: _goodsPopularModelList[index].mainPhoto??'', },
imageErrorBuilder: (context, error, stackTrace) { ),
return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,height: 96.w, ),
width: 96.w,); ],
}, );
), },
), itemCount: 6,
shrinkWrap: true,
], ),
); // Row(
}, // mainAxisAlignment: MainAxisAlignment.center,
itemCount: 6, // children: [
shrinkWrap: true, // ..._goodsPopularModelList.map((e) => Row(
), // children: [
// Row( // Container(
// mainAxisAlignment: MainAxisAlignment.center, // width: 96.w,
// children: [ // height: 96.w,
// ..._goodsPopularModelList.map((e) => Row( // child:FadeInImage.assetNetwork(
// children: [ // placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
// Container( // image: e.mainPhoto??'',
// width: 96.w, // imageErrorBuilder: (context, error, stackTrace) {
// height: 96.w, // return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,height: 96.w,
// child:FadeInImage.assetNetwork( // width: 96.w,);
// placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, // },
// image: e.mainPhoto??'', // ),
// imageErrorBuilder: (context, error, stackTrace) { // ),
// return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,height: 96.w, // 20.wb,
// width: 96.w,); // ],
// }, // ),)
// ), // ],
// ), // ).expand(),
// 20.wb, ],
// ], ));
// ),)
// ],
// ).expand(),
],
)
);
} }
_goodsTitle(
Widget normalTypeButton,
Widget salesTypeButton,
Widget priceButton,
) {
_goodsTitle(Widget normalTypeButton,Widget salesTypeButton,Widget priceButton,){
return Container( return Container(
height: 90.w, height: 90.w,
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
color: Color(0xFFF9F9F9), color: Color(0xFFF9F9F9),
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
child: child: Container(
Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
height: 60.w, height: 60.w,
child:Row( child: Row(
children: [ children: [
normalTypeButton, normalTypeButton,
salesTypeButton, salesTypeButton,
priceButton, priceButton,
], ],
), ),
), ),
); );
} }
@override @override
bool get wantKeepAlive => true; bool get wantKeepAlive => true;
} }

@ -41,6 +41,14 @@ class _ShopCarPageState extends State<ShopCarPage> {
return num; return num;
} }
@override
void dispose() {
_controllers.forEach((element) {
element.dispose();
});
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -102,26 +110,17 @@ class _ShopCarPageState extends State<ShopCarPage> {
_models = (base.data as List) _models = (base.data as List)
.map((e) => ShopCarListModel.fromJson(e)) .map((e) => ShopCarListModel.fromJson(e))
.toList(); .toList();
_controllers.forEach((element) {
element.dispose();
});
_controllers.clear();
_models.forEach((element) {
_controllers.add(
TextEditingController(text: element.num.toString()));
});
} }
_models.add(ShopCarListModel(
id: 0,
skuName: '123',
mainPhoto: '',
status: 1,
shopStatus: 1,
sellPrice: 20.00,
discountPrice: 10,
unit: '',
kind: 1,
weight: 3,
num: 2));
_models.forEach((element) {
_controllers.add(
TextEditingController(text: element.num.toString()));
});
if (mounted) { if (mounted) {
setState(() {}); setState(() {});
;
} }
}, },
child: _models.isEmpty child: _models.isEmpty
@ -209,7 +208,15 @@ class _ShopCarPageState extends State<ShopCarPage> {
Future _settleEnd() async {} Future _settleEnd() async {}
Future _delete() async {} Future _delete() async {
await NetUtil().post(
API.market.shopCarDelete,
params: {
'jcookGoodsIds': _selectIndex.map((e) => _models[e].id).toList()
},
showMessage: true,
);
}
Widget _goodCard(ShopCarListModel model, int index) { Widget _goodCard(ShopCarListModel model, int index) {
var top = RichText( var top = RichText(

Loading…
Cancel
Save