|
|
@ -1,7 +1,8 @@
|
|
|
|
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/constants/api.dart';
|
|
|
|
import 'package:aku_community/models/market/goods_item.dart';
|
|
|
|
import 'package:aku_community/models/market/goods_item.dart';
|
|
|
|
import 'package:aku_community/ui/market/goods/goods_detail_page.dart';
|
|
|
|
import 'package:aku_community/ui/market/goods/goods_card.dart';
|
|
|
|
|
|
|
|
// import 'package:aku_community/ui/market/goods/goods_detail_page.dart';
|
|
|
|
import 'package:aku_community/utils/network/base_model.dart';
|
|
|
|
import 'package:aku_community/utils/network/base_model.dart';
|
|
|
|
import 'package:aku_community/utils/network/net_util.dart';
|
|
|
|
import 'package:aku_community/utils/network/net_util.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
@ -18,7 +19,8 @@ import 'package:aku_community/ui/market/category/category_page.dart';
|
|
|
|
import 'package:aku_community/ui/market/search/search_goods_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/headers.dart';
|
|
|
|
import 'package:aku_community/widget/bee_scaffold.dart';
|
|
|
|
import 'package:aku_community/widget/bee_scaffold.dart';
|
|
|
|
import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart';
|
|
|
|
import 'package:waterfall_flow/waterfall_flow.dart';
|
|
|
|
|
|
|
|
// import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class MarketPage extends StatefulWidget {
|
|
|
|
class MarketPage extends StatefulWidget {
|
|
|
|
MarketPage({Key? key}) : super(key: key);
|
|
|
|
MarketPage({Key? key}) : super(key: key);
|
|
|
@ -28,8 +30,7 @@ class MarketPage extends StatefulWidget {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _MarketPageState extends State<MarketPage>
|
|
|
|
class _MarketPageState extends State<MarketPage>
|
|
|
|
with AutomaticKeepAliveClientMixin, TickerProviderStateMixin {
|
|
|
|
with AutomaticKeepAliveClientMixin {
|
|
|
|
late TabController _tabController;
|
|
|
|
|
|
|
|
List<MarketCategoryModel> _marketModels = [];
|
|
|
|
List<MarketCategoryModel> _marketModels = [];
|
|
|
|
List<GoodsItem> _hotItems = [];
|
|
|
|
List<GoodsItem> _hotItems = [];
|
|
|
|
|
|
|
|
|
|
|
@ -45,7 +46,6 @@ class _MarketPageState extends State<MarketPage>
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
_tabController = TabController(length: 2, vsync: this);
|
|
|
|
|
|
|
|
updateMarketInfo().then((_) {
|
|
|
|
updateMarketInfo().then((_) {
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -111,8 +111,11 @@ class _MarketPageState extends State<MarketPage>
|
|
|
|
//AppBar top Widget height
|
|
|
|
//AppBar top Widget height
|
|
|
|
//bottom height: 48
|
|
|
|
//bottom height: 48
|
|
|
|
// flexibleSpace的高为 (设备宽 - 边距)/4*2 + 外边距 + bottom高 + top热搜栏
|
|
|
|
// flexibleSpace的高为 (设备宽 - 边距)/4*2 + 外边距 + bottom高 + top热搜栏
|
|
|
|
expandedHeight:
|
|
|
|
// * 热搜栏
|
|
|
|
(mediaWidth - 32.w * 2) / 4 * 2 + 16.w * 2 + 48 + 68.w,
|
|
|
|
//expandedHeight:
|
|
|
|
|
|
|
|
//(mediaWidth - 32.w * 2) / 4 * 2 + 16.w * 2 + 48 + 68.w,
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
expandedHeight: (mediaWidth - 32.w * 2) / 4 * 2 + 16.w * 2,
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
elevation: 0,
|
|
|
|
elevation: 0,
|
|
|
|
flexibleSpace: FlexibleSpaceBar(
|
|
|
|
flexibleSpace: FlexibleSpaceBar(
|
|
|
@ -122,55 +125,55 @@ class _MarketPageState extends State<MarketPage>
|
|
|
|
top: 16.w,
|
|
|
|
top: 16.w,
|
|
|
|
left: 32.w,
|
|
|
|
left: 32.w,
|
|
|
|
right: 32.w,
|
|
|
|
right: 32.w,
|
|
|
|
bottom: 16.w + 48, //底部边距需要加上bottom高
|
|
|
|
bottom: 16.w, //底部边距需要加上bottom高
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
SizedBox(
|
|
|
|
// SizedBox(
|
|
|
|
height: 58.w,
|
|
|
|
// height: 58.w,
|
|
|
|
child: Row(
|
|
|
|
// child: Row(
|
|
|
|
children: [
|
|
|
|
// children: [
|
|
|
|
Text(
|
|
|
|
// Text(
|
|
|
|
'热搜:',
|
|
|
|
// '热搜:',
|
|
|
|
style: TextStyle(
|
|
|
|
// style: TextStyle(
|
|
|
|
fontSize: 20.sp,
|
|
|
|
// fontSize: 20.sp,
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
20.wb,
|
|
|
|
// 20.wb,
|
|
|
|
ListView.separated(
|
|
|
|
// ListView.separated(
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
// scrollDirection: Axis.horizontal,
|
|
|
|
separatorBuilder: (_, __) => 20.wb,
|
|
|
|
// separatorBuilder: (_, __) => 20.wb,
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
// itemBuilder: (context, index) {
|
|
|
|
final item = _hotItems[index];
|
|
|
|
// final item = _hotItems[index];
|
|
|
|
return MaterialButton(
|
|
|
|
// return MaterialButton(
|
|
|
|
padding:
|
|
|
|
// padding:
|
|
|
|
EdgeInsets.symmetric(horizontal: 40.w),
|
|
|
|
// EdgeInsets.symmetric(horizontal: 40.w),
|
|
|
|
minWidth: 0,
|
|
|
|
// minWidth: 0,
|
|
|
|
shape: StadiumBorder(
|
|
|
|
// shape: StadiumBorder(
|
|
|
|
side: BorderSide(
|
|
|
|
// side: BorderSide(
|
|
|
|
color: ktextSubColor,
|
|
|
|
// color: ktextSubColor,
|
|
|
|
width: 1,
|
|
|
|
// width: 1,
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
materialTapTargetSize:
|
|
|
|
// materialTapTargetSize:
|
|
|
|
MaterialTapTargetSize.shrinkWrap,
|
|
|
|
// MaterialTapTargetSize.shrinkWrap,
|
|
|
|
onPressed: () {
|
|
|
|
// onPressed: () {
|
|
|
|
Get.to(() => GoodsDetailPage(id: item.id));
|
|
|
|
// Get.to(() => GoodsDetailPage(id: item.id));
|
|
|
|
},
|
|
|
|
// },
|
|
|
|
child: Text(
|
|
|
|
// child: Text(
|
|
|
|
item.title,
|
|
|
|
// item.title,
|
|
|
|
style: TextStyle(
|
|
|
|
// style: TextStyle(
|
|
|
|
color: ktextSubColor,
|
|
|
|
// color: ktextSubColor,
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
);
|
|
|
|
// );
|
|
|
|
},
|
|
|
|
// },
|
|
|
|
itemCount: _hotItems.length,
|
|
|
|
// itemCount: _hotItems.length,
|
|
|
|
).expand(),
|
|
|
|
// ).expand(),
|
|
|
|
],
|
|
|
|
// ],
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
10.hb,
|
|
|
|
// 10.hb,
|
|
|
|
gridItems.expand(),
|
|
|
|
gridItems.expand(),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -178,29 +181,35 @@ class _MarketPageState extends State<MarketPage>
|
|
|
|
),
|
|
|
|
),
|
|
|
|
pinned: true,
|
|
|
|
pinned: true,
|
|
|
|
toolbarHeight: 0,
|
|
|
|
toolbarHeight: 0,
|
|
|
|
bottom: PreferredSize(
|
|
|
|
// bottom: PreferredSize(
|
|
|
|
child: Material(
|
|
|
|
// child: Material(
|
|
|
|
color: Color(0xFFF9F9F9),
|
|
|
|
// color: Color(0xFFF9F9F9),
|
|
|
|
child: Align(
|
|
|
|
// child: Align(
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
// alignment: Alignment.centerLeft,
|
|
|
|
child: BeeTabBar(
|
|
|
|
// child: BeeTabBar(
|
|
|
|
scrollable: true,
|
|
|
|
// scrollable: true,
|
|
|
|
controller: _tabController,
|
|
|
|
// controller: _tabController,
|
|
|
|
tabs: ['社区商城', '二手市场'],
|
|
|
|
// tabs: ['社区商城', '二手市场'],
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
preferredSize: Size.fromHeight(48),
|
|
|
|
// preferredSize: Size.fromHeight(48),
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
];
|
|
|
|
];
|
|
|
|
},
|
|
|
|
},
|
|
|
|
body: TabBarView(
|
|
|
|
body: WaterfallFlow.builder(
|
|
|
|
children: [
|
|
|
|
gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
|
|
|
|
SizedBox(),
|
|
|
|
crossAxisCount: 2,
|
|
|
|
SizedBox(),
|
|
|
|
mainAxisSpacing: 20.w,
|
|
|
|
],
|
|
|
|
crossAxisSpacing: 20.w,
|
|
|
|
controller: _tabController,
|
|
|
|
),
|
|
|
|
|
|
|
|
padding: EdgeInsets.all(32.w),
|
|
|
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
|
|
|
final item = _hotItems[index];
|
|
|
|
|
|
|
|
return GoodsCard(item: item);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
itemCount: _hotItems.length,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|