|
|
@ -28,6 +28,7 @@ import 'package:aku_new_community/widget/others/user_tool.dart';
|
|
|
|
import 'package:bot_toast/bot_toast.dart';
|
|
|
|
import 'package:bot_toast/bot_toast.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
|
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
@ -84,106 +85,117 @@ class _CommunityPageState extends State<CommunityPage>
|
|
|
|
super.build(context);
|
|
|
|
super.build(context);
|
|
|
|
final userProvider = Provider.of<UserProvider>(context);
|
|
|
|
final userProvider = Provider.of<UserProvider>(context);
|
|
|
|
final appProvider = Provider.of<AppProvider>(context);
|
|
|
|
final appProvider = Provider.of<AppProvider>(context);
|
|
|
|
return Scaffold(
|
|
|
|
return AnnotatedRegion<SystemUiOverlayStyle>(
|
|
|
|
appBar: AppBar(
|
|
|
|
value: SystemUiOverlayStyle.dark,
|
|
|
|
titleSpacing: 0,
|
|
|
|
child: Scaffold(
|
|
|
|
title: Align(
|
|
|
|
appBar: PreferredSize(
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
preferredSize: Size.fromHeight(88.w),
|
|
|
|
child: Theme(
|
|
|
|
child: Container(
|
|
|
|
data: ThemeData(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
splashColor: Colors.transparent,
|
|
|
|
gradient:
|
|
|
|
highlightColor: Colors.transparent,
|
|
|
|
LinearGradient(colors: [Colors.white, Color(0xFFFFF9D1)])),
|
|
|
|
),
|
|
|
|
child: AppBar(
|
|
|
|
child: TabBar(
|
|
|
|
titleSpacing: 0,
|
|
|
|
onTap: (index) {
|
|
|
|
title: Align(
|
|
|
|
setState(() {});
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
if (_tabController?.index == 1) {
|
|
|
|
child: Theme(
|
|
|
|
myKey.currentState?.refresh();
|
|
|
|
data: ThemeData(
|
|
|
|
}
|
|
|
|
splashColor: Colors.transparent,
|
|
|
|
},
|
|
|
|
highlightColor: Colors.transparent,
|
|
|
|
controller: _tabController,
|
|
|
|
),
|
|
|
|
indicatorColor: Color(0xffffc40c),
|
|
|
|
child: TabBar(
|
|
|
|
indicatorPadding: EdgeInsets.only(bottom: 15.w),
|
|
|
|
onTap: (index) {
|
|
|
|
indicator: const BoxDecoration(),
|
|
|
|
setState(() {});
|
|
|
|
tabs: _tabs.map((e) => Tab(text: e)).toList(),
|
|
|
|
if (_tabController?.index == 1) {
|
|
|
|
labelStyle:
|
|
|
|
myKey.currentState?.refresh();
|
|
|
|
TextStyle(fontSize: 36.sp, fontWeight: FontWeight.bold),
|
|
|
|
}
|
|
|
|
labelColor: Color(0xD9000000),
|
|
|
|
},
|
|
|
|
unselectedLabelStyle: TextStyle(fontSize: 32.sp),
|
|
|
|
controller: _tabController,
|
|
|
|
unselectedLabelColor: Color(0x73000000),
|
|
|
|
indicatorColor: Color(0xffffc40c),
|
|
|
|
isScrollable: true,
|
|
|
|
indicatorPadding: EdgeInsets.only(bottom: 15.w),
|
|
|
|
),
|
|
|
|
indicator: const BoxDecoration(),
|
|
|
|
)),
|
|
|
|
tabs: _tabs.map((e) => Tab(text: e)).toList(),
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
actions: [
|
|
|
|
fontSize: 36.sp, fontWeight: FontWeight.bold),
|
|
|
|
Padding(
|
|
|
|
labelColor: Color(0xD9000000),
|
|
|
|
padding: EdgeInsets.only(right: 32.w),
|
|
|
|
unselectedLabelStyle: TextStyle(fontSize: 32.sp),
|
|
|
|
child: GestureDetector(
|
|
|
|
unselectedLabelColor: Color(0x73000000),
|
|
|
|
onTap: () async {
|
|
|
|
isScrollable: true,
|
|
|
|
if (LoginUtil.isNotLogin) return;
|
|
|
|
),
|
|
|
|
bool? result = await Get.to(() => AddNewEventPage());
|
|
|
|
)),
|
|
|
|
if (result == true) {
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
switch (_tabController!.index) {
|
|
|
|
actions: [
|
|
|
|
case 0:
|
|
|
|
Padding(
|
|
|
|
_easyRefreshController.callRefresh();
|
|
|
|
padding: EdgeInsets.only(right: 32.w),
|
|
|
|
|
|
|
|
child: GestureDetector(
|
|
|
|
|
|
|
|
onTap: () async {
|
|
|
|
|
|
|
|
if (LoginUtil.isNotLogin) return;
|
|
|
|
|
|
|
|
bool? result = await Get.to(() => AddNewEventPage());
|
|
|
|
|
|
|
|
if (result == true) {
|
|
|
|
|
|
|
|
switch (_tabController!.index) {
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
|
|
_easyRefreshController.callRefresh();
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
case 1:
|
|
|
|
myKey.currentState!.refresh();
|
|
|
|
myKey.currentState!.refresh();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Image.asset(R.ASSETS_ICONS_ICON_COMMUNITY_PUSH_PNG,
|
|
|
|
child: Image.asset(R.ASSETS_ICONS_ICON_COMMUNITY_PUSH_PNG,
|
|
|
|
height: 40.w, width: 40.w),
|
|
|
|
height: 40.w, width: 40.w),
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
body: TabBarView(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
EasyRefresh(
|
|
|
|
|
|
|
|
firstRefresh: true,
|
|
|
|
|
|
|
|
header: MaterialHeader(),
|
|
|
|
|
|
|
|
footer: MaterialFooter(),
|
|
|
|
|
|
|
|
controller: _easyRefreshController,
|
|
|
|
|
|
|
|
onRefresh: () async {
|
|
|
|
|
|
|
|
_pageNum = 1;
|
|
|
|
|
|
|
|
await (getNewInfo());
|
|
|
|
|
|
|
|
_gambitModels = await CommunityFunc.getListGambit();
|
|
|
|
|
|
|
|
_hotNewsModels = await CommunityFunc.getHotNews();
|
|
|
|
|
|
|
|
_onload = false;
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onLoad: () async {
|
|
|
|
|
|
|
|
_pageNum++;
|
|
|
|
|
|
|
|
await loadNewInfo();
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: _onload
|
|
|
|
|
|
|
|
? SizedBox()
|
|
|
|
|
|
|
|
: ListView(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
// _geSearch(),
|
|
|
|
|
|
|
|
// 2.hb,
|
|
|
|
|
|
|
|
_hotNewsModels.isEmpty ? SizedBox() : _getInfo(),
|
|
|
|
|
|
|
|
16.hb,
|
|
|
|
|
|
|
|
_gambitModels.isEmpty ? SizedBox() : _getNews(),
|
|
|
|
|
|
|
|
16.hb,
|
|
|
|
|
|
|
|
..._newItems
|
|
|
|
|
|
|
|
.map((e) => ChatCard(
|
|
|
|
|
|
|
|
model: e,
|
|
|
|
|
|
|
|
refresh: () {
|
|
|
|
|
|
|
|
_easyRefreshController.callRefresh();
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
.toList()
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (UserTool.userProvider.isLogin) MyCommunityView(key: myKey),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
body: TabBarView(
|
|
|
|
controller: _tabController,
|
|
|
|
children: [
|
|
|
|
|
|
|
|
EasyRefresh(
|
|
|
|
|
|
|
|
firstRefresh: true,
|
|
|
|
|
|
|
|
header: MaterialHeader(),
|
|
|
|
|
|
|
|
footer: MaterialFooter(),
|
|
|
|
|
|
|
|
controller: _easyRefreshController,
|
|
|
|
|
|
|
|
onRefresh: () async {
|
|
|
|
|
|
|
|
_pageNum = 1;
|
|
|
|
|
|
|
|
await (getNewInfo());
|
|
|
|
|
|
|
|
_gambitModels = await CommunityFunc.getListGambit();
|
|
|
|
|
|
|
|
_hotNewsModels = await CommunityFunc.getHotNews();
|
|
|
|
|
|
|
|
_onload = false;
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onLoad: () async {
|
|
|
|
|
|
|
|
_pageNum++;
|
|
|
|
|
|
|
|
await loadNewInfo();
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: _onload
|
|
|
|
|
|
|
|
? SizedBox()
|
|
|
|
|
|
|
|
: ListView(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
// _geSearch(),
|
|
|
|
|
|
|
|
// 2.hb,
|
|
|
|
|
|
|
|
_hotNewsModels.isEmpty ? SizedBox() : _getInfo(),
|
|
|
|
|
|
|
|
16.hb,
|
|
|
|
|
|
|
|
_gambitModels.isEmpty ? SizedBox() : _getNews(),
|
|
|
|
|
|
|
|
16.hb,
|
|
|
|
|
|
|
|
..._newItems
|
|
|
|
|
|
|
|
.map((e) => ChatCard(
|
|
|
|
|
|
|
|
model: e,
|
|
|
|
|
|
|
|
refresh: () {
|
|
|
|
|
|
|
|
_easyRefreshController.callRefresh();
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
.toList()
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
if (UserTool.userProvider.isLogin) MyCommunityView(key: myKey),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
controller: _tabController,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|