|
@@ -1,25 +1,27 @@
|
|
|
import 'package:cs_resources/generated/assets.dart';
|
|
|
+import 'package:domain/entity/newsfeed_foryou_entity.dart';
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
import 'package:plugin_platform/engine/toast/toast_engine.dart';
|
|
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
|
import 'package:router/ext/auto_router_extensions.dart';
|
|
|
+import 'package:shared/utils/ext_dart.dart';
|
|
|
import 'package:shared/utils/log_utils.dart';
|
|
|
import 'package:widgets/load_state_layout.dart';
|
|
|
import 'package:widgets/widget_export.dart';
|
|
|
|
|
|
+import '../../../respository/newsfeed_foryou_repository.dart';
|
|
|
import '../../../router/page/community_page_router.dart';
|
|
|
import '../community_pageview_idx_data.dart';
|
|
|
import '../community_vm.dart';
|
|
|
import '../newsfeed_detail/newsfeed_detail_page.dart';
|
|
|
-import 'foryou_respository.dart';
|
|
|
import 'foryou_state.dart';
|
|
|
|
|
|
part 'foryou_vm.g.dart';
|
|
|
|
|
|
@riverpod
|
|
|
class ForyouVm extends _$ForyouVm {
|
|
|
- late ForyouRepository ForyouRepositoryInstance;
|
|
|
- bool _needShowPlaceholder = true; //是否展示LoadingView
|
|
|
+ late NewsFeedForyouRepository repositoryInstance;
|
|
|
+ bool _needShowPlaceholder = false; //是否展示LoadingView
|
|
|
|
|
|
// Refresh 控制器
|
|
|
final EasyRefreshController refreshController = EasyRefreshController(
|
|
@@ -29,92 +31,14 @@ class ForyouVm extends _$ForyouVm {
|
|
|
|
|
|
ForyouState initState() {
|
|
|
return ForyouState(
|
|
|
- list: [
|
|
|
- {
|
|
|
- 'id':1,
|
|
|
- 'avator': Assets.communityCamera,
|
|
|
- 'title': 'William Jefferson',
|
|
|
- 'isFollow': false,
|
|
|
- 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
|
|
|
- 'imageUrls': ['https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500','https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500','https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500'],
|
|
|
- 'time': 'June 17,2016 at 7:23 p.m.',
|
|
|
- 'isLike': true,
|
|
|
- 'likeno': 12
|
|
|
- },
|
|
|
- {
|
|
|
- 'id':2,
|
|
|
- 'avator': Assets.communityCamera,
|
|
|
- 'title': 'William fdsaf的飞洒发生的',
|
|
|
- 'isFollow': true,
|
|
|
- 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
|
|
|
- 'imageUrls': [],
|
|
|
- 'time': 'June 17,2016 at 7:23 p.m.',
|
|
|
- 'isLike': true,
|
|
|
- 'likeno': 12
|
|
|
- },
|
|
|
- {
|
|
|
- 'id':3,
|
|
|
- 'avator': Assets.communityCamera,
|
|
|
- 'title': 'Fsjfkds dfsk',
|
|
|
- 'isFollow': false,
|
|
|
- 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
|
|
|
- 'imageUrls': [],
|
|
|
- 'time': 'June 17,2016 at 7:23 p.m.',
|
|
|
- 'isLike': false,
|
|
|
- 'likeno': 12
|
|
|
- },
|
|
|
- {
|
|
|
- 'id':4,
|
|
|
- 'avator': Assets.communityCamera,
|
|
|
- 'title': 'Fsjfkds dfsk',
|
|
|
- 'isFollow': false,
|
|
|
- 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
|
|
|
- 'imageUrls': [],
|
|
|
- 'time': 'June 17,2016 at 7:23 p.m.',
|
|
|
- 'isLike': false,
|
|
|
- 'likeno': 12
|
|
|
- },
|
|
|
- {
|
|
|
- 'id':5,
|
|
|
- 'avator': Assets.communityCamera,
|
|
|
- 'title': 'Fsjfkds dfsk',
|
|
|
- 'isFollow': false,
|
|
|
- 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
|
|
|
- 'imageUrls': [],
|
|
|
- 'time': 'June 17,2016 at 7:23 p.m.',
|
|
|
- 'isLike': false,
|
|
|
- 'likeno': 12
|
|
|
- },
|
|
|
- {
|
|
|
- 'id':6,
|
|
|
- 'avator': Assets.communityCamera,
|
|
|
- 'title': 'Fsjfkds dfsk',
|
|
|
- 'isFollow': false,
|
|
|
- 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
|
|
|
- 'imageUrls': [],
|
|
|
- 'time': 'June 17,2016 at 7:23 p.m.',
|
|
|
- 'isLike': false,
|
|
|
- 'likeno': 12
|
|
|
- },
|
|
|
- {
|
|
|
- 'id':7,
|
|
|
- 'avator': Assets.communityCamera,
|
|
|
- 'title': '放大发大水',
|
|
|
- 'isFollow': false,
|
|
|
- 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
|
|
|
- 'imageUrls': [],
|
|
|
- 'time': 'June 17,2016 at 7:23 p.m.',
|
|
|
- 'isLike': false,
|
|
|
- 'likeno': 12
|
|
|
- },
|
|
|
- ]
|
|
|
+ list: []
|
|
|
);
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
ForyouState build(){
|
|
|
// 引入数据仓库
|
|
|
- ForyouRepositoryInstance = ref.read(foryouRepositoryProvider);
|
|
|
+ repositoryInstance = ref.read(newsFeedForyouRepositoryProvider);
|
|
|
final state = initState();
|
|
|
Log.d("--------------------------build---------------------");
|
|
|
|
|
@@ -141,16 +65,16 @@ class ForyouVm extends _$ForyouVm {
|
|
|
if(isShowing){
|
|
|
Log.d("----foryou_vm-----loadMore");
|
|
|
// await Future.delayed(const Duration(seconds: 2));
|
|
|
- // if(state.list.length >= state.filterCount){
|
|
|
+ // if(state.list.length >= state.count){
|
|
|
// return;
|
|
|
// }else {
|
|
|
- // int curPage = state.curPage + 1;
|
|
|
- // state = state.copyWith(curPage: curPage,);
|
|
|
+ // int page = state.page + 1;
|
|
|
+ // state = state.copyWith(page: page,);
|
|
|
// getListData();
|
|
|
// }
|
|
|
- // 检查 curPage 是否为 null,并初始化为 1
|
|
|
- int newCurPage = state.curPage ?? 1;
|
|
|
- state = state.copyWith(curPage: ++newCurPage);
|
|
|
+ // 检查 page 是否为 null,并初始化为 1
|
|
|
+ int newCurPage = state.page ?? 1;
|
|
|
+ state = state.copyWith(page: ++newCurPage);
|
|
|
getListData();
|
|
|
}else {
|
|
|
refreshController.finishRefresh();
|
|
@@ -165,12 +89,10 @@ class ForyouVm extends _$ForyouVm {
|
|
|
// 当前pageView 页面正处于显示状态
|
|
|
Log.d("----forsale_vm-----onRefresh ");
|
|
|
// await Future.delayed(const Duration(seconds: 2));
|
|
|
- state = state.copyWith(curPage: 1);
|
|
|
+ state = state.copyWith(page: 1);
|
|
|
getListData();
|
|
|
}else {
|
|
|
refreshController.finishRefresh();
|
|
|
- // //更新展示的状态
|
|
|
- changeLoadingState(LoadState.State_Success, null);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -178,7 +100,7 @@ class ForyouVm extends _$ForyouVm {
|
|
|
Future retryRequest() async {
|
|
|
bool isShowing = await ref.read(communityVmProvider.notifier).isCurrentPageViewShowing(CommunityPageViewIdxData.forYou);
|
|
|
if(isShowing){
|
|
|
- state = state.copyWith(curPage: 1);
|
|
|
+ state = state.copyWith(page: 1);
|
|
|
_needShowPlaceholder = true;
|
|
|
getListData();
|
|
|
}
|
|
@@ -191,12 +113,12 @@ class ForyouVm extends _$ForyouVm {
|
|
|
changeLoadingState(LoadState.State_Loading, null);
|
|
|
}
|
|
|
|
|
|
- Log.d("for_sale加载listData数据---------------start--${state.curPage}---");
|
|
|
+ Log.d("加载listData数据---------------start--${state.page}---");
|
|
|
// try {
|
|
|
// //请求网络
|
|
|
// Map<String, dynamic> params = {
|
|
|
- // "curPage": state.curPage,
|
|
|
- // "pageSize": state.pageSize,
|
|
|
+ // "page": state.page,
|
|
|
+ // "limit": state.limit,
|
|
|
// };
|
|
|
// Log.d("请求参数------$params");
|
|
|
// final result = await propertyNewsRepository.fetchPropertyNewsList(params);
|
|
@@ -216,76 +138,244 @@ class ForyouVm extends _$ForyouVm {
|
|
|
// ToastEngine.show("Error: $e");
|
|
|
// }
|
|
|
|
|
|
- await Future.delayed(const Duration(milliseconds: 1500));
|
|
|
- final List<Map<String, dynamic>> listData = [
|
|
|
- {
|
|
|
- 'id':1,
|
|
|
- 'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
|
|
|
- 'title': 'William Jefferson',
|
|
|
- 'isFollow': false,
|
|
|
- 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
|
|
|
- 'imageUrls': ['https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500','https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500','https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500'],
|
|
|
- 'time': 'June 17,2016 at 7:23 p.m.',
|
|
|
- 'isLike': true,
|
|
|
- 'likeno': 12
|
|
|
- },
|
|
|
- {
|
|
|
- 'id':2,
|
|
|
- 'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
|
|
|
- 'title': 'William fdsaf的飞洒发生的',
|
|
|
- 'isFollow': true,
|
|
|
- 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
|
|
|
- 'imageUrls': [],
|
|
|
- 'time': 'June 17,2016 at 7:23 p.m.',
|
|
|
- 'isLike': true,
|
|
|
- 'likeno': 12
|
|
|
- },
|
|
|
- ];
|
|
|
-
|
|
|
- if (state.curPage == 1) {
|
|
|
- //刷新的方式
|
|
|
- state = state.copyWith(list: listData);
|
|
|
- refreshController.finishRefresh();
|
|
|
- // //更新展示的状态
|
|
|
- changeLoadingState(LoadState.State_Success, null);
|
|
|
- } else {
|
|
|
- //加载更多
|
|
|
- final allList = state.list;
|
|
|
- allList?.addAll(listData);
|
|
|
- state = state.copyWith(list: allList);
|
|
|
- refreshController.finishLoad();
|
|
|
+ // await Future.delayed(const Duration(milliseconds: 1500));
|
|
|
+ // final List<Map<String, dynamic>> listData = [
|
|
|
+ // {
|
|
|
+ // 'id':1,
|
|
|
+ // 'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
|
|
|
+ // 'title': 'William Jefferson',
|
|
|
+ // 'isFollow': false,
|
|
|
+ // 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
|
|
|
+ // 'imageUrls': ['https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500','https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500','https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500'],
|
|
|
+ // 'time': 'June 17,2016 at 7:23 p.m.',
|
|
|
+ // 'isLike': true,
|
|
|
+ // 'likeno': 12
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // 'id':2,
|
|
|
+ // 'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
|
|
|
+ // 'title': 'William fdsaf的飞洒发生的',
|
|
|
+ // 'isFollow': true,
|
|
|
+ // 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
|
|
|
+ // 'imageUrls': [],
|
|
|
+ // 'time': 'June 17,2016 at 7:23 p.m.',
|
|
|
+ // 'isLike': true,
|
|
|
+ // 'likeno': 12
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // 'id':3,
|
|
|
+ // 'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
|
|
|
+ // 'title': 'Fsjfkds dfsk',
|
|
|
+ // 'isFollow': false,
|
|
|
+ // 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
|
|
|
+ // 'imageUrls': [],
|
|
|
+ // 'time': 'June 17,2016 at 7:23 p.m.',
|
|
|
+ // 'isLike': false,
|
|
|
+ // 'likeno': 12
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // 'id':4,
|
|
|
+ // 'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
|
|
|
+ // 'title': 'Fsjfkds dfsk',
|
|
|
+ // 'isFollow': false,
|
|
|
+ // 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
|
|
|
+ // 'imageUrls': [],
|
|
|
+ // 'time': 'June 17,2016 at 7:23 p.m.',
|
|
|
+ // 'isLike': false,
|
|
|
+ // 'likeno': 12
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // 'id':5,
|
|
|
+ // 'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
|
|
|
+ // 'title': 'Fsjfkds dfsk',
|
|
|
+ // 'isFollow': false,
|
|
|
+ // 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
|
|
|
+ // 'imageUrls': [],
|
|
|
+ // 'time': 'June 17,2016 at 7:23 p.m.',
|
|
|
+ // 'isLike': false,
|
|
|
+ // 'likeno': 12
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // 'id':6,
|
|
|
+ // 'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
|
|
|
+ // 'title': 'Fsjfkds dfsk',
|
|
|
+ // 'isFollow': false,
|
|
|
+ // 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
|
|
|
+ // 'imageUrls': [],
|
|
|
+ // 'time': 'June 17,2016 at 7:23 p.m.',
|
|
|
+ // 'isLike': false,
|
|
|
+ // 'likeno': 12
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // 'id':7,
|
|
|
+ // 'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
|
|
|
+ // 'title': '放大发大水',
|
|
|
+ // 'isFollow': false,
|
|
|
+ // 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
|
|
|
+ // 'imageUrls': [],
|
|
|
+ // 'time': 'June 17,2016 at 7:23 p.m.',
|
|
|
+ // 'isLike': false,
|
|
|
+ // 'likeno': 12
|
|
|
+ // },
|
|
|
+ // ];
|
|
|
+ //
|
|
|
+ // if (state.page == 1) {
|
|
|
+ // //刷新的方式
|
|
|
+ // state = state.copyWith(list: listData);
|
|
|
+ // refreshController.finishRefresh();
|
|
|
+ // // //更新展示的状态
|
|
|
+ // changeLoadingState(LoadState.State_Success, null);
|
|
|
+ // } else {
|
|
|
+ // //加载更多
|
|
|
+ // final allList = state.list;
|
|
|
+ // allList?.addAll(listData);
|
|
|
+ // state = state.copyWith(list: allList);
|
|
|
+ // refreshController.finishLoad();
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // // 最后赋值
|
|
|
+ // _needShowPlaceholder = false;
|
|
|
|
|
|
+ try {
|
|
|
+ //请求网络
|
|
|
+ Map<String, dynamic> params = {
|
|
|
+ "page": state.page,
|
|
|
+ "limit": state.limit,
|
|
|
+ };
|
|
|
+ Log.d("请求参数------$params");
|
|
|
+ final result = await repositoryInstance.fetchForyouList(params);
|
|
|
+ //校验成功失败
|
|
|
+ if (result.isSuccess) {
|
|
|
+ handlerResultList((result.data as NewsfeedForyouEntity).list);
|
|
|
+ } else {
|
|
|
+ String errorMessage = result.errorMsg!;
|
|
|
+ changeLoadingState(LoadState.State_Error, errorMessage);
|
|
|
+ ToastEngine.show(result.errorMsg ?? "Network Load Error");
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ ToastEngine.show("Error: $e");
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- // 最后赋值
|
|
|
- _needShowPlaceholder = false;
|
|
|
+
|
|
|
+ void handlerResultList(List<NewsfeedForyouList>? list) {
|
|
|
+ if (list != null && list.isNotEmpty) {
|
|
|
+ //有数据,判断是刷新还是加载更多的数据
|
|
|
+ if (state.page == 1) {
|
|
|
+ //刷新的方式
|
|
|
+ state.list!.clear();
|
|
|
+ state.list!.addAll(list.map((item) => item.toJson()).toList());
|
|
|
+ refreshController.finishRefresh();
|
|
|
+
|
|
|
+ //更新展示的状态
|
|
|
+ changeLoadingState(LoadState.State_Success, null);
|
|
|
+ } else {
|
|
|
+ //加载更多
|
|
|
+ final allList = state.list;
|
|
|
+ state = state.copyWith(list: allList);
|
|
|
+ refreshController.finishLoad();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (state.page == 1) {
|
|
|
+ //展示无数据的布局
|
|
|
+ state.list!.clear();
|
|
|
+ changeLoadingState(LoadState.State_Empty, null);
|
|
|
+ refreshController.finishRefresh();
|
|
|
+ } else {
|
|
|
+ //展示加载完成,没有更多数据了
|
|
|
+ if(state.list!.length == 0){
|
|
|
+ changeLoadingState(LoadState.State_Empty, null);
|
|
|
+ }else {
|
|
|
+ if(_needShowPlaceholder){
|
|
|
+ changeLoadingState(LoadState.State_Success, null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ refreshController.finishLoad(IndicatorResult.noMore);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ // 点赞/取消点赞
|
|
|
+ Future handlerLikeClick(int id, bool isLike, int itemidx) async {
|
|
|
+ try {
|
|
|
+ final result = await repositoryInstance.fetchLikeClick({
|
|
|
+ "id": id,
|
|
|
+ });
|
|
|
+ if (result.isSuccess) {
|
|
|
+ //重新赋值data或list
|
|
|
+ // final json = result.getDataJson();
|
|
|
+ // var data = NewsfeedNewsEntity.fromJson(json!);
|
|
|
+ //重新赋值data或list
|
|
|
+ // state.list![id].liked = data.list![0].liked;
|
|
|
+ // state.list![id].likeno = data.list![0].likeno;
|
|
|
+ final String toastMsg = isLike ? "Cancel successfully": "Liked successfully";
|
|
|
+ ToastEngine.show(toastMsg);
|
|
|
+ // 修改 state.list[itemIdx] 中的 like 状态 和 likes_count
|
|
|
+ state.list![itemidx]['liked'] = !isLike;
|
|
|
+ if(isLike){
|
|
|
+ // 取消点赞
|
|
|
+ if(state.list![itemidx]['likes_count']>0){
|
|
|
+ state.list![itemidx]['likes_count'] = state.list![itemidx]['likes_count'] - 1;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ state.list![itemidx]['likes_count'] = state.list![itemidx]['likes_count'] + 1;
|
|
|
+ }
|
|
|
+ //重新赋值data或list
|
|
|
+ changeLoadingState(LoadState.State_Success, null);
|
|
|
+ return true;
|
|
|
+ }else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }catch(error) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// 点击 like comments share
|
|
|
- void handlerClickActionBtn(String? actionStr, item){
|
|
|
+ Future<bool?> handlerClickActionBtn(String? actionStr, Map<String, dynamic> item, int itemidx) async{
|
|
|
final id = item['id'];
|
|
|
+ final liked = item.getValue('liked', false);
|
|
|
switch (actionStr) {
|
|
|
case 'like':
|
|
|
- Log.d("点击了 点赞");
|
|
|
- handlerGotoDetail(id);
|
|
|
- break;
|
|
|
+ return await handlerLikeClick(id, liked, itemidx);
|
|
|
case 'comments':
|
|
|
Log.d("点击了 评论");
|
|
|
- handlerGotoDetail(id);
|
|
|
+ handlerGotoDetail(null, id);
|
|
|
break;
|
|
|
case 'share':
|
|
|
Log.d("点击了 分享");
|
|
|
- handlerGotoDetail(id);
|
|
|
+ handlerGotoDetail(null, id);
|
|
|
break;
|
|
|
default:
|
|
|
Log.d("点击了卡片");
|
|
|
- handlerGotoDetail(id);
|
|
|
+ handlerGotoDetail(null, id);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+ Future handlerFollow(BuildContext context, bool isFollow) async{
|
|
|
+ Log.d("点击了 关注");
|
|
|
+ // try {
|
|
|
+ // //请求网络
|
|
|
+ // Map<String, dynamic> params = {
|
|
|
+ //
|
|
|
+ // };
|
|
|
+ // Log.d("请求参数------$params");
|
|
|
+ // final result = await repositoryInstance.fetchNewsList(params);
|
|
|
+ // //校验成功失败
|
|
|
+ // if (result.isSuccess) {
|
|
|
+ // handlerResultList((result.data as NewsfeedNewsEntity).list);
|
|
|
+ // } else {
|
|
|
+ // String errorMessage = result.errorMsg!;
|
|
|
+ // changeLoadingState(LoadState.State_Error, errorMessage);
|
|
|
+ // ToastEngine.show(result.errorMsg ?? "Network Load Error");
|
|
|
+ // }
|
|
|
+ // } catch (e) {
|
|
|
+ // ToastEngine.show("Error: $e");
|
|
|
+ // }
|
|
|
+ }
|
|
|
// 去详情页面
|
|
|
- void handlerGotoDetail(id){
|
|
|
+ void handlerGotoDetail(BuildContext? context, int id){
|
|
|
Log.d("去详情页面");
|
|
|
appRouter.push(NewsfeedDetailPageRoute(id: id, type:'foryou'));
|
|
|
}
|