商城首页添加分页 样式改为瀑布流

修复 分类目录下 瀑布流间距问题
更改商品详情 订单详情类目下热门商品为 此供应商热门商品
hmxc
张萌 4 years ago
parent 8312a0ad43
commit d49a8bcc0c

@ -196,7 +196,7 @@ class _Manager {
String get articleReturnGoods => '/user/articleBorrow/articleReturn';
///id
String get articleReturnList => '/user/articleBorrow/articleReturn';
String get articleReturnList => '/user/articleBorrow/findBorrowByUserId';
///list
String get dailyPaymentList => '/user/dailyPayment/list';
@ -330,6 +330,9 @@ class _Market {
///app4
String get hotTop => '/user/shop/findTopGoods';
///appid 4(4)
String get suppliyerHotTop => '/user/shop/findTopGoodsBySupplierId';
///app
String get search => '/user/shop/goodsSearch';

@ -61,7 +61,7 @@ class _BorrowFinshPageState extends State<BorrowFinshPage> {
minWidth: double.infinity,
onPressed: widget.isSuccess!
? () {
Get.offAll(TabNavigator());
Get.offAll(()=>TabNavigator());
}
: () {
Get.back();

@ -198,7 +198,7 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
_textEditingController!.text,
urls);
if (baseModel.status!) {
Get.off(FinishFixedSubmitPage());
Get.off(()=>FinishFixedSubmitPage());
} else
BotToast.showText(text: baseModel.message!);
cancel();

@ -93,7 +93,7 @@ class _GoodsDetailPageState extends State<GoodsDetailPage> {
_goodsModel = GoodsDetailModel.fail();
BotToast.showText(text: baseModel.message ?? '未知错误');
}
baseModel = await NetUtil().get(API.market.hotTop);
baseModel = await NetUtil().get(API.market.suppliyerHotTop);
if (baseModel.status == true && baseModel.data != null) {
_topGoods = (baseModel.data as List)
.map((e) => GoodsItem.fromJson(e))
@ -178,7 +178,7 @@ class _GoodsDetailPageState extends State<GoodsDetailPage> {
onPressed: () {
if (!UserTool.userProvider.isLogin) {
BotToast.showText(text: '请先登录!');
Get.offAll(SignInPage());
Get.offAll(()=>SignInPage());
return;
}
Get.bottomSheet(Material(

@ -35,6 +35,8 @@ class _GoodsTabListViewState extends State<GoodsTabListView>
padding: EdgeInsets.all(32.w),
gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 24.w,
mainAxisSpacing: 24.w
),
itemBuilder: (context, index) {
final GoodsItem item = items[index];

@ -1,9 +1,11 @@
// import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/utils/network/base_list_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:waterfall_flow/waterfall_flow.dart';
@ -18,7 +20,6 @@ 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_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
@ -37,24 +38,55 @@ class _MarketPageState extends State<MarketPage>
with AutomaticKeepAliveClientMixin {
List<MarketCategoryModel> _marketModels = [];
List<GoodsItem> _hotItems = [];
late EasyRefreshController _refreshController;
int _pageNum = 1;
int _size = 4;
Future updateMarketInfo() async {
_marketModels = await DisplayCategoryModel.top8;
BaseModel baseModel = await NetUtil().get(API.market.hotTop);
if (baseModel.status == true && baseModel.data != null) {
_hotItems =
(baseModel.data as List).map((e) => GoodsItem.fromJson(e)).toList();
BaseListModel baseListModel =
await NetUtil().getList(API.market.hotTop, params: {
"pageNum": _pageNum,
"size": _size,
});
if (baseListModel.tableList!.isNotEmpty) {
_hotItems = (baseListModel.tableList as List)
.map((e) => GoodsItem.fromJson(e))
.toList();
}
return baseListModel.pageCount;
}
Future loadMarketInfo() async {
BaseListModel baseListModel =
await NetUtil().getList(API.market.hotTop, params: {
"pageNum": _pageNum,
"size": _size,
});
if (baseListModel.tableList!.isNotEmpty) {
_hotItems.addAll((baseListModel.tableList as List)
.map((e) => GoodsItem.fromJson(e))
.toList());
}
return baseListModel.pageCount;
}
@override
void initState() {
super.initState();
updateMarketInfo().then((_) {
setState(() {});
_refreshController = EasyRefreshController();
DisplayCategoryModel.top8.then((value) {
setState(() {
_marketModels = value;
});
});
}
@override
void dispose() {
_refreshController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
super.build(context);
@ -224,18 +256,38 @@ class _MarketPageState extends State<MarketPage>
),
];
},
body: WaterfallFlow.builder(
gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing: 20.w,
crossAxisSpacing: 20.w,
),
padding: EdgeInsets.all(32.w),
itemBuilder: (context, index) {
final item = _hotItems[index];
return GoodsCard(item: item);
body: EasyRefresh(
firstRefresh: true,
enableControlFinishLoad: true,
header: MaterialHeader(),
footer: MaterialFooter(),
controller: _refreshController,
onRefresh: () async {
_pageNum = 1;
updateMarketInfo();
setState(() {});
},
itemCount: _hotItems.length,
onLoad: () async {
_pageNum++;
int _pageCount = await loadMarketInfo();
if (_pageCount !=_pageNum) {
_refreshController.finishLoad();
}
setState(() {});
},
child: WaterfallFlow.builder(
gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing: 20.w,
crossAxisSpacing: 20.w,
),
padding: EdgeInsets.all(32.w),
itemBuilder: (context, index) {
final item = _hotItems[index];
return GoodsCard(item: item);
},
itemCount: _hotItems.length,
),
),
),
);

@ -38,9 +38,9 @@ class MyOrderFunc {
return baseModel;
}
///
///
static Future<List<GoodsItem>> getHotTops() async {
BaseModel baseModel = await NetUtil().get(API.market.hotTop);
BaseModel baseModel = await NetUtil().get(API.market.suppliyerHotTop);
if (baseModel.status == true && baseModel.data != null) {
return (baseModel.data as List)
.map((e) => GoodsItem.fromJson(e))

@ -167,7 +167,7 @@ class NetUtil {
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
if (!model.status! && model.message == '登录失效,请登录' && userProvider.isLogin) {
userProvider.logout();
Get.offAll(SignInPage());
Get.offAll(()=>SignInPage());
}
if (!model.status! || showMessage) {
BotToast.showText(text: model.message!);

Loading…
Cancel
Save