108 lines
4.1 KiB
Dart
108 lines
4.1 KiB
Dart
import 'package:get/get.dart';
|
|
import 'package:regroup/Main_Screens/Community/Model/CommonDatumObjModel.dart';
|
|
import 'package:regroup/Main_Screens/Community/Model/FeedPostModel.dart';
|
|
import 'package:regroup/Main_Screens/Community/ViewModel/LatestPost.dart';
|
|
|
|
List<PinnedPost> combinedListGlobal = [];
|
|
CommonDatumObjModel? commonobjmodel;
|
|
|
|
class CountersHelper extends GetxController {
|
|
RxList<int> likesCounterPopular = <int>[].obs;
|
|
RxList<int> commentsCounterPopular = <int>[].obs;
|
|
RxList<int> savePostCounterPopular = <int>[].obs;
|
|
RxList<bool> saveButtonPopular = <bool>[].obs;
|
|
List<bool> pinButtonPopular = <bool>[];
|
|
RxBool updateFeedsPage = false.obs;
|
|
setListsPopular() {
|
|
likesCounterPopular.clear();
|
|
commentsCounterPopular.clear();
|
|
savePostCounterPopular.clear();
|
|
saveButtonPopular.clear();
|
|
pinButtonPopular.clear();
|
|
for (var i = 0; i < commonobjmodel!.data.length; i++) {
|
|
likesCounterPopular.add(commonobjmodel?.data[i].likecount ?? 0);
|
|
commentsCounterPopular
|
|
.add(commonobjmodel?.data[i].totalCommentCount ?? 0);
|
|
savePostCounterPopular.add(commonobjmodel?.data[i].totalSave ?? 0);
|
|
saveButtonPopular.add(commonobjmodel?.data[i].isISaved ?? false);
|
|
pinButtonPopular
|
|
.add(commonobjmodel?.data[i].iamPrincipal?.isUserPinned ?? false);
|
|
}
|
|
}
|
|
|
|
RxList<int> likesCounterFeed = <int>[].obs;
|
|
RxList<int> commentsCounterFeed = <int>[].obs;
|
|
RxList<int> savePostCounterFeed = <int>[].obs;
|
|
|
|
setListsFeed() {
|
|
for (var i = 0; i < combinedListGlobal.length; i++) {
|
|
likesCounterLatest.add(combinedListGlobal[i].likecount ?? 0);
|
|
commentsCounterLatest.add(combinedListGlobal[i].totalCommentCount ?? 0);
|
|
savePostCounterLatest.add(combinedListGlobal[i].totalSave ?? 0);
|
|
}
|
|
}
|
|
|
|
RxList<int> likesCounterLatest = <int>[].obs;
|
|
RxList<int> commentsCounterLatest = <int>[].obs;
|
|
RxList<int> savePostCounterLatest = <int>[].obs;
|
|
|
|
setListsLatest() {
|
|
for (var i = 0; i < latestpostobj!.data.length; i++) {
|
|
likesCounterFeed.add(latestpostobj!.data[i].likecount ?? 0);
|
|
commentsCounterFeed.add(latestpostobj!.data[i].totalCommentCount ?? 0);
|
|
savePostCounterFeed.add(latestpostobj!.data[i].totalSave ?? 0);
|
|
}
|
|
}
|
|
|
|
//ComPosts
|
|
RxList<int> likesCounterComPosts= <int>[].obs;
|
|
RxList<int> commentsCounterComPosts = <int>[].obs;
|
|
RxList<int> savePostCounterComPosts = <int>[].obs;
|
|
RxList<bool> saveButtonComPosts = <bool>[].obs;
|
|
// RxList<bool> pinButtonComPosts = <bool>[].obs;
|
|
|
|
setListsComPosts() {
|
|
likesCounterComPosts.clear();
|
|
commentsCounterComPosts.clear();
|
|
savePostCounterComPosts.clear();
|
|
saveButtonComPosts.clear();
|
|
|
|
for (var i = 0; i < commonobjmodel!.data.length; i++) {
|
|
likesCounterComPosts.add(commonobjmodel?.data[i].likecount ?? 0);
|
|
commentsCounterComPosts
|
|
.add(commonobjmodel?.data[i].totalCommentCount ?? 0);
|
|
savePostCounterComPosts.add(commonobjmodel?.data[i].totalSave ?? 0);
|
|
saveButtonComPosts.add(commonobjmodel?.data[i].isISaved ?? false);
|
|
// pinButtonComPosts
|
|
// .add(commonobjmodel?.data[i].iamPrincipal?.isUserPinned ?? false);
|
|
}
|
|
}
|
|
|
|
|
|
//tagPostPopular
|
|
RxList<int> likesCountertagPopular = <int>[].obs;
|
|
RxList<int> commentsCountertagPopular = <int>[].obs;
|
|
RxList<int> savePostCountertagPopular = <int>[].obs;
|
|
|
|
setListstagPopular() {
|
|
for (var i = 0; i < combinedListGlobal.length; i++) {
|
|
likesCounterLatest.add(combinedListGlobal[i].likecount ?? 0);
|
|
commentsCounterLatest.add(combinedListGlobal[i].totalCommentCount ?? 0);
|
|
savePostCounterLatest.add(combinedListGlobal[i].totalSave ?? 0);
|
|
}
|
|
}
|
|
|
|
//tagPostLatest
|
|
RxList<int> likesCountertagLatest = <int>[].obs;
|
|
RxList<int> commentsCountertagLatest = <int>[].obs;
|
|
RxList<int> savePostCountertagLatest = <int>[].obs;
|
|
|
|
setListstagtagLatest() {
|
|
for (var i = 0; i < combinedListGlobal.length; i++) {
|
|
likesCounterLatest.add(combinedListGlobal[i].likecount ?? 0);
|
|
commentsCounterLatest.add(combinedListGlobal[i].totalCommentCount ?? 0);
|
|
savePostCounterLatest.add(combinedListGlobal[i].totalSave ?? 0);
|
|
}
|
|
}
|
|
}
|