normal card added in community
This commit is contained in:
BIN
assets/images/png/PinnedIcon.png
Normal file
BIN
assets/images/png/PinnedIcon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
251
lib/Main_Screens/Community/Model/CommonDatumObjModel.dart
Normal file
251
lib/Main_Screens/Community/Model/CommonDatumObjModel.dart
Normal file
@@ -0,0 +1,251 @@
|
||||
class CommonDatumObjModel {
|
||||
CommonDatumObjModel({
|
||||
required this.status,
|
||||
required this.statusCode,
|
||||
required this.message,
|
||||
required this.data,
|
||||
});
|
||||
|
||||
final String? status;
|
||||
final int? statusCode;
|
||||
final String? message;
|
||||
final List<CommonDatumObjModelData> data;
|
||||
|
||||
factory CommonDatumObjModel.fromJson(Map<String, dynamic> json) {
|
||||
return CommonDatumObjModel(
|
||||
status: json["status"],
|
||||
statusCode: json["status_code"],
|
||||
message: json["message"],
|
||||
data: json["data"] == null
|
||||
? []
|
||||
: List<CommonDatumObjModelData>.from(
|
||||
json["data"]!.map((x) => CommonDatumObjModelData.fromJson(x))),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CommonDatumObjModelData {
|
||||
CommonDatumObjModelData({
|
||||
required this.id,
|
||||
required this.likecount,
|
||||
required this.isISaved,
|
||||
required this.tagsXid,
|
||||
required this.isILiked,
|
||||
required this.totalComment,
|
||||
required this.totalSave,
|
||||
required this.iamPrincipalXid,
|
||||
required this.postIn,
|
||||
required this.caption,
|
||||
required this.image,
|
||||
required this.manageTagsXids,
|
||||
required this.postAs,
|
||||
required this.ctaTitle,
|
||||
required this.ctaLink,
|
||||
required this.createdAt,
|
||||
required this.likeIcon,
|
||||
required this.totalViewCount,
|
||||
required this.totalReactionCount,
|
||||
required this.totalCommentCount,
|
||||
required this.totalImpressionCount,
|
||||
required this.totalPopularScore,
|
||||
required this.totalHoursAgo,
|
||||
required this.iamPrincipal,
|
||||
required this.community,
|
||||
required this.attachTags,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final int? likecount;
|
||||
final bool? isISaved;
|
||||
final List<int> tagsXid;
|
||||
final bool? isILiked;
|
||||
final int? totalComment;
|
||||
final int? totalSave;
|
||||
final int? iamPrincipalXid;
|
||||
final int? postIn;
|
||||
final String? caption;
|
||||
final String? image;
|
||||
final String? manageTagsXids;
|
||||
final String? postAs;
|
||||
final String? ctaTitle;
|
||||
final String? ctaLink;
|
||||
final DateTime? createdAt;
|
||||
final LikeIcon1? likeIcon;
|
||||
final int? totalViewCount;
|
||||
final int? totalReactionCount;
|
||||
final int? totalCommentCount;
|
||||
final int? totalImpressionCount;
|
||||
final int? totalPopularScore;
|
||||
final int? totalHoursAgo;
|
||||
final IamPrincipal? iamPrincipal;
|
||||
final Community? community;
|
||||
final List<AttachTag1> attachTags;
|
||||
|
||||
factory CommonDatumObjModelData.fromJson(Map<String, dynamic> json) {
|
||||
return CommonDatumObjModelData(
|
||||
id: json["id"],
|
||||
likecount: json["likecount"],
|
||||
isISaved: json["is_i_saved"],
|
||||
tagsXid: json["tags_xid"] == null
|
||||
? []
|
||||
: List<int>.from(json["tags_xid"]!.map((x) => x)),
|
||||
isILiked: json["is_i_liked"],
|
||||
totalComment: json["total_comment"],
|
||||
totalSave: json["total_save"],
|
||||
iamPrincipalXid: json["iam_principal_xid"],
|
||||
postIn: json["post_in"],
|
||||
caption: json["caption"],
|
||||
image: json["image"],
|
||||
manageTagsXids: json["manage_tags_xids"],
|
||||
postAs: json["post_as"],
|
||||
ctaTitle: json["cta_title"],
|
||||
ctaLink: json["cta_link"],
|
||||
createdAt: DateTime.tryParse(json["created_at"] ?? ""),
|
||||
likeIcon:
|
||||
json["likeIcon"] == null ? null : LikeIcon1.fromJson(json["likeIcon"]),
|
||||
totalViewCount: json["totalViewCount"],
|
||||
totalReactionCount: json["totalReactionCount"],
|
||||
totalCommentCount: json["totalCommentCount"],
|
||||
totalImpressionCount: json["totalImpressionCount"],
|
||||
totalPopularScore: json["totalPopularScore"],
|
||||
totalHoursAgo: json["totalHoursAgo"],
|
||||
iamPrincipal: json["iam_principal"] == null
|
||||
? null
|
||||
: IamPrincipal.fromJson(json["iam_principal"]),
|
||||
community: json["community"] == null
|
||||
? null
|
||||
: Community.fromJson(json["community"]),
|
||||
attachTags: json["attach_tags"] == null
|
||||
? []
|
||||
: List<AttachTag1>.from(
|
||||
json["attach_tags"]!.map((x) => AttachTag1.fromJson(x))),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AttachTag1 {
|
||||
AttachTag1({
|
||||
required this.managePostXid,
|
||||
required this.manageTagXid,
|
||||
required this.manageTag,
|
||||
});
|
||||
|
||||
final int? managePostXid;
|
||||
final int? manageTagXid;
|
||||
final ManageTagPopular? manageTag;
|
||||
|
||||
factory AttachTag1.fromJson(Map<String, dynamic> json) {
|
||||
return AttachTag1(
|
||||
managePostXid: json["manage_post_xid"],
|
||||
manageTagXid: json["manage_tag_xid"],
|
||||
manageTag: json["manage_tag"] == null
|
||||
? null
|
||||
: ManageTagPopular.fromJson(json["manage_tag"]),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ManageTagPopular {
|
||||
ManageTagPopular({
|
||||
required this.id,
|
||||
required this.isPinned,
|
||||
required this.name,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final bool? isPinned;
|
||||
final String? name;
|
||||
|
||||
factory ManageTagPopular.fromJson(Map<String, dynamic> json) {
|
||||
return ManageTagPopular(
|
||||
id: json["id"],
|
||||
isPinned: json["is_pinned"],
|
||||
name: json["name"],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Community {
|
||||
Community({
|
||||
required this.id,
|
||||
required this.communityProfilePhoto,
|
||||
required this.communityName,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final String? communityProfilePhoto;
|
||||
final String? communityName;
|
||||
|
||||
factory Community.fromJson(Map<String, dynamic> json) {
|
||||
return Community(
|
||||
id: json["id"],
|
||||
communityProfilePhoto: json["community_profile_photo"],
|
||||
communityName: json["community_name"],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class IamPrincipal {
|
||||
IamPrincipal({
|
||||
required this.id,
|
||||
required this.isUserPinned,
|
||||
required this.principalTypeXid,
|
||||
required this.userName,
|
||||
required this.fullName,
|
||||
required this.profilePhoto,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final bool? isUserPinned;
|
||||
final int? principalTypeXid;
|
||||
final String? userName;
|
||||
final String? fullName;
|
||||
final String? profilePhoto;
|
||||
|
||||
factory IamPrincipal.fromJson(Map<String, dynamic> json) {
|
||||
return IamPrincipal(
|
||||
id: json["id"],
|
||||
isUserPinned: json["is_user_pinned"],
|
||||
principalTypeXid: json["principal_type_xid"],
|
||||
userName: json["user_name"],
|
||||
fullName: json["full_name"],
|
||||
profilePhoto: json["profile_photo"],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class LikeIcon1 {
|
||||
LikeIcon1({
|
||||
required this.likeIconsXid,
|
||||
required this.likeIcon,
|
||||
});
|
||||
|
||||
final int? likeIconsXid;
|
||||
final LikeIconClass1? likeIcon;
|
||||
|
||||
factory LikeIcon1.fromJson(Map<String, dynamic> json) {
|
||||
return LikeIcon1(
|
||||
likeIconsXid: json["like_icons_xid"],
|
||||
likeIcon: json["like_icon"] == null
|
||||
? null
|
||||
: LikeIconClass1.fromJson(json["like_icon"]),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class LikeIconClass1 {
|
||||
LikeIconClass1({
|
||||
required this.id,
|
||||
required this.image,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final String? image;
|
||||
|
||||
factory LikeIconClass1.fromJson(Map<String, dynamic> json) {
|
||||
return LikeIconClass1(
|
||||
id: json["id"],
|
||||
image: json["image"],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
class FeedPostModel {
|
||||
class FeedPostModel {
|
||||
FeedPostModel({
|
||||
required this.status,
|
||||
required this.statusCode,
|
||||
|
||||
@@ -11,7 +11,7 @@ class LatestpostModel {
|
||||
final String? message;
|
||||
final List<Datum> data;
|
||||
|
||||
factory LatestpostModel.fromJson(Map<String, dynamic> json){
|
||||
factory LatestpostModel.fromJson(Map<String, dynamic> json){
|
||||
return LatestpostModel(
|
||||
status: json["status"],
|
||||
statusCode: json["status_code"],
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,60 @@
|
||||
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';
|
||||
import 'package:regroup/Main_Screens/Community/ViewModel/PopularPost.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;
|
||||
RxList<bool> pinButtonPopular = <bool>[].obs;
|
||||
|
||||
setListsPopular() {
|
||||
likesCounterPopular.clear();
|
||||
commentsCounterPopular.clear();
|
||||
savePostCounterPopular.clear();
|
||||
saveButtonPopular.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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -29,33 +29,36 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:regroup/Common/CommonGlassmorphism.dart';
|
||||
import 'package:regroup/Common/controller/MainScreen.dart';
|
||||
import 'package:regroup/Utils/Common/sized_box.dart';
|
||||
import 'package:regroup/resources/routes/route_name.dart';
|
||||
|
||||
class CommonAppbar extends StatelessWidget implements PreferredSizeWidget {
|
||||
@override
|
||||
Size get preferredSize => Size.fromHeight(height);
|
||||
|
||||
const CommonAppbar({
|
||||
Key? key,
|
||||
required this.titleTxt,
|
||||
this.showLeading = true,
|
||||
this.customActionWidget,
|
||||
this.onCustomActionPressed,
|
||||
this.showEdit = false,
|
||||
this.customBack,
|
||||
this.editPageName,
|
||||
this.height = 80,
|
||||
}) : super(key: key);
|
||||
const CommonAppbar(
|
||||
{Key? key,
|
||||
required this.titleTxt,
|
||||
this.showLeading = true,
|
||||
this.customActionWidget,
|
||||
this.onCustomActionPressed,
|
||||
this.showEdit = false,
|
||||
this.customBack = false,
|
||||
this.editPageName,
|
||||
this.height = 80,
|
||||
this.customRouteName})
|
||||
: super(key: key);
|
||||
|
||||
final String titleTxt;
|
||||
final bool? showLeading;
|
||||
final Widget? customActionWidget;
|
||||
final VoidCallback? onCustomActionPressed;
|
||||
final bool? showEdit;
|
||||
final bool? customBack;
|
||||
final bool customBack;
|
||||
final String? editPageName;
|
||||
final double height;
|
||||
|
||||
final String? customRouteName;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PreferredSize(
|
||||
@@ -125,7 +128,11 @@ class CommonAppbar extends StatelessWidget implements PreferredSizeWidget {
|
||||
padding: EdgeInsets.only(top: 10.h),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
if (customBack) {
|
||||
Get.back(result: true);
|
||||
} else {
|
||||
Get.back();
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
|
||||
72
pubspec.lock
72
pubspec.lock
@@ -49,6 +49,30 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
cached_network_image:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: cached_network_image
|
||||
sha256: "4a5d8d2c728b0f3d0245f69f921d7be90cae4c2fd5288f773088672c0893f819"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.4.0"
|
||||
cached_network_image_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cached_network_image_platform_interface
|
||||
sha256: ff0c949e323d2a1b52be73acce5b4a7b04063e61414c8ca542dbba47281630a7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.1.0"
|
||||
cached_network_image_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cached_network_image_web
|
||||
sha256: "6322dde7a5ad92202e64df659241104a43db20ed594c41ca18de1014598d7996"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -318,6 +342,14 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_cache_manager:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_cache_manager
|
||||
sha256: a77f77806a790eb9ba0118a5a3a936e81c4fea2b61533033b2b0c3d50bbde5ea
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.4.0"
|
||||
flutter_facebook_auth:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -880,6 +912,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.5.0"
|
||||
octo_image:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: octo_image
|
||||
sha256: "34faa6639a78c7e3cbe79be6f9f96535867e879748ade7d17c9b1ae7536293bd"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1048,6 +1088,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.0.1+1"
|
||||
rxdart:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: rxdart
|
||||
sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.28.0"
|
||||
shared_preferences:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -1165,6 +1213,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.0"
|
||||
sqflite:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sqflite
|
||||
sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.3+1"
|
||||
sqflite_common:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sqflite_common
|
||||
sha256: "3da423ce7baf868be70e2c0976c28a1bb2f73644268b7ffa7d2e08eab71f16a4"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.4"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1229,6 +1293,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "21.2.10"
|
||||
synchronized:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: synchronized
|
||||
sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.0+1"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -77,6 +77,8 @@ dependencies:
|
||||
flutter_html: ^3.0.0-beta.2
|
||||
comment_tree: ^0.3.0
|
||||
flutter_keyboard_visibility: ^6.0.0
|
||||
cached_network_image: any
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user