diff --git a/lib/Main_Screens/Community_HomePage/Community.dart b/lib/Main_Screens/Community_HomePage/Community.dart index f550bbd..f2360a8 100644 --- a/lib/Main_Screens/Community_HomePage/Community.dart +++ b/lib/Main_Screens/Community_HomePage/Community.dart @@ -2,13 +2,12 @@ import 'dart:developer'; +import 'package:async/src/future_group.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_reaction_button/flutter_reaction_button.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:get/get_state_manager/get_state_manager.dart'; import 'package:regroup/Common/CommonBottomNavigationBar.dart'; import 'package:regroup/Common/CommonGlassmorphism.dart'; import 'package:regroup/Common/CommonTabBar.dart'; @@ -16,7 +15,6 @@ import 'package:regroup/Common/CommonWidget.dart'; import 'package:regroup/Common/ConvertServerDateToUserDate.dart'; import 'package:regroup/Common/base_manager.dart'; import 'package:regroup/Common/controller/MainScreen.dart'; -import 'package:regroup/Feed%20Module/Main_Screens/Community/view_model/getApi.dart'; import 'package:regroup/Main_Screens/Community/Model/CommonDatumObjModel.dart'; import 'package:regroup/Main_Screens/Community/Model/FeedPostModel.dart' as feedobj; @@ -37,7 +35,6 @@ import 'package:regroup/Utils/dialogs.dart'; import 'package:regroup/Utils/texts.dart'; import 'package:regroup/resources/routes/route_name.dart'; import 'package:regroup/sidemenu/sidemenu.dart'; -import 'package:async/src/future_group.dart'; import 'package:regroup/sidemenu/view_model/postmethod.dart'; import 'view_model/CountersHelper.dart'; @@ -207,7 +204,7 @@ class FeedTab extends StatefulWidget { class _FeedTabState extends State { late Future feedfuture; List _reactions = []; - Map _selectedReactions = {}; + final Map _selectedReactions = {}; final CountersHelper countersHelper = Get.find(); int? likeIconIdnew; List combinedList = []; @@ -673,8 +670,14 @@ class _NormalCardTileState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ CircleAvatar( - foregroundImage: NetworkImage( - widget.commonObj.iamPrincipal!.profilePhoto!), + backgroundImage: widget + .commonObj.iamPrincipal?.profilePhoto != + null + ? NetworkImage( + widget.commonObj.iamPrincipal!.profilePhoto!) + as ImageProvider + : const AssetImage('assets/images/default_profile.png') + as ImageProvider, radius: 25.r, ), sizedBoxWidth(12.w), @@ -837,9 +840,7 @@ class _NormalCardTileState extends State { 'currentIndex': widget.currentIndex }); if (result) { - setState(() { - - }); + setState(() {}); } }, child: SizedBox( @@ -1158,7 +1159,7 @@ class PopularTab extends StatefulWidget { class _PopularTabState extends State { late Future popularfuture; List _reactions = []; - Map _selectedReactions = {}; + final Map _selectedReactions = {}; final CountersHelper countersHelper = Get.find(); int? likeIconIdnew; @override @@ -1373,7 +1374,7 @@ class _LatestTabState extends State { } List _reactions = []; - Map _selectedReactions = {}; + final Map _selectedReactions = {}; final CountersHelper countersHelper = Get.find(); int? likeIconIdnew; diff --git a/lib/main.dart b/lib/main.dart index 1ca9fa7..171c6cc 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -125,7 +125,7 @@ class _MyAppState extends State with WidgetsBindingObserver { debugShowCheckedModeBanner: false, // initialRoute: RouteName.individualactivitystep2, - initialRoute: RouteName.individualactivitystep2, + initialRoute: RouteName.splashScreen, getPages: AppRoutes.appRoutes(), ), diff --git a/lib/sidemenu/Community/MyCommunity/Model/ComPostModel.dart b/lib/sidemenu/Community/MyCommunity/Model/ComPostModel.dart index 4aa330a..0a1fbe1 100644 --- a/lib/sidemenu/Community/MyCommunity/Model/ComPostModel.dart +++ b/lib/sidemenu/Community/MyCommunity/Model/ComPostModel.dart @@ -1,200 +1,485 @@ class ComPostModel { - ComPostModel({ - required this.status, - required this.statusCode, - required this.message, - required this.data, - }); + ComPostModel({ + required this.status, + required this.statusCode, + required this.message, + required this.data, + }); - final String? status; - final int? statusCode; - final String? message; - final List data; - - factory ComPostModel.fromJson(Map json){ - return ComPostModel( - status: json["status"], - statusCode: json["status_code"], - message: json["message"], - data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => Datum.fromJson(x))), - ); - } + final String? status; + final int? statusCode; + final String? message; + final List data; + factory ComPostModel.fromJson(Map json) { + return ComPostModel( + status: json["status"], + statusCode: json["status_code"], + message: json["message"], + data: json["data"] == null + ? [] + : List.from(json["data"]!.map((x) => Datum.fromJson(x))), + ); + } } class Datum { - Datum({ - required this.id, - required this.iamPrincipalXid, - required this.postIn, - required this.caption, - required this.image, - required this.manageTagsXids, - required this.postAs, - required this.isUploadedByBussinessUser, - required this.ctaTitle, - required this.ctaLink, - required this.isActive, - required this.createdBy, - required this.modifiedBy, - required this.deletedAt, - required this.createdAt, - required this.updatedAt, - required this.likecount, - required this.isILiked, - required this.isIFollow, - required this.isISaved, - required this.likeIcon, - required this.totalComment, - required this.totalSave, - required this.tagsXid, - required this.totalViewCount, - required this.totalReactionCount, - required this.totalCommentCount, - required this.totalImpressionCount, - required this.totalPopularScore, - required this.totalHoursAgo, - required this.userDetail, - required this.attachTags, - }); + Datum({ + required this.id, + required this.iamPrincipalXid, + required this.postIn, + required this.caption, + required this.image, + required this.manageTagsXids, + required this.postAs, + required this.isUploadedByBussinessUser, + required this.ctaTitle, + required this.ctaLink, + required this.isActive, + required this.createdBy, + required this.modifiedBy, + required this.deletedAt, + required this.createdAt, + required this.updatedAt, + required this.likecount, + required this.isILiked, + required this.isIFollow, + required this.isISaved, + required this.likeIcon, + required this.totalComment, + required this.totalSave, + required this.tagsXid, + 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? iamPrincipalXid; - final int? postIn; - final String? caption; - final String? image; - final String? manageTagsXids; - final String? postAs; - final int? isUploadedByBussinessUser; - final String? ctaTitle; - final String? ctaLink; - final int? isActive; - final dynamic createdBy; - final dynamic modifiedBy; - final dynamic deletedAt; - final DateTime? createdAt; - final DateTime? updatedAt; - final int? likecount; - final bool? isILiked; - final bool? isIFollow; - final bool? isISaved; - final dynamic likeIcon; - final int? totalComment; - final int? totalSave; - final List tagsXid; - final int? totalViewCount; - final int? totalReactionCount; - final int? totalCommentCount; - final int? totalImpressionCount; - final int? totalPopularScore; - final int? totalHoursAgo; - final UserDetail? userDetail; - final List attachTags; - - factory Datum.fromJson(Map json){ - return Datum( - id: json["id"], - iamPrincipalXid: json["iam_principal_xid"], - postIn: json["post_in"], - caption: json["caption"], - image: json["image"], - manageTagsXids: json["manage_tags_xids"], - postAs: json["post_as"], - isUploadedByBussinessUser: json["is_uploaded_by_bussiness_user"], - ctaTitle: json["cta_title"], - ctaLink: json["cta_link"], - isActive: json["is_active"], - createdBy: json["created_by"], - modifiedBy: json["modified_by"], - deletedAt: json["deleted_at"], - createdAt: DateTime.tryParse(json["created_at"] ?? ""), - updatedAt: DateTime.tryParse(json["updated_at"] ?? ""), - likecount: json["likecount"], - isILiked: json["is_i_liked"], - isIFollow: json["is_i_follow"], - isISaved: json["is_i_saved"], - likeIcon: json["likeIcon"], - totalComment: json["total_comment"], - totalSave: json["total_save"], - tagsXid: json["tags_xid"] == null ? [] : List.from(json["tags_xid"]!.map((x) => x)), - totalViewCount: json["totalViewCount"], - totalReactionCount: json["totalReactionCount"], - totalCommentCount: json["totalCommentCount"], - totalImpressionCount: json["totalImpressionCount"], - totalPopularScore: json["totalPopularScore"], - totalHoursAgo: json["totalHoursAgo"], - userDetail: json["user_detail"] == null ? null : UserDetail.fromJson(json["user_detail"]), - attachTags: json["attach_tags"] == null ? [] : List.from(json["attach_tags"]!.map((x) => AttachTag.fromJson(x))), - ); - } + final int? id; + final int? iamPrincipalXid; + final int? postIn; + final String? caption; + final String? image; + final String? manageTagsXids; + final String? postAs; + final int? isUploadedByBussinessUser; + final String? ctaTitle; + final String? ctaLink; + final int? isActive; + final dynamic createdBy; + final dynamic modifiedBy; + final dynamic deletedAt; + final DateTime? createdAt; + final DateTime? updatedAt; + final int? likecount; + final bool? isILiked; + final bool? isIFollow; + final bool? isISaved; + final dynamic likeIcon; + final int? totalComment; + final int? totalSave; + final List tagsXid; + 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 attachTags; + factory Datum.fromJson(Map json) { + return Datum( + id: json["id"], + iamPrincipalXid: json["iam_principal_xid"], + postIn: json["post_in"], + caption: json["caption"], + image: json["image"], + manageTagsXids: json["manage_tags_xids"], + postAs: json["post_as"], + isUploadedByBussinessUser: json["is_uploaded_by_bussiness_user"], + ctaTitle: json["cta_title"], + ctaLink: json["cta_link"], + isActive: json["is_active"], + createdBy: json["created_by"], + modifiedBy: json["modified_by"], + deletedAt: json["deleted_at"], + createdAt: DateTime.tryParse(json["created_at"] ?? ""), + updatedAt: DateTime.tryParse(json["updated_at"] ?? ""), + likecount: json["likecount"], + isILiked: json["is_i_liked"], + isIFollow: json["is_i_follow"], + isISaved: json["is_i_saved"], + likeIcon: json["likeIcon"], + totalComment: json["total_comment"], + totalSave: json["total_save"], + tagsXid: json["tags_xid"] == null + ? [] + : List.from(json["tags_xid"]!.map((x) => x)), + 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.from( + json["attach_tags"]!.map((x) => AttachTag.fromJson(x))), + ); + } } class AttachTag { - AttachTag({ - required this.managePostXid, - required this.manageTagXid, - required this.manageTag, - }); + AttachTag({ + required this.managePostXid, + required this.manageTagXid, + required this.manageTag, + }); - final int? managePostXid; - final int? manageTagXid; - final ManageTag? manageTag; - - factory AttachTag.fromJson(Map json){ - return AttachTag( - managePostXid: json["manage_post_xid"], - manageTagXid: json["manage_tag_xid"], - manageTag: json["manage_tag"] == null ? null : ManageTag.fromJson(json["manage_tag"]), - ); - } + final int? managePostXid; + final int? manageTagXid; + final ManageTag? manageTag; + factory AttachTag.fromJson(Map json) { + return AttachTag( + managePostXid: json["manage_post_xid"], + manageTagXid: json["manage_tag_xid"], + manageTag: json["manage_tag"] == null + ? null + : ManageTag.fromJson(json["manage_tag"]), + ); + } } class ManageTag { - ManageTag({ - required this.id, - required this.isPinned, - required this.name, - }); + ManageTag({ + required this.id, + required this.isPinned, + required this.name, + }); - final int? id; - final bool? isPinned; - final String? name; - - factory ManageTag.fromJson(Map json){ - return ManageTag( - id: json["id"], - isPinned: json["is_pinned"], - name: json["name"], - ); - } + final int? id; + final bool? isPinned; + final String? name; + factory ManageTag.fromJson(Map json) { + return ManageTag( + id: json["id"], + isPinned: json["is_pinned"], + name: json["name"], + ); + } } -class UserDetail { - UserDetail({ - required this.id, - required this.principalTypeXid, - required this.userName, - required this.profilePhoto, - required this.isUserPinned, - }); +class Community { + Community({ + required this.id, + required this.communityProfilePhoto, + required this.communityBannerImage, + required this.communityName, + required this.totalGroup, + required this.totalAnnouncements, + }); - final int? id; - final int? principalTypeXid; - final String? userName; - final String? profilePhoto; - final bool? isUserPinned; - - factory UserDetail.fromJson(Map json){ - return UserDetail( - id: json["id"], - principalTypeXid: json["principal_type_xid"], - userName: json["user_name"], - profilePhoto: json["profile_photo"], - isUserPinned: json["is_user_pinned"], - ); - } + final int? id; + final String? communityProfilePhoto; + final String? communityBannerImage; + final String? communityName; + final int? totalGroup; + final int? totalAnnouncements; + factory Community.fromJson(Map json) { + return Community( + id: json["id"], + communityProfilePhoto: json["community_profile_photo"], + communityBannerImage: json["community_banner_image"], + communityName: json["community_name"], + totalGroup: json["total_group"], + totalAnnouncements: json["total_announcements"], + ); + } } + +class IamPrincipal { + IamPrincipal({ + required this.id, + required this.principalTypeXid, + required this.userName, + required this.fullName, + required this.profilePhoto, + required this.isUserPinned, + }); + + final int? id; + final int? principalTypeXid; + final String? userName; + final String? fullName; + final String? profilePhoto; + final bool? isUserPinned; + + factory IamPrincipal.fromJson(Map json) { + return IamPrincipal( + id: json["id"], + principalTypeXid: json["principal_type_xid"], + userName: json["user_name"], + fullName: json["full_name"], + profilePhoto: json["profile_photo"], + isUserPinned: json["is_user_pinned"], + ); + } +} + +/* +{ + "status": "success", + "status_code": 200, + "message": "Data Fetched Successfully.", + "data": [ + { + "id": 1, + "iam_principal_xid": 24, + "post_in": 1, + "caption": "test", + "image": "https://regroup.betadelivery.com/storage/app/public/uploads/post_image/66a88f43ac269.png?d=1723806586", + "manage_tags_xids": "[2,1,3]", + "post_as": "Individual", + "is_uploaded_by_bussiness_user": 1, + "cta_title": "test", + "cta_link": "test", + "is_active": 1, + "created_by": null, + "modified_by": null, + "deleted_at": null, + "created_at": "2024-07-30T06:59:15.000000Z", + "updated_at": "2024-07-30T06:59:15.000000Z", + "likecount": 6, + "is_i_liked": false, + "is_i_follow": false, + "is_i_saved": true, + "likeIcon": null, + "total_comment": 6, + "total_save": 2, + "tags_xid": [ + 2, + 1, + 3 + ], + "totalViewCount": 10, + "totalReactionCount": 6, + "totalCommentCount": 6, + "totalImpressionCount": 0, + "totalPopularScore": 0, + "totalHoursAgo": 412, + "iam_principal": { + "id": 24, + "principal_type_xid": 1, + "user_name": "kishansjsj", + "full_name": "kishan", + "profile_photo": "https://regroup.betadelivery.com/storage/app/public/uploads/profile_photos/1720599966.jpg?d=1723806586", + "is_user_pinned": false + }, + "community": { + "id": 1, + "community_profile_photo": "https://regroup.betadelivery.com/storage/app/public/uploads/community_profile_photo/66a8c09525d87.jpg?d=1723806586", + "community_banner_image": "https://regroup.betadelivery.com/storage/app/public/uploads/community_banner_image/66a8c09527b92.jpg?d=1723806586", + "community_name": "Flutter Community", + "total_group": 5, + "total_announcements": 3 + }, + "attach_tags": [ + { + "manage_post_xid": 1, + "manage_tag_xid": 2, + "manage_tag": { + "id": 2, + "is_pinned": false, + "name": "Test 1" + } + }, + { + "manage_post_xid": 1, + "manage_tag_xid": 1, + "manage_tag": { + "id": 1, + "is_pinned": false, + "name": "Test 2" + } + }, + { + "manage_post_xid": 1, + "manage_tag_xid": 3, + "manage_tag": { + "id": 3, + "is_pinned": false, + "name": "another test 1" + } + } + ] + }, + { + "id": 2, + "iam_principal_xid": 24, + "post_in": 1, + "caption": "test", + "image": "https://regroup.betadelivery.com/storage/app/public/uploads/post_image/66ab5b2a52291.png?d=1723806586", + "manage_tags_xids": "[2,1,3]", + "post_as": "Individual", + "is_uploaded_by_bussiness_user": 0, + "cta_title": null, + "cta_link": null, + "is_active": 1, + "created_by": null, + "modified_by": null, + "deleted_at": null, + "created_at": "2024-08-01T09:53:46.000000Z", + "updated_at": "2024-08-01T09:53:46.000000Z", + "likecount": 0, + "is_i_liked": false, + "is_i_follow": false, + "is_i_saved": false, + "likeIcon": null, + "total_comment": 1, + "total_save": 0, + "tags_xid": [ + 2, + 1, + 3 + ], + "totalViewCount": 8, + "totalReactionCount": 0, + "totalCommentCount": 1, + "totalImpressionCount": 0, + "totalPopularScore": 0, + "totalHoursAgo": 361, + "iam_principal": { + "id": 24, + "principal_type_xid": 1, + "user_name": "kishansjsj", + "full_name": "kishan", + "profile_photo": "https://regroup.betadelivery.com/storage/app/public/uploads/profile_photos/1720599966.jpg?d=1723806586", + "is_user_pinned": false + }, + "community": { + "id": 1, + "community_profile_photo": "https://regroup.betadelivery.com/storage/app/public/uploads/community_profile_photo/66a8c09525d87.jpg?d=1723806586", + "community_banner_image": "https://regroup.betadelivery.com/storage/app/public/uploads/community_banner_image/66a8c09527b92.jpg?d=1723806586", + "community_name": "Flutter Community", + "total_group": 5, + "total_announcements": 3 + }, + "attach_tags": [ + { + "manage_post_xid": 2, + "manage_tag_xid": 2, + "manage_tag": { + "id": 2, + "is_pinned": false, + "name": "Test 1" + } + }, + { + "manage_post_xid": 2, + "manage_tag_xid": 1, + "manage_tag": { + "id": 1, + "is_pinned": false, + "name": "Test 2" + } + }, + { + "manage_post_xid": 2, + "manage_tag_xid": 3, + "manage_tag": { + "id": 3, + "is_pinned": false, + "name": "another test 1" + } + } + ] + }, + { + "id": 3, + "iam_principal_xid": 10, + "post_in": 1, + "caption": "this is individual caption", + "image": "https://regroup.betadelivery.com/storage/app/public/uploads/post_image/66ab5ceb8ddb5.jpg?d=1723806586", + "manage_tags_xids": "[5,7]", + "post_as": "Individual", + "is_uploaded_by_bussiness_user": 0, + "cta_title": null, + "cta_link": null, + "is_active": 1, + "created_by": null, + "modified_by": null, + "deleted_at": null, + "created_at": "2024-08-01T10:01:15.000000Z", + "updated_at": "2024-08-01T10:01:15.000000Z", + "likecount": 2, + "is_i_liked": false, + "is_i_follow": false, + "is_i_saved": false, + "likeIcon": null, + "total_comment": 0, + "total_save": 0, + "tags_xid": [ + 5, + 7 + ], + "totalViewCount": 1, + "totalReactionCount": 2, + "totalCommentCount": 0, + "totalImpressionCount": 0, + "totalPopularScore": 0, + "totalHoursAgo": 361, + "iam_principal": { + "id": 10, + "principal_type_xid": 1, + "user_name": "shubham shirva", + "full_name": "Shubham", + "profile_photo": "https://regroup.betadelivery.com/storage/app/public/uploads/profile_photos/1720599966.jpg?d=1723806586", + "is_user_pinned": false + }, + "community": { + "id": 1, + "community_profile_photo": "https://regroup.betadelivery.com/storage/app/public/uploads/community_profile_photo/66a8c09525d87.jpg?d=1723806586", + "community_banner_image": "https://regroup.betadelivery.com/storage/app/public/uploads/community_banner_image/66a8c09527b92.jpg?d=1723806586", + "community_name": "Flutter Community", + "total_group": 5, + "total_announcements": 3 + }, + "attach_tags": [ + { + "manage_post_xid": 3, + "manage_tag_xid": 5, + "manage_tag": { + "id": 5, + "is_pinned": false, + "name": "Test new" + } + }, + { + "manage_post_xid": 3, + "manage_tag_xid": 7, + "manage_tag": { + "id": 7, + "is_pinned": false, + "name": "Test new 2" + } + } + ] + } + ] +}*/ \ No newline at end of file diff --git a/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart b/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart index 2dc972a..3d17bba 100644 --- a/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart +++ b/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart @@ -1,6 +1,4 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_reaction_button/flutter_reaction_button.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -8,15 +6,12 @@ import 'package:regroup/Common/CommonGlassmorphism.dart'; import 'package:regroup/Common/CommonTabBar.dart'; import 'package:regroup/Common/CommonWidget.dart'; import 'package:regroup/Common/ConvertServerDateToUserDate.dart'; -import 'package:regroup/Common/base_manager.dart'; import 'package:regroup/Main_Screens/Community/Model/CommonDatumObjModel.dart'; import 'package:regroup/Main_Screens/Community/Model/fetchicons.dart'; import 'package:regroup/Main_Screens/Community/ViewModel/getmethod.dart'; import 'package:regroup/Main_Screens/Community_HomePage/Community.dart'; -import 'package:regroup/Main_Screens/Community_HomePage/PostDetailScreen/ViewModel/PostDetailApi.dart'; import 'package:regroup/Main_Screens/Community_HomePage/view_model/CountersHelper.dart'; import 'package:regroup/Utils/Common/CommonAppbar.dart'; - import 'package:regroup/Utils/Common/sized_box.dart'; import 'package:regroup/Utils/texts.dart'; import 'package:regroup/resources/routes/route_name.dart'; @@ -38,7 +33,6 @@ class _CommunityDetailsState extends State { @override void initState() { - // TODO: implement initState CommunityId = Get.arguments["CommunityID"]; myfuture = CommunityDetail().getCommunityDetail(CommunityId); @@ -49,16 +43,16 @@ class _CommunityDetailsState extends State { Widget build(BuildContext context) { return Scaffold( // key: _scaffoldKey1, - backgroundColor: Color(0xFF222935), + backgroundColor: const Color(0xFF222935), extendBody: true, resizeToAvoidBottomInset: false, appBar: CommonAppbar( titleTxt: "", customActionWidget: PopupMenuButton( - surfaceTintColor: Color(0xFF222935), + surfaceTintColor: const Color(0xFF222935), constraints: BoxConstraints.tightFor(width: 180.w), - offset: Offset(0, 40), - color: Color(0xFF222935), + offset: const Offset(0, 40), + color: const Color(0xFF222935), tooltip: "", itemBuilder: (BuildContext context) => [ PopupMenuItem( @@ -68,7 +62,7 @@ class _CommunityDetailsState extends State { child: Row( children: [ text14w400white("Invite"), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/uiw_user-add.png", height: 15.h, @@ -78,7 +72,7 @@ class _CommunityDetailsState extends State { ), ), ), - PopupMenuDivider(), + const PopupMenuDivider(), PopupMenuItem( onTap: () {}, child: Padding( @@ -86,7 +80,7 @@ class _CommunityDetailsState extends State { child: Row( children: [ text14w400white("Share"), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/share.png", height: 20.h, @@ -96,7 +90,7 @@ class _CommunityDetailsState extends State { ), ), ), - PopupMenuDivider(), + const PopupMenuDivider(), PopupMenuItem( onTap: () {}, child: Padding( @@ -104,7 +98,7 @@ class _CommunityDetailsState extends State { child: Row( children: [ text14w400white("Search"), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/Frame 58575.png", height: 18.h, @@ -114,7 +108,7 @@ class _CommunityDetailsState extends State { ), ), ), - PopupMenuDivider(), + const PopupMenuDivider(), PopupMenuItem( onTap: () {}, child: Padding( @@ -122,7 +116,7 @@ class _CommunityDetailsState extends State { child: Row( children: [ text14w400white("Mute notification"), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/Black1233.png", height: 16.h, @@ -132,7 +126,7 @@ class _CommunityDetailsState extends State { ), ), ), - PopupMenuDivider(), + const PopupMenuDivider(), PopupMenuItem( onTap: () {}, child: Padding( @@ -140,7 +134,7 @@ class _CommunityDetailsState extends State { child: Row( children: [ text14w400white("Pin"), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/f7_pin-fill (2).png", height: 25.h, @@ -150,11 +144,11 @@ class _CommunityDetailsState extends State { ), ), ), - PopupMenuDivider(), + const PopupMenuDivider(), PopupMenuItem( onTap: () { - Get.toNamed(RouteName.communitysetting,arguments: { - 'communityid' : CommunityId, + Get.toNamed(RouteName.communitysetting, arguments: { + 'communityid': CommunityId, }); }, child: Padding( @@ -162,7 +156,7 @@ class _CommunityDetailsState extends State { child: Row( children: [ text14w400white("Edit community"), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/setting2.png", height: 18.h, @@ -249,10 +243,10 @@ class _CommunityDetailsState extends State { decoration: BoxDecoration( shape: BoxShape.circle, border: Border.all( - color: Color.fromRGBO(255, 255, 255, 0.5), + color: const Color.fromRGBO(255, 255, 255, 0.5), width: 1, ), - boxShadow: [ + boxShadow: const [ BoxShadow( color: Color.fromRGBO(0, 0, 0, 0.25), blurRadius: 12, @@ -260,21 +254,21 @@ class _CommunityDetailsState extends State { ), ], ), - child: comdetailobj!.data!.communityProfilePhoto != - null - ? CircleAvatar( - radius: 42.5.r, - foregroundImage: NetworkImage(comdetailobj! - .data! - .communityProfilePhoto!), // Replace with your API image URL - backgroundColor: Colors - .transparent, // Optional: If the image fails to load, a transparent background is shown - ) - : CircleAvatar( - radius: 42.5.r, - foregroundImage: - AssetImage("assets/images/png/img2.png"), - ), + child: + comdetailobj!.data!.communityProfilePhoto != null + ? CircleAvatar( + radius: 42.5.r, + foregroundImage: NetworkImage(comdetailobj! + .data! + .communityProfilePhoto!), // Replace with your API image URL + backgroundColor: Colors + .transparent, // Optional: If the image fails to load, a transparent background is shown + ) + : CircleAvatar( + radius: 42.5.r, + foregroundImage: const AssetImage( + "assets/images/png/img2.png"), + ), )) ]), sizedBoxHeight(40.h), @@ -285,7 +279,7 @@ class _CommunityDetailsState extends State { children: [ text20w700_FCFCFC( comdetailobj!.data!.communityName ?? ""), - Spacer(), + const Spacer(), commonGlassUI( width: 35.w, height: 35.h, @@ -409,7 +403,7 @@ class _CommunityDetailsState extends State { ), sizedBoxWidth(90.w), text16w400_white('7 members'), - Spacer(), + const Spacer(), Icon( Icons.arrow_forward, size: 20.sp, @@ -447,7 +441,7 @@ class _CommunityDetailsState extends State { sizedBoxWidth(15.w), text16w400white( '${comdetailobj!.data!.totalGroup} groups'), - Spacer(), + const Spacer(), Icon( Icons.arrow_forward, size: 20.sp, @@ -492,12 +486,12 @@ class _CommunityDetailsState extends State { "${comdetailobj!.data!.totalAnnouncements.toString()} New Announcements Request") ], ), - Spacer(), + const Spacer(), Container( height: 21.h, width: 43.w, decoration: BoxDecoration( - color: Color(0xFFD90B2E), + color: const Color(0xFFD90B2E), borderRadius: BorderRadius.circular(30.r)), child: Center( @@ -517,7 +511,7 @@ class _CommunityDetailsState extends State { height: 40.h, width: 200.w, decoration: BoxDecoration( - color: Color(0xFFD90B2E), + color: const Color(0xFFD90B2E), borderRadius: BorderRadius.circular(30.r)), child: Center( child: text14w400white("Leave the community")), @@ -529,7 +523,7 @@ class _CommunityDetailsState extends State { // initialIndex: selectedIndex.value, child: Column( children: [ - CommonTabBar(tabs: const [ + const CommonTabBar(tabs: [ Tab( text: 'Posts', ), @@ -541,7 +535,7 @@ class _CommunityDetailsState extends State { height: 600.h, child: TabBarView( children: [ - PostsTab(), + const PostsTab(), eventstab(), ], ), @@ -565,45 +559,35 @@ class PostsTab extends StatefulWidget { class _PostsTabState extends State { late Future postDetailfuture; List _reactions = []; - Map _selectedReactions = {}; + final Map _selectedReactions = {}; final CountersHelper countersHelper = Get.find(); int? likeIconIdnew; @override void initState() { - // TODO: implement initState CommunityId = Get.arguments["CommunityID"]; postDetailfuture = CommunityDetail().getComPostApi(CommunityId); super.initState(); } - Future _fetchIcons() async { - var response = await Communityallgetmethod().getLikeicons(); - if (response.status == ResponseStatus.SUCCESS) { - var responseData = response.data as Map; - FetchlikeIconsModel fetchlikeIconsModel = - FetchlikeIconsModel.fromJson(responseData); + _fetchIcons() { + _reactions = fetchlikeIconsModel!.data ?? []; + for (var post in commonobjmodel!.data) { + //Check if post as a like icon + if (post.likeIcon?.likeIcon?.id != null) { + likeIconIdnew = post.likeIcon!.likeIconsXid; - _reactions = fetchlikeIconsModel.data ?? []; - for (var post in compostobj!.data) { - //Check if post as a like icon - if (post.likeIcon != null) { - likeIconIdnew = post.likeIcon!.likeIconsXid; + final selectedReaction = _reactions.firstWhere( + (r) => r.id == likeIconIdnew, + orElse: () => _reactions.first, + ); - final selectedReaction = _reactions.firstWhere( - (r) => r.id == likeIconIdnew, - orElse: () => _reactions.first, - ); - - _selectedReactions[post.id!] = - selectedReaction; // Set selected reaction for this post - } else { - _selectedReactions[post.id!] = null; // No reaction selected - print('No reaction selected for post $CommunityId'); - } + _selectedReactions[post.id!] = + selectedReaction; // Set selected reaction for this post + } else { + _selectedReactions[post.id!] = null; // No reaction selected } - setState(() {}); } } @@ -664,17 +648,17 @@ class _PostsTabState extends State { totalImpressionCount: e.totalImpressionCount, totalPopularScore: e.totalPopularScore, totalHoursAgo: e.totalHoursAgo, - // iamPrincipal: IamPrincipal( - // id: e.iamPrincipal!.id, - // isUserPinned: e.iamPrincipal!.isUserPinned, - // principalTypeXid: e.iamPrincipal!.principalTypeXid, - // userName: e.iamPrincipal!.userName, - // fullName: e.iamPrincipal!.fullName, - // profilePhoto: e.iamPrincipal!.profilePhoto), - // community: Community( - // id: e.community!.id, - // communityProfilePhoto: e.community!.communityProfilePhoto, - // communityName: e.community!.communityName), + iamPrincipal: IamPrincipal( + id: e.iamPrincipal!.id, + isUserPinned: e.iamPrincipal!.isUserPinned, + principalTypeXid: e.iamPrincipal!.principalTypeXid, + userName: e.iamPrincipal!.userName, + fullName: e.iamPrincipal!.fullName, + profilePhoto: e.iamPrincipal!.profilePhoto), + community: Community( + id: e.community!.id, + communityProfilePhoto: e.community!.communityProfilePhoto, + communityName: e.community!.communityName), attachTags: e.attachTags .map((e) => AttachTag1( managePostXid: e.managePostXid, @@ -778,7 +762,7 @@ class _PostsTabState extends State { } Widget eventstab() { - return Column( + return const Column( children: [], ); } @@ -830,7 +814,7 @@ Widget normalcardtile({ sizedBoxWidth(7.w), Icon( Icons.circle, - color: Color(0xFFFCFCFC), + color: const Color(0xFFFCFCFC), size: 4.sp, ), sizedBoxWidth(6.w), @@ -839,12 +823,12 @@ Widget normalcardtile({ ) ], ), - Spacer(), + const Spacer(), PopupMenuButton( - surfaceTintColor: Color(0xFF222935), + surfaceTintColor: const Color(0xFF222935), constraints: BoxConstraints.tightFor(width: 176.w), - offset: Offset(0, 50), - color: Color(0xFF222935), + offset: const Offset(0, 50), + color: const Color(0xFF222935), tooltip: "", itemBuilder: (BuildContext context) => [ PopupMenuItem( @@ -862,7 +846,7 @@ Widget normalcardtile({ fontFamily: "Nunito Sans", ), ), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/Vector (5).png", height: 15.h, @@ -872,7 +856,7 @@ Widget normalcardtile({ ), ), ), - PopupMenuDivider(), + const PopupMenuDivider(), PopupMenuItem( onTap: () {}, child: Padding( @@ -888,7 +872,7 @@ Widget normalcardtile({ fontFamily: "Nunito Sans", ), ), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/share.png", height: 20.h, @@ -898,7 +882,7 @@ Widget normalcardtile({ ), ), ), - PopupMenuDivider(), + const PopupMenuDivider(), PopupMenuItem( onTap: () {}, child: Padding( @@ -914,7 +898,7 @@ Widget normalcardtile({ fontFamily: "Nunito Sans", ), ), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/f7_pin-fill (2).png", height: 25.h, @@ -940,7 +924,7 @@ Widget normalcardtile({ onTap: () { Get.toNamed(RouteName.postdetailsScreen); }, - child: Container( + child: SizedBox( height: 163.h, width: double.infinity, child: Image.asset( @@ -979,7 +963,7 @@ Widget normalcardtile({ 'assets/images/png/heart 2.png', 'assets/images/png/party-popper 2.png' ]), - Spacer(), + const Spacer(), commonGlassUI( borderwidth: 0.43, width: 30.w, @@ -1062,11 +1046,11 @@ Widget normalcardtile({ boxRadius: 30, itemsSpacing: 8, itemScale: 0.4, - itemSize: Size(45, 45), - boxPadding: EdgeInsets.all(8), - boxAnimationDuration: Duration(milliseconds: 200), - itemAnimationDuration: Duration(milliseconds: 500), - hoverDuration: Duration(milliseconds: 700), + itemSize: const Size(45, 45), + boxPadding: const EdgeInsets.all(8), + boxAnimationDuration: const Duration(milliseconds: 200), + itemAnimationDuration: const Duration(milliseconds: 500), + hoverDuration: const Duration(milliseconds: 700), // toggle: false, child: _buildReactionsIcon(mainImage.value), @@ -1140,7 +1124,7 @@ Widget containertile({required String text}) { width: 100.w, height: 30.h, borderRadius: BorderRadius.circular(30.r), - borderColor: Color(0xFFD90B2E), + borderColor: const Color(0xFFD90B2E), customWidget: Padding( padding: EdgeInsets.symmetric(horizontal: 10.w), child: Center(child: text14w400_FCFCFC(text)),