parent
538a010fdf
commit
305e443909
@ -0,0 +1,84 @@
|
||||
import 'package:aku_community/utils/headers.dart';
|
||||
import 'package:aku_community/widget/bee_scaffold.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@Deprecated('NO NEED THIS CLASS IN FUTURE')
|
||||
class MarketData {
|
||||
final String name;
|
||||
final String path;
|
||||
MarketData({
|
||||
required this.name,
|
||||
required this.path,
|
||||
});
|
||||
}
|
||||
|
||||
@Deprecated('NO NEED THIS LIST IN FUTURE')
|
||||
List<MarketData> mockableMarketData = [
|
||||
MarketData(name: '居家生活', path: R.ASSETS_ICONS_TOOL_JJSH_PNG),
|
||||
MarketData(name: '数码家电', path: R.ASSETS_ICONS_TOOL_SMJD_PNG),
|
||||
MarketData(name: '休闲副食', path: R.ASSETS_ICONS_TOOL_XXFS_PNG),
|
||||
MarketData(name: '滋补保健', path: R.ASSETS_ICONS_TOOL_ZBBJ_PNG),
|
||||
MarketData(name: '彩妆香水', path: R.ASSETS_ICONS_TOOL_CZXS_PNG),
|
||||
MarketData(name: '服饰箱包', path: R.ASSETS_ICONS_TOOL_FSXB_PNG),
|
||||
MarketData(name: '母婴玩具', path: R.ASSETS_ICONS_TOOL_MYWJ_PNG),
|
||||
MarketData(name: '饮料酒水', path: R.ASSETS_ICONS_TOOL_YLJS_PNG),
|
||||
];
|
||||
|
||||
@Deprecated('NO NEED THIS WIDGET IN FUTURE')
|
||||
class MockableMarketWidget extends StatelessWidget {
|
||||
final MarketData data;
|
||||
const MockableMarketWidget({Key? key, required this.data}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialButton(
|
||||
child: Column(
|
||||
children: [
|
||||
Spacer(),
|
||||
Image.asset(
|
||||
data.path,
|
||||
height: 75.w,
|
||||
width: 75.w,
|
||||
),
|
||||
12.hb,
|
||||
Text(
|
||||
data.name,
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
color: Color(0xFF4A4B51),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
onPressed: () {
|
||||
Get.to(
|
||||
() => BeeScaffold(
|
||||
title: data.name,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated('NO NEED THIS WIDGET IN FUTURE')
|
||||
class MockableMarketList extends StatefulWidget {
|
||||
MockableMarketList({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MockableMarketListState createState() => _MockableMarketListState();
|
||||
}
|
||||
|
||||
class _MockableMarketListState extends State<MockableMarketList> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return EasyRefresh(
|
||||
header: MaterialHeader(completeDuration: Duration(milliseconds: 300)),
|
||||
onRefresh: () async {},
|
||||
child: ListView(),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
import 'package:aku_community/ui/market/_market_data.dart';
|
||||
import 'package:aku_community/widget/bee_scaffold.dart';
|
||||
import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
|
||||
class MarketPage extends StatefulWidget {
|
||||
MarketPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MarketPageState createState() => _MarketPageState();
|
||||
}
|
||||
|
||||
class _MarketPageState extends State<MarketPage>
|
||||
with AutomaticKeepAliveClientMixin, TickerProviderStateMixin {
|
||||
late TabController _tabController;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_tabController = TabController(length: 2, vsync: this);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
final mediaWidth = MediaQuery.of(context).size.width;
|
||||
print({
|
||||
'height': MediaQuery.of(context).size.height,
|
||||
'width': MediaQuery.of(context).size.width,
|
||||
});
|
||||
return BeeScaffold(
|
||||
title: '商城',
|
||||
body: NestedScrollView(
|
||||
headerSliverBuilder: (context, value) {
|
||||
return [
|
||||
SliverAppBar(
|
||||
//AppBar top Widget height
|
||||
//bottom height: 48
|
||||
// flexibleSpace的高为 (设备宽 - 边距)/4*2 + 外边距 + bottom高
|
||||
expandedHeight: (mediaWidth - 32.w * 2) / 4 * 2 + 16.w * 2 + 48,
|
||||
backgroundColor: Colors.transparent,
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background: Container(
|
||||
color: Color(0xFFF9F9F9),
|
||||
padding: EdgeInsets.only(
|
||||
top: 16.w,
|
||||
left: 32.w,
|
||||
right: 32.w,
|
||||
bottom: 16.w + 48, //底部边距需要加上bottom高
|
||||
),
|
||||
child: Material(
|
||||
color: Colors.white,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
borderRadius: BorderRadius.circular(8.w),
|
||||
child: GridView(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 4,
|
||||
childAspectRatio: 1,
|
||||
),
|
||||
shrinkWrap: true,
|
||||
children: mockableMarketData
|
||||
.map((e) => MockableMarketWidget(data: e))
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
pinned: true,
|
||||
toolbarHeight: 0,
|
||||
bottom: PreferredSize(
|
||||
child: Material(
|
||||
color: Color(0xFFF9F9F9),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: BeeTabBar(
|
||||
scrollable: true,
|
||||
controller: _tabController,
|
||||
tabs: ['社区商城', '二手市场'],
|
||||
),
|
||||
),
|
||||
),
|
||||
preferredSize: Size.fromHeight(48),
|
||||
),
|
||||
),
|
||||
];
|
||||
},
|
||||
body: TabBarView(
|
||||
children: [
|
||||
MockableMarketList(),
|
||||
MockableMarketList(),
|
||||
],
|
||||
controller: _tabController,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
}
|
Loading…
Reference in new issue