hmxc
章文轩 3 years ago
parent cd783e14e3
commit 2228ae55fe

@ -18,7 +18,7 @@ class CommunityFunc {
static Future<List<GambitModel>> getListGambit() async { static Future<List<GambitModel>> getListGambit() async {
BaseListModel model = await NetUtil().getList( BaseListModel model = await NetUtil().getList(
API.community.listGambit, API.community.listGambit,
params: {'pageNum': 1, 'size': 6}, params: {'pageNum': 1, 'size': 8},
); );
if (model.tableList!.length == 0) return []; if (model.tableList!.length == 0) return [];
return model.tableList!.map((e) => GambitModel.fromJson(e)).toList(); return model.tableList!.map((e) => GambitModel.fromJson(e)).toList();
@ -39,7 +39,6 @@ class CommunityFunc {
BaseModel model = await NetUtil().get( BaseModel model = await NetUtil().get(
API.community.addViews, API.community.addViews,
params: {'newsId': newsId,}, params: {'newsId': newsId,},
showMessage: true,
); );
if (model.message == null) if (model.message == null)
return ''; return '';

@ -4,14 +4,18 @@ import 'package:aku_community/model/common/img_model.dart';
import 'package:aku_community/model/community/event_item_model.dart'; import 'package:aku_community/model/community/event_item_model.dart';
import 'package:aku_community/model/community/gambit_model.dart'; import 'package:aku_community/model/community/gambit_model.dart';
import 'package:aku_community/model/community/hot_news_model.dart'; import 'package:aku_community/model/community/hot_news_model.dart';
import 'package:aku_community/models/news/news_category_model.dart';
import 'package:aku_community/ui/community/activity/activity_list_page.dart'; import 'package:aku_community/ui/community/activity/activity_list_page.dart';
import 'package:aku_community/ui/community/community_func.dart'; import 'package:aku_community/ui/community/community_func.dart';
import 'package:aku_community/ui/community/community_views/widgets/chat_card.dart'; import 'package:aku_community/ui/community/community_views/widgets/chat_card.dart';
import 'package:aku_community/ui/home/home_title.dart'; import 'package:aku_community/ui/home/home_title.dart';
import 'package:aku_community/ui/home/public_infomation/public_infomation_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/search/search_goods_page.dart';
import 'package:aku_community/utils/network/base_list_model.dart'; import 'package:aku_community/utils/network/base_list_model.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: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';
@ -93,9 +97,10 @@ class _CommunityPageState extends State<CommunityPage>
Text( Text(
'附近社区', '附近社区',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w600, fontWeight: FontWeight.bold,
fontSize: 24.sp, fontSize: 32.sp,
color: Color(0xff333333), color: Color(0xff333333),
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
@ -103,38 +108,55 @@ class _CommunityPageState extends State<CommunityPage>
]), ]),
backgroundColor: Colors.white, backgroundColor: Colors.white,
actions: [ actions: [
GestureDetector( Padding(
onTap: () { padding: EdgeInsets.only(right: 32.w),
child: GestureDetector(
}, onTap: () async {
child: Image.asset(R.ASSETS_ICONS_ICON_COMMUNITY_PUSH_PNG, if (LoginUtil.isNotLogin) return;
height: 40.w, width: 40.w), bool? result = await Get.to(() => AddNewEventPage());
if (result == true) {
switch (_tabController!.index) {
case 0:
newKey.currentState!.refresh();
break;
case 1:
topicKey.currentState!.refresh();
break;
case 2:
myKey.currentState!.refresh();
break;
}
}
},
child: Image.asset(R.ASSETS_ICONS_ICON_COMMUNITY_PUSH_PNG,
height: 40.w, width: 40.w),
),
) )
], ],
bottom: PreferredSize( bottom: PreferredSize(
preferredSize: Size.fromHeight(90.w), child: _geSearch()), preferredSize: Size.fromHeight(90.w), child: _geSearch()),
), ),
floatingActionButton: FloatingActionButton( // floatingActionButton: FloatingActionButton(
onPressed: () async { // onPressed: () async {
if (LoginUtil.isNotLogin) return; // if (LoginUtil.isNotLogin) return;
bool? result = await Get.to(() => AddNewEventPage()); // bool? result = await Get.to(() => AddNewEventPage());
if (result == true) { // if (result == true) {
switch (_tabController!.index) { // switch (_tabController!.index) {
case 0: // case 0:
newKey.currentState!.refresh(); // newKey.currentState!.refresh();
break; // break;
case 1: // case 1:
topicKey.currentState!.refresh(); // topicKey.currentState!.refresh();
break; // break;
case 2: // case 2:
myKey.currentState!.refresh(); // myKey.currentState!.refresh();
break; // break;
} // }
} // }
}, // },
heroTag: 'event_add', // heroTag: 'event_add',
child: Icon(Icons.add), // child: Icon(Icons.add),
), // ),
@ -226,7 +248,19 @@ class _CommunityPageState extends State<CommunityPage>
EdgeInsets.only(top: 32.w, bottom: 32.w, left: 32.w, right: 32.w), EdgeInsets.only(top: 32.w, bottom: 32.w, left: 32.w, right: 32.w),
child: Column( child: Column(
children: [ children: [
_homeTitle('热门资讯', () {}, '更多'), _homeTitle('热门资讯', () async {
final cancel = BotToast.showLoading();
BaseModel model = await NetUtil().get(API.news.category);
List<NewsCategoryModel>? category;
if (model.status == true && model.data != null) {
category = (model.data as List)
.map((e) => NewsCategoryModel.fromJson(e))
.toList();
}
cancel();
Get.to(
() => PublicInfomationPage(models: category ?? []));
}, '更多'),
32.hb, 32.hb,
Container( Container(
height: 204.w, height: 204.w,
@ -292,7 +326,13 @@ class _CommunityPageState extends State<CommunityPage>
_infoCard(HotNewsModel item) { _infoCard(HotNewsModel item) {
return GestureDetector( return GestureDetector(
onTap: (){ onTap: () async{
var result = await Get.to(() => PublicInformationDetailPage(id: item.id!));
CommunityFunc.addViews(item.id!);
if(result){
_easyRefreshController.callRefresh();
}
}, },
child: Stack( child: Stack(
@ -445,9 +485,9 @@ class _CommunityPageState extends State<CommunityPage>
//width: MediaQuery.of(context).size.width, //width: MediaQuery.of(context).size.width,
//padding: EdgeInsets.only(left: 10, right: 10), //padding: EdgeInsets.only(left: 10, right: 10),
child: Wrap( child: Wrap(
children: children: [..._gambitModels.map((e) => _choiceChip(e.summary??'',0)).toList()]
[_choiceChip('EDG夺冠',1),_choiceChip('双十一',2), // [_choiceChip('EDG夺冠',1),_choiceChip('双十一',2),
_choiceChip('11月吃土',2),_choiceChip('成都疫情',0),_choiceChip('万圣节',0)], // _choiceChip('11月吃土',2),_choiceChip('成都疫情',0),_choiceChip('万圣节',0)],
), ),
), ),
// Spacer() // Spacer()

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -5,6 +6,7 @@ import 'package:bot_toast/bot_toast.dart';
import 'package:flustars/flustars.dart'; import 'package:flustars/flustars.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:get/get.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
@ -49,6 +51,15 @@ class _PublicInformationDetailPageState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BeeScaffold( return BeeScaffold(
leading:Navigator.canPop(context)
? IconButton(
onPressed: () => Get.back(result: true),
icon: Icon(
CupertinoIcons.chevron_back,
color: Colors.black,
),
)
: SizedBox(),
title: _onload ? '' : _detailModel.newsCategoryName, title: _onload ? '' : _detailModel.newsCategoryName,
bodyColor: Colors.white, bodyColor: Colors.white,
body: EasyRefresh( body: EasyRefresh(

Loading…
Cancel
Save