conflict resolved

This commit is contained in:
Dakshesh42
2024-08-08 19:16:05 +05:30
21 changed files with 3579 additions and 853 deletions

View File

@@ -82,6 +82,8 @@ PODS:
- flutter_facebook_auth (6.0.4):
- FBSDKLoginKit (~> 16.3.1)
- Flutter
- flutter_keyboard_visibility (0.0.1):
- Flutter
- fluttertoast (0.0.2):
- Flutter
- Toast
@@ -169,6 +171,7 @@ DEPENDENCIES:
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- Flutter (from `Flutter`)
- flutter_facebook_auth (from `.symlinks/plugins/flutter_facebook_auth/ios`)
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`)
- google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`)
@@ -222,6 +225,8 @@ EXTERNAL SOURCES:
:path: Flutter
flutter_facebook_auth:
:path: ".symlinks/plugins/flutter_facebook_auth/ios"
flutter_keyboard_visibility:
:path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
fluttertoast:
:path: ".symlinks/plugins/fluttertoast/ios"
geolocator_apple:
@@ -265,6 +270,7 @@ SPEC CHECKSUMS:
FirebaseCoreInternal: df84dd300b561c27d5571684f389bf60b0a5c934
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_facebook_auth: c8700ab1770f3d8e5e7456220e4f3bbcdb831454
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
fluttertoast: 9f2f8e81bb5ce18facb9748d7855bf5a756fe3db
geolocator_apple: 6cbaf322953988e009e5ecb481f07efece75c450
google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458

View File

@@ -0,0 +1,18 @@
// import 'package:get/get.dart';
// import 'package:flutter/material.dart';
// import 'package:async/async.dart';
// import 'package:regroup/Main_Screens/Community_HomePage/PostDetailScreen/ViewModel/CommentsRepository.dart';
// class ApiRepository extends GetxController {
// Future<List<dynamic>> fetchMultipleAPIs() async {
// FutureGroup futureGroup = FutureGroup();
// // PostDetail
// futureGroup.add(CommentsRepository().getAllComments());
// // Close the group (no more futures can be added)
// futureGroup.close();
// // Wait for all futures to complete
// return await futureGroup.future;
// }
// }

View File

@@ -128,6 +128,14 @@ class ApiUrls {
static const postusertag = "${baseUrl}pin-unpin";
//comments
static const getComments = "${baseUrl}fetch-comment-with-replied-comment";
static const storeComments = "${baseUrl}store-comment";
static const storeRepliesOnComments = "${baseUrl}reply-on-comment";
static const deleteComments = "${baseUrl}delete-comment";
static const deleteRepliesComments = "${baseUrl}delete-reply-on-comment";
static const getLikeicons= "${baseUrl}fetch-like-icons";
static const postLike = "${baseUrl}like-post";
@@ -137,5 +145,7 @@ class ApiUrls {
static const postusersave = "${baseUrl}save-post";
static const getpopularTagsdetails = "${baseUrl}fetch-popular-post";
}

View File

@@ -4,9 +4,7 @@ import 'package:get/get.dart';
import 'package:regroup/Common/controller/MainController.dart';
import 'package:regroup/Main_Screens/ProfileTab/EditProfile/ViewModel/InterestApiList.dart';
final MainController mainController = Get.put(MainController());
class MainScreen extends StatefulWidget {
const MainScreen({super.key});
@@ -15,10 +13,10 @@ class MainScreen extends StatefulWidget {
}
class _MainScreenState extends State<MainScreen> {
@override
void initState() {
InterestListApi().getinterestlistApi();
super.initState();
}

View File

@@ -15,5 +15,7 @@ late Timer timerhomeglobal;
bool isTimerInitialize = false;
String? globalAccountType;
String? mainWelcomeName;
String userIdGlobal = "0";

View File

@@ -45,168 +45,232 @@ class Data {
// pinnedTagsPost: json["pinned_tags_post"] == null ? [] : List<PinnedPost>.from(json["pinned_tags_post"]!.map((x) => PinnedPost.fromJson(x))),
pinnedTagsPost: json["pinned_tags_post"] == null
? []
: List<PinnedPost>.from(json["pinned_tags_post"]!
.expand((x) => x as List)
.map((x) => PinnedPost.fromJson(x))),
:
List<PinnedPost>.from(
json["pinned_tags_post"]!.map((x) => PinnedPost.fromJson(x))),
// List<PinnedPost>.from(json["pinned_tags_post"]!
// .expand((x) => x as List)
// .map((x) => PinnedPost.fromJson(x))),
);
}
}
class PinnedPost {
PinnedPost({
required this.id,
required this.likecount,
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.tagNames,
required this.likeIcon,
required this.iamPrincipal,
required this.community,
});
PinnedPost({
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 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 List<String> tagNames;
final LikeIcon? likeIcon;
final IamPrincipal? iamPrincipal;
final Community? community;
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 LikeIcon? 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<AttachTag> attachTags;
factory PinnedPost.fromJson(Map<String, dynamic> json){
return PinnedPost(
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 : LikeIcon.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<AttachTag>.from(json["attach_tags"]!.map((x) => AttachTag.fromJson(x))),
);
}
}
class AttachTag {
AttachTag({
required this.managePostXid,
required this.manageTagXid,
required this.manageTag,
});
final int? managePostXid;
final int? manageTagXid;
final ManageTag? manageTag;
factory AttachTag.fromJson(Map<String, dynamic> 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,
});
final int? id;
final bool? isPinned;
final String? name;
factory ManageTag.fromJson(Map<String, dynamic> json){
return ManageTag(
id: json["id"],
isPinned: json["is_pinned"],
name: json["name"],
);
}
factory PinnedPost.fromJson(Map<String, dynamic> json) {
return PinnedPost(
id: json["id"],
likecount: json["likecount"],
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"] ?? ""),
tagNames: json["tag_names"] == null
? []
: List<String>.from(json["tag_names"]!.map((x) => x)),
likeIcon:
json["likeIcon"] == null ? null : LikeIcon.fromJson(json["likeIcon"]),
iamPrincipal: json["iam_principal"] == null
? null
: IamPrincipal.fromJson(json["iam_principal"]),
community: json["community"] == null
? null
: Community.fromJson(json["community"]),
);
}
}
class Community {
Community({
required this.id,
required this.communityProfilePhoto,
required this.communityName,
});
Community({
required this.id,
required this.communityProfilePhoto,
required this.communityName,
});
final int? id;
final String? communityProfilePhoto;
final String? 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"],
);
}
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.principalTypeXid,
required this.userName,
required this.fullName,
required this.profilePhoto,
});
IamPrincipal({
required this.id,
required this.isUserPinned,
required this.principalTypeXid,
required this.userName,
required this.fullName,
required this.profilePhoto,
});
final int? id;
final int? principalTypeXid;
final String? userName;
final String? fullName;
final String? 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"],
);
}
factory IamPrincipal.fromJson(Map<String, dynamic> json) {
return IamPrincipal(
id: json["id"],
principalTypeXid: json["principal_type_xid"],
userName: json["user_name"],
fullName: json["full_name"],
profilePhoto: json["profile_photo"],
);
}
}
class LikeIcon {
LikeIcon({
required this.likeIconsXid,
required this.likeIcon,
});
LikeIcon({
required this.likeIconsXid,
required this.likeIcon,
});
final int? likeIconsXid;
final LikeIconClass? likeIcon;
final int? likeIconsXid;
final LikeIconClass? likeIcon;
factory LikeIcon.fromJson(Map<String, dynamic> json){
return LikeIcon(
likeIconsXid: json["like_icons_xid"],
likeIcon: json["like_icon"] == null ? null : LikeIconClass.fromJson(json["like_icon"]),
);
}
factory LikeIcon.fromJson(Map<String, dynamic> json) {
return LikeIcon(
likeIconsXid: json["like_icons_xid"],
likeIcon: json["like_icon"] == null
? null
: LikeIconClass.fromJson(json["like_icon"]),
);
}
}
class LikeIconClass {
LikeIconClass({
required this.id,
required this.image,
});
LikeIconClass({
required this.id,
required this.image,
});
final int? id;
final String? image;
final int? id;
final String? image;
factory LikeIconClass.fromJson(Map<String, dynamic> json){
return LikeIconClass(
id: json["id"],
image: json["image"],
);
}
factory LikeIconClass.fromJson(Map<String, dynamic> json) {
return LikeIconClass(
id: json["id"],
image: json["image"],
);
}
}

View File

@@ -313,7 +313,7 @@ class _FeedTabState extends State<FeedTab> {
'',
mainImg: combinedList[index].image ?? '',
containerTitle:
combinedList[index].tagNames ?? [''],
[''],
create_at: timeAgo,
community_name: combinedList[index]
.community!

View File

@@ -0,0 +1,239 @@
class TagPopulardetailsModel {
TagPopulardetailsModel({
required this.status,
required this.statusCode,
required this.message,
required this.data,
});
final String? status;
final int? statusCode;
final String? message;
final List<Datum> data;
factory TagPopulardetailsModel.fromJson(Map<String, dynamic> json){
return TagPopulardetailsModel(
status: json["status"],
statusCode: json["status_code"],
message: json["message"],
data: json["data"] == null ? [] : List<Datum>.from(json["data"]!.map((x) => Datum.fromJson(x))),
);
}
}
class Datum {
Datum({
required this.id,
required this.likecount,
required this.isISaved,
required this.isILiked,
required this.totalComment,
required this.totalSave,
required this.iamPrincipalXid,
required this.postIn,
required this.caption,
required this.image,
required this.postAs,
required this.ctaTitle,
required this.ctaLink,
required this.createdAt,
required this.totalViewCount,
required this.totalReactionCount,
required this.totalCommentCount,
required this.totalImpressionCount,
required this.likeIcon,
required this.tagsXid,
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 bool? isILiked;
final int? totalComment;
final int? totalSave;
final int? iamPrincipalXid;
final int? postIn;
final String? caption;
final String? image;
final String? postAs;
final String? ctaTitle;
final String? ctaLink;
final DateTime? createdAt;
final int? totalViewCount;
final int? totalReactionCount;
final int? totalCommentCount;
final int? totalImpressionCount;
final LikeIcon? likeIcon;
final List<int> tagsXid;
final int? totalPopularScore;
final int? totalHoursAgo;
final IamPrincipal? iamPrincipal;
final Community? community;
final List<AttachTag> attachTags;
factory Datum.fromJson(Map<String, dynamic> json){
return Datum(
id: json["id"],
likecount: json["likecount"],
isISaved: json["is_i_saved"],
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"],
postAs: json["post_as"],
ctaTitle: json["cta_title"],
ctaLink: json["cta_link"],
createdAt: DateTime.tryParse(json["created_at"] ?? ""),
totalViewCount: json["totalViewCount"],
totalReactionCount: json["totalReactionCount"],
totalCommentCount: json["totalCommentCount"],
totalImpressionCount: json["totalImpressionCount"],
likeIcon: json["likeIcon"] == null ? null : LikeIcon.fromJson(json["likeIcon"]),
tagsXid: json["tags_xid"] == null ? [] : List<int>.from(json["tags_xid"]!.map((x) => x)),
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<AttachTag>.from(json["attach_tags"]!.map((x) => AttachTag.fromJson(x))),
);
}
}
class AttachTag {
AttachTag({
required this.managePostXid,
required this.manageTagXid,
required this.manageTag,
});
final int? managePostXid;
final int? manageTagXid;
final ManageTag? manageTag;
factory AttachTag.fromJson(Map<String, dynamic> 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 LikeIcon {
LikeIcon({
required this.likeIconsXid,
required this.likeIcon,
});
final int? likeIconsXid;
final LikeIconClass? likeIcon;
factory LikeIcon.fromJson(Map<String, dynamic> json){
return LikeIcon(
likeIconsXid: json["like_icons_xid"],
likeIcon: json["like_icon"] == null ? null : LikeIconClass.fromJson(json["like_icon"]),
);
}
}
class LikeIconClass {
LikeIconClass({
required this.id,
required this.image,
});
final int? id;
final String? image;
factory LikeIconClass.fromJson(Map<String, dynamic> json){
return LikeIconClass(
id: json["id"],
image: json["image"],
);
}
}
class ManageTag {
ManageTag({
required this.id,
required this.isPinned,
required this.name,
});
final int? id;
final bool? isPinned;
final String? name;
factory ManageTag.fromJson(Map<String, dynamic> json){
return ManageTag(
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"],
);
}
}

View File

@@ -0,0 +1,101 @@
class NestedCommentsModel {
NestedCommentsModel({
required this.status,
required this.statusCode,
required this.message,
required this.data,
});
final String? status;
final int? statusCode;
final String? message;
final List<Datum> data;
factory NestedCommentsModel.fromJson(Map<String, dynamic> json){
return NestedCommentsModel(
status: json["status"],
statusCode: json["status_code"],
message: json["message"],
data: json["data"] == null ? [] : List<Datum>.from(json["data"]!.map((x) => Datum.fromJson(x))),
);
}
}
class Datum {
Datum({
required this.id,
required this.managePostsXid,
required this.iamPrincipalXid,
required this.comment,
required this.userDetail,
required this.repliedComment,
});
final int? id;
final int? managePostsXid;
final int? iamPrincipalXid;
final String? comment;
final UserDetail? userDetail;
final List<RepliedComment> repliedComment;
factory Datum.fromJson(Map<String, dynamic> json){
return Datum(
id: json["id"],
managePostsXid: json["manage_posts_xid"],
iamPrincipalXid: json["iam_principal_xid"],
comment: json["comment"],
userDetail: json["user_detail"] == null ? null : UserDetail.fromJson(json["user_detail"]),
repliedComment: json["replied_comment"] == null ? [] : List<RepliedComment>.from(json["replied_comment"]!.map((x) => RepliedComment.fromJson(x))),
);
}
}
class RepliedComment {
RepliedComment({
required this.id,
required this.postsMasterCommentXid,
required this.iamPrincipalXid,
required this.comment,
required this.userDetail,
});
final int? id;
final int? postsMasterCommentXid;
final int? iamPrincipalXid;
final String? comment;
final UserDetail? userDetail;
factory RepliedComment.fromJson(Map<String, dynamic> json){
return RepliedComment(
id: json["id"],
postsMasterCommentXid: json["posts_master_comment_xid"],
iamPrincipalXid: json["iam_principal_xid"],
comment: json["comment"],
userDetail: json["user_detail"] == null ? null : UserDetail.fromJson(json["user_detail"]),
);
}
}
class UserDetail {
UserDetail({
required this.id,
required this.userName,
required this.profilePhoto,
});
final int? id;
final String? userName;
final String? profilePhoto;
factory UserDetail.fromJson(Map<String, dynamic> json){
return UserDetail(
id: json["id"],
userName: json["user_name"],
profilePhoto: json["profile_photo"],
);
}
}

View File

@@ -1,16 +1,25 @@
import 'package:comment_tree/comment_tree.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.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/CommonGlassmorphism.dart';
import 'package:regroup/Common/CommonWidget.dart';
import 'package:regroup/Common/base_manager.dart';
import 'package:regroup/Global.dart';
import 'package:regroup/Main_Screens/Community_HomePage/PostDetailScreen/ViewModel/CommentsHelper.dart';
import 'package:regroup/Main_Screens/Community_HomePage/PostDetailScreen/ViewModel/CommentsRepository.dart';
import 'package:regroup/Utils/Common/CommonAppbar.dart';
import 'package:regroup/Utils/Common/CustomTextformfield.dart';
import 'package:regroup/Utils/Common/sized_box.dart';
import 'package:regroup/Utils/texts.dart';
import 'package:regroup/resources/routes/route_name.dart';
import 'package:async/async.dart';
class PostDetailsScreen extends StatefulWidget {
const PostDetailsScreen({super.key});
@@ -20,301 +29,632 @@ class PostDetailsScreen extends StatefulWidget {
}
class _PostDetailsScreenState extends State<PostDetailsScreen> {
List<bool> _hideReplies = List.filled(5, true);
List<bool> hideReplies = [];
FutureGroup futureGroup = FutureGroup();
final FocusNode _focusNode = FocusNode();
final TextEditingController _controllerComments = TextEditingController();
final CommentsHelper _commentsHelper = Get.put(CommentsHelper());
@override
void initState() {
futureGroup.add(CommentsRepository().getAllComments());
futureGroup.close();
super.initState();
}
bool isOnce = true;
_setViewMoreList() {
if (isOnce) {
hideReplies = List.filled(nestedComments!.data.length, false);
isOnce = false;
}
}
_toggleReplies(index) {
setState(() {
hideReplies[index] = !hideReplies[index];
});
}
void _focusTextField() {
FocusScope.of(context).requestFocus(_focusNode);
}
_postComments() async {
var updata = {
"manage_posts_xid": "1",
"comment": _controllerComments.text,
};
final result = await CommentsRepository().postComments(updata);
if (result.status == ResponseStatus.SUCCESS) {
CommentsRepository().getAllComments().then((value) => setState(() {
isOnce = true;
_commentsHelper.isLoading.value = false;
_controllerComments.clear();
}));
}
}
String repliedCommentId = "";
_postRepliesOnComment(repliedCommentId) async {
var updata = {
"manage_posts_xid": "1",
"posts_master_comment_xid": repliedCommentId,
"comment": _controllerComments.text,
};
final result = await CommentsRepository().postRepliesOnComments(updata);
if (result.status == ResponseStatus.SUCCESS) {
CommentsRepository().getAllComments().then((value) => setState(() {
isOnce = true;
_commentsHelper.isLoading.value = false;
_controllerComments.clear();
}));
}
}
// _setComments(index) {
// List<Comment> repliedCommentsList = [];
// for (var i = 0;
// i < nestedComments!.data[index].repliedComment.length;
// i++) {
// repliedCommentsList.add(Comment(
// avatar: nestedComments!
// .data[index].repliedComment[i].userDetail?.profilePhoto,
// userName: nestedComments!
// .data[index].repliedComment[i].userDetail?.userName,
// content: nestedComments!.data[index].repliedComment[i].comment));
// }
// return repliedCommentsList;
// }
// bool _hideReplies = true;
_deleteComment(String commentId) async {
var updata = {"id": commentId};
final result = await CommentsRepository().deleteComments(updata);
if (result.status == ResponseStatus.SUCCESS) {
CommentsRepository().getAllComments().then((value) => setState(() {
isOnce = true;
}));
}
}
_deleteRepliedComment(String commentId) async {
var updata = {"id": commentId};
final result = await CommentsRepository().deleteRepliedComments(updata);
if (result.status == ResponseStatus.SUCCESS) {
CommentsRepository().getAllComments().then((value) => setState(() {
isOnce = true;
}));
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFF222935),
extendBody: true,
appBar: const CommonAppbar(
titleTxt: "Post",
),
body: Stack(children: [
Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/png/Ellipse 1496.png"),
fit: BoxFit.fill)),
return KeyboardVisibilityBuilder(builder: (context, isKeyboardVisible) {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFF222935),
extendBody: true,
appBar: const CommonAppbar(
titleTxt: "Post",
),
SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
postCards(
profileImg: 'assets/images/png/Ellipse 52.png',
title: 'Ryan Dorwat',
mainImg: 'assets/images/png/Rectangle 25.png',
containerTitle: [
'Football',
'Marathon',
'Events',
'Marathon',
'Events'
]),
sizedBoxHeight(35.h),
ListView.builder(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: 2,
itemBuilder: (context, index) {
return Container(
padding: const EdgeInsets.symmetric(
vertical: 12, horizontal: 16),
child: CommentTreeWidget<Comment, Comment>(
Comment(
avatar: 'assets/images/png/Ellipse 52.png',
userName: 'Krishna',
content:
'felangel made felangel/cubit_and_beyond public'),
[
Comment(
avatar: 'assets/images/png/Ellipse 52.png',
userName: 'Kishan',
content: 'Sample comment from kishan'),
Comment(
avatar: 'assets/images/png/Ellipse 52.png',
userName: 'Ram',
content:
'A Dart template generator which helps teams generator which helps teams generator which helps teams'),
// Comment(
// avatar: 'null',
// userName: 'null',
// content:
// 'A Dart template generator which helps teams'),
// Comment(
// avatar: 'null',
// userName: 'null',
// content:
// 'A Dart template generator which helps teams generator which helps teams '),
],
treeThemeData: const TreeThemeData(
lineColor: Color(0xFFD90B2E), lineWidth: 2.5),
avatarRoot: (context, data) => const PreferredSize(
preferredSize: Size.fromRadius(18),
child: CircleAvatar(
radius: 18,
backgroundColor: Colors.grey,
backgroundImage: AssetImage(
'assets/images/png/Ellipse 52.png',
),
),
),
avatarChild: (context, data) => const PreferredSize(
preferredSize: Size.fromRadius(12),
child: CircleAvatar(
radius: 12,
backgroundColor: Colors.grey,
backgroundImage: AssetImage(
'assets/images/png/Ellipse 52.png',
),
),
),
contentChild: (context, data) {
print("printing");
return data.userName! == "Ram" && _hideReplies[index]
? GestureDetector(
onTap: () {
setState(() {
_hideReplies[index] = false;
});
},
child: Container(
child: const Text(
"View more",
style: TextStyle(color: Colors.white),
),
body: FutureBuilder(
future: futureGroup.future,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(
child: CircularProgressIndicator(
color: Colors.blue,
),
);
} else if (snapshot.hasError) {
return Center(
child: Text(
'${snapshot.error} occurred',
style: TextStyle(fontSize: 18.spMin),
),
);
} else if (snapshot.connectionState == ConnectionState.done) {
_setViewMoreList();
return _buildBody(isKeyboardVisible);
} else {
return const Center(child: Text('Something went wrong'));
}
},
));
});
}
_buildBody(isKeyboardVisible) {
return Stack(children: [
Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/png/Ellipse 1496.png"),
fit: BoxFit.fill)),
),
SingleChildScrollView(
child:
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
postCards(
profileImg: 'assets/images/png/Ellipse 52.png',
title: 'Ryan Dorwat',
mainImg: 'assets/images/png/Rectangle 25.png',
containerTitle: [
'Football',
'Marathon',
'Events',
'Marathon',
'Events'
]),
sizedBoxHeight(35.h),
// ListView.builder(
// physics: const NeverScrollableScrollPhysics(),
// shrinkWrap: true,
// itemCount: nestedComments!.data.length,
// itemBuilder: (context, index) {
// List<Comment> _repliedCommentsSorted = _setComments(index);
// return Container(
// padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
// child: CommentTreeWidget<Comment, Comment>(
// Comment(
// avatar:
// nestedComments!.data[index].userDetail!.profilePhoto,
// userName: nestedComments!.data[index].userDetail!.userName,
// content: nestedComments!.data[index].comment),
// [],
// // _repliedCommentsSorted.isNotEmpty ? _repliedCommentsSorted : [],
// treeThemeData: const TreeThemeData(
// lineColor: Color(0xFFD90B2E), lineWidth: 2.5),
// avatarRoot: (context, data) => PreferredSize(
// preferredSize: const Size.fromRadius(18),
// child: CircleAvatar(
// radius: 18,
// backgroundColor: Colors.grey,
// backgroundImage: NetworkImage(
// data.avatar ??
// "https://upload.wikimedia.org/wikipedia/commons/7/7c/Profile_avatar_placeholder_large.png?20150327203541",
// ),
// ),
// ),
// avatarChild: (context, data) => PreferredSize(
// preferredSize: const Size.fromRadius(12),
// child: CircleAvatar(
// radius: 12,
// backgroundColor: Colors.grey,
// backgroundImage: NetworkImage(
// data.avatar ??
// "https://upload.wikimedia.org/wikipedia/commons/7/7c/Profile_avatar_placeholder_large.png?20150327203541",
// ),
// ),
// ),
// contentChild: (context, data) {
// return data.userName! == "Ram" && _hideReplies[index]
// ? GestureDetector(
// onTap: () {
// setState(() {
// _hideReplies[index] = false;
// });
// },
// child: Container(
// child: const Text(
// "View more",
// style: TextStyle(color: Colors.white),
// ),
// ),
// )
// : Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Container(
// padding: const EdgeInsets.symmetric(
// vertical: 8, horizontal: 8),
// decoration: BoxDecoration(
// color: Colors.grey[100],
// borderRadius: BorderRadius.circular(12)),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// '${data.userName}',
// style: Theme.of(context)
// .textTheme
// .bodySmall
// ?.copyWith(
// fontWeight: FontWeight.w600,
// color: Colors.black),
// ),
// const SizedBox(
// height: 4,
// ),
// Text(
// '${data.content}',
// style: Theme.of(context)
// .textTheme
// .bodySmall
// ?.copyWith(
// fontWeight: FontWeight.w300,
// color: Colors.black),
// ),
// ],
// ),
// ),
// DefaultTextStyle(
// style: Theme.of(context)
// .textTheme
// .bodySmall!
// .copyWith(
// color: Colors.grey[700],
// fontWeight: FontWeight.bold),
// child: const Padding(
// padding: EdgeInsets.only(top: 4),
// child: Row(
// children: [
// SizedBox(
// width: 8,
// ),
// Text('Like'),
// SizedBox(
// width: 24,
// ),
// Text('Reply'),
// ],
// ),
// ),
// )
// ],
// );
// },
// contentRoot: (context, data) {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Container(
// padding: const EdgeInsets.symmetric(
// vertical: 8, horizontal: 8),
// decoration: BoxDecoration(
// color: Colors.grey[100],
// borderRadius: BorderRadius.circular(12)),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// 'dangngocduc',
// style: Theme.of(context)
// .textTheme
// .bodySmall!
// .copyWith(
// fontWeight: FontWeight.w600,
// color: Colors.black),
// ),
// const SizedBox(
// height: 4,
// ),
// Text(
// '${data.content}',
// style: Theme.of(context)
// .textTheme
// .bodySmall!
// .copyWith(
// fontWeight: FontWeight.w300,
// color: Colors.black),
// ),
// ],
// ),
// ),
// DefaultTextStyle(
// style: Theme.of(context).textTheme.bodySmall!.copyWith(
// color: Colors.grey[700],
// fontWeight: FontWeight.bold),
// child: const Padding(
// padding: EdgeInsets.only(top: 4),
// child: Row(
// children: [
// SizedBox(
// width: 8,
// ),
// Text('Like'),
// SizedBox(
// width: 24,
// ),
// Text('Reply'),
// ],
// ),
// ),
// )
// ],
// );
// },
// ),
// );
// },
// ),
ListView.builder(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: nestedComments?.data.length,
itemBuilder: (context, index) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Column(
children: [
GestureDetector(
onLongPressStart: (details) {
nestedComments?.data[index].userDetail!.id
.toString() !=
userIdGlobal
? null
: showMenu(
context: context,
position: RelativeRect.fromLTRB(
details.globalPosition.dx,
details.globalPosition.dy,
details.globalPosition.dx + 1,
details.globalPosition.dy + 1,
),
)
: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.symmetric(
vertical: 8, horizontal: 8),
decoration: BoxDecoration(
color: Colors.grey[100],
borderRadius:
BorderRadius.circular(12)),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'${data.userName}',
style: Theme.of(context)
.textTheme
.bodySmall
?.copyWith(
fontWeight: FontWeight.w600,
color: Colors.black),
),
const SizedBox(
height: 4,
),
Text(
'${data.content}',
style: Theme.of(context)
.textTheme
.bodySmall
?.copyWith(
fontWeight: FontWeight.w300,
color: Colors.black),
),
],
),
items: [
const PopupMenuItem<int>(
value: 0,
child: Text("Delete"),
),
DefaultTextStyle(
style: Theme.of(context)
.textTheme
.bodySmall!
.copyWith(
color: Colors.grey[700],
fontWeight: FontWeight.bold),
child: const Padding(
padding: EdgeInsets.only(top: 4),
child: Row(
children: [
SizedBox(
width: 8,
),
Text('Like'),
SizedBox(
width: 24,
),
Text('Reply'),
],
),
),
)
],
);
elevation: 8.0,
).then((value) {
if (value == 0) {
_deleteComment(nestedComments!
.data[index].id
.toString());
}
});
},
contentRoot: (context, data) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.symmetric(
vertical: 8, horizontal: 8),
decoration: BoxDecoration(
color: Colors.grey[100],
borderRadius: BorderRadius.circular(12)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'dangngocduc',
style: Theme.of(context)
.textTheme
.bodySmall!
.copyWith(
fontWeight: FontWeight.w600,
color: Colors.black),
),
const SizedBox(
height: 4,
),
Text(
'${data.content}',
style: Theme.of(context)
.textTheme
.bodySmall!
.copyWith(
fontWeight: FontWeight.w300,
color: Colors.black),
),
],
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CircleAvatar(
radius: 20.r,
foregroundImage: NetworkImage(
nestedComments!
.data[index].userDetail!.profilePhoto ??
"https://upload.wikimedia.org/wikipedia/commons/7/7c/Profile_avatar_placeholder_large.png?20150327203541",
),
DefaultTextStyle(
style: Theme.of(context)
.textTheme
.bodySmall!
.copyWith(
color: Colors.grey[700],
fontWeight: FontWeight.bold),
child: const Padding(
padding: EdgeInsets.only(top: 4),
child: Row(
children: [
SizedBox(
width: 8,
),
Text('Like'),
SizedBox(
width: 24,
),
Text('Reply'),
],
),
sizedBoxWidth(15.w),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text12w400_FCFCFC_blur(nestedComments!
.data[index].userDetail!.userName ??
""),
text14w400_FCFCFC(
nestedComments!.data[index].comment ??
""),
SizedBox(height: 10.h),
GestureDetector(
onTap: () {
_focusTextField();
_controllerComments.text =
"@${nestedComments!.data[index].userDetail!.userName!}";
setState(() {
repliedCommentId = nestedComments!
.data[index].id
.toString();
});
},
child: text10w400_FCFCFC_blur("Reply")),
SizedBox(height: 20.h),
nestedComments!
.data[index].repliedComment.isEmpty
? const SizedBox()
: hideReplies[index]
? GestureDetector(
onTap: () {
_toggleReplies(index);
},
child: text10w400_FCFCFC_blur(
"Hide replies"),
)
: GestureDetector(
onTap: () {
_toggleReplies(index);
},
child: text10w400_FCFCFC_blur(
"View ${nestedComments!.data[index].repliedComment.length} more replies"),
),
SizedBox(height: 10.h),
!hideReplies[index]
? const SizedBox()
: ListView.builder(
physics:
const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: nestedComments!.data[index]
.repliedComment.length,
itemBuilder: (context, index2) {
return GestureDetector(
onLongPressStart:
(LongPressStartDetails
details) {
nestedComments
?.data[index]
.repliedComment[
index2]
.userDetail
?.id
.toString() !=
userIdGlobal
? null
: showMenu(
context: context,
position: RelativeRect
.fromLTRB(
details.globalPosition
.dx,
details.globalPosition
.dy,
details.globalPosition
.dx +
1,
details.globalPosition
.dy +
1,
),
items: [
const PopupMenuItem<
int>(
value: 0,
child:
Text("Delete"),
),
],
elevation: 8.0,
).then((value) {
if (value == 0) {
_deleteRepliedComment(
nestedComments!
.data[index]
.repliedComment[
index2]
.id
.toString());
}
});
},
child: ListTile(
leading: Column(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
CircleAvatar(
radius: 13.r,
foregroundImage:
NetworkImage(
nestedComments!
.data[index]
.repliedComment[
index2]
.userDetail
?.profilePhoto ??
"https://upload.wikimedia.org/wikipedia/commons/7/7c/Profile_avatar_placeholder_large.png?20150327203541",
),
),
],
),
title: text12w400_FCFCFC_blur(
nestedComments!
.data[index]
.repliedComment[
index2]
.userDetail
?.userName ??
""),
subtitle: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
text14w400_FCFCFC(
nestedComments!
.data[index]
.repliedComment[
index2]
.comment ??
""),
SizedBox(height: 10.h),
GestureDetector(
onTap: () {
_focusTextField();
_controllerComments
.text =
"@${nestedComments!.data[index].repliedComment[index2].userDetail!.userName!}";
setState(() {
repliedCommentId =
nestedComments!
.data[index]
.repliedComment[
index2]
.postsMasterCommentXid
.toString();
});
},
child:
text10w400_FCFCFC_blur(
"Reply")),
],
),
),
);
})
],
),
),
],
),
),
sizedBoxHeight(20.h),
//sizedBoxHeight(85.h)
],
));
}),
sizedBoxHeight(25.h),
])),
Positioned.fill(
top: 625.h - MediaQuery.of(context).viewInsets.bottom,
// isKeyboardVisible ? 270.h : 625.h,
right: 16.0,
left: 16.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.only(top: 15, bottom: 15),
child: Row(
children: <Widget>[
Obx(() {
return Expanded(
child: CustomTextFormField(
textEditingController: _controllerComments,
focusNode: _focusNode,
hintText: "Add comment",
suffixIcon: GestureDetector(
onTap: () {
if (_controllerComments.text.isEmpty) {
print("Enter some text");
} else {
_commentsHelper.isLoading.value = true;
if (repliedCommentId != "") {
_postRepliesOnComment(repliedCommentId);
} else {
_postComments();
}
}
},
child: _commentsHelper.isLoading.value
? Container(
padding: const EdgeInsets.all(10),
height: 10.h,
width: 10.w,
child: const CircularProgressIndicator())
: SizedBox(
height: 20.h,
width: 25.w,
child: Center(
child: Image.asset(
"assets/images/png/iconoir_send.png",
height: 20.h,
width: 25.w,
),
),
),
)
],
);
},
),
),
);
},
),
// Padding(
// padding: EdgeInsets.symmetric(horizontal: 16.w),
// child: Column(children: [
// Row(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// CircleAvatar(
// radius: 20.r,
// foregroundImage: const AssetImage(
// "assets/images/png/Ellipse 48.png",
// ),
// ),
// sizedBoxWidth(15.w),
// Expanded(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// text12w400_FCFCFC_blur("Roger Saris"),
// text14w400_FCFCFC(
// "Lorem Ipsum has been the industry's standard dummy text 😍"),
// text10w400_FCFCFC_blur("Reply. . . ")
// ],
// ),
// ),
// ],
// ),
// sizedBoxHeight(50.h),
// Align(
// alignment: Alignment.bottomCenter,
// child: Padding(
// padding: const EdgeInsets.only(top: 15, bottom: 15),
// child: Row(
// children: <Widget>[
// Expanded(
// child: CustomTextFormField(
// hintText: "Add comment",
// suffixIcon: SizedBox(
// height: 20.h,
// width: 25.w,
// child: Center(
// child: Image.asset(
// "assets/images/png/iconoir_send.png",
// height: 20.h,
// width: 25.w,
// ),
// ),
// ),
// ),
// )
// ],
// ),
// )),
// sizedBoxHeight(85.h)
// ]))
]))
]));
})
],
),
)),
),
]);
}
Widget postCards({
@@ -336,7 +676,7 @@ class _PostDetailsScreenState extends State<PostDetailsScreen> {
return commonGlassUI(
width: double.infinity,
height: 570.h,
height: 800.h,
borderwidth: 0,
borderRadius: BorderRadius.circular(0),
customWidget: Column(
@@ -467,7 +807,7 @@ class _PostDetailsScreenState extends State<PostDetailsScreen> {
),
],
),
sizedBoxHeight(5.h),
sizedBoxHeight(15.h),
Row(
children: [
Image.asset(
@@ -499,7 +839,7 @@ class _PostDetailsScreenState extends State<PostDetailsScreen> {
// Get.toNamed(RouteName.postdetailsScreen);
},
child: SizedBox(
height: 163.h,
height: 390.h,
width: double.infinity,
child: Image.asset(
mainImg,
@@ -691,7 +1031,4 @@ class _PostDetailsScreenState extends State<PostDetailsScreen> {
],
);
}
}

View File

@@ -0,0 +1,5 @@
import 'package:get/get.dart';
class CommentsHelper extends GetxController {
RxBool isLoading = false.obs;
}

View File

@@ -0,0 +1,51 @@
import 'package:regroup/Common/api_urls.dart';
import 'package:regroup/Common/base_manager.dart';
import 'package:regroup/Common/controller/data/network/network_api.dart';
import 'package:regroup/Main_Screens/Community_HomePage/PostDetailScreen/Model/LikePostModel.dart';
import 'package:regroup/Main_Screens/Community_HomePage/PostDetailScreen/Model/NestedCommentsModel.dart';
NestedCommentsModel? nestedComments;
class CommentsRepository {
Future<ResponseData<dynamic>> getAllComments() async {
final response = await NetworkApiServices().getApi(
"${ApiUrls.getComments}?manage_posts_xid=1",
);
if (response.status == ResponseStatus.SUCCESS) {
nestedComments = NestedCommentsModel.fromJson(response.data);
}
return response;
}
Future<ResponseData<dynamic>> postComments(updata) async {
final response = await NetworkApiServices().postApi(
updata,
ApiUrls.storeComments,
);
return response;
}
Future<ResponseData<dynamic>> postRepliesOnComments(updata) async {
final response = await NetworkApiServices().postApi(
updata,
ApiUrls.storeRepliesOnComments,
);
return response;
}
Future<ResponseData<dynamic>> deleteComments(updata) async {
final response = await NetworkApiServices().postApi(
updata,
ApiUrls.deleteComments,
);
return response;
}
Future<ResponseData<dynamic>> deleteRepliedComments(updata) async {
final response = await NetworkApiServices().postApi(
updata,
ApiUrls.deleteRepliesComments,
);
return response;
}
}

View File

@@ -95,23 +95,40 @@ class _PostScreenState extends State<PostScreen> {
List<int> selectedabilityid = [];
int? communityid;
void getCatIdFromName(List<String> selectedAbilities) {
selectedabilityid.clear(); // Clear existing selections
for (var name in selectedAbilities) {
for (var i = 0; i < postcommunity.length; i++) {
if (name == postcommunity[i].community!.communityName) {
selectedabilityid.add(postcommunity[i].community!.id!);
communityid = postcommunity[i].community!.id!;
// fetchPopularlist(postcommunity[i].id!);
fetchPopularTags(communityid!);
_isSecondDropdownEnabled = true;
// void getCatIdFromName(List<String> selectedAbilities) {
// selectedabilityid.clear(); // Clear existing selections
// for (var name in selectedAbilities) {
// for (var i = 0; i < postcommunity.length; i++) {
// if (name == postcommunity[i].community!.communityName) {
// selectedabilityid.add(postcommunity[i].community!.id!);
// communityid = postcommunity[i].community!.id!;
// // fetchPopularlist(postcommunity[i].id!);
// fetchPopularTags(communityid!);
// _isSecondDropdownEnabled = true;
break; // Assuming each name is unique, we break after finding a match
}
// break; // Assuming each name is unique, we break after finding a match
// }
// }
// }
// print('Selected IDs: $selectedabilityid');
// }
void getCatIdFromName(List<String> selectedAbilities) {
selectedabilityid.clear(); // Clear existing selections
for (var name in selectedAbilities) {
for (var i = 0; i < postcommunity.length; i++) {
if (name == postcommunity[i].community!.communityName) {
selectedabilityid.add(postcommunity[i].community!.id!);
communityid = postcommunity[i].community!.id!;
// Fetch tags for the selected community
fetchPopularTags(communityid!);
_isSecondDropdownEnabled = true;
break; // Assuming each name is unique, we break after finding a match
}
}
print('Selected IDs: $selectedabilityid');
}
print('Selected IDs: $selectedabilityid');
}
List<Data> tags = []; // Change the type to List<Data>
@@ -1063,9 +1080,17 @@ class _CustomDropDownPopularTagState extends State<CustomDropDownPopularTag> {
void initState() {
super.initState();
filteredTags.value = widget.tags;
textEditingController.addListener(() {
filterTags();
});
textEditingController.addListener(filterTags);
}
@override
void didUpdateWidget(CustomDropDownPopularTag oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.tags != oldWidget.tags) {
// Clear the selected tags and update the filtered tags when tags change
selectedTags.clear();
filteredTags.value = widget.tags;
}
}
void _handleDropdownTap() {
@@ -1131,10 +1156,6 @@ class _CustomDropDownPopularTagState extends State<CustomDropDownPopularTag> {
),
suffixIcon: GestureDetector(
onTap: _handleDropdownTap,
// () {
// onDropTap.value = !onDropTap.value;
// },
child: SizedBox(
height: 20,
width: 20,
@@ -1150,11 +1171,7 @@ class _CustomDropDownPopularTagState extends State<CustomDropDownPopularTag> {
),
border: InputBorder.none,
),
onTap: _handleDropdownTap
// () {
// onDropTap.value = !onDropTap.value;
// },
),
onTap: _handleDropdownTap),
),
),
@@ -1225,9 +1242,6 @@ class _CustomDropDownPopularTagState extends State<CustomDropDownPopularTag> {
label: Text('#${tag.name!}',
style: const TextStyle(color: Colors.white)),
backgroundColor: const Color(0xFFD90B2E).withOpacity(0.9),
// Color(0xFFD90B2E).withOpacity(0.90),
// Colors.transparent, // Make Chip background transparent
side: BorderSide(color: Colors.black),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30.r),
@@ -1248,6 +1262,218 @@ class _CustomDropDownPopularTagState extends State<CustomDropDownPopularTag> {
}
}
// class CustomDropDownPopularTag extends StatefulWidget {
// final List<Data> tags;
// final Function(List<Data>) onItemSelected;
// final bool isFirstDropdownSelected;
// CustomDropDownPopularTag({
// required this.tags,
// required this.onItemSelected,
// required this.isFirstDropdownSelected,
// });
// @override
// _CustomDropDownPopularTagState createState() =>
// _CustomDropDownPopularTagState();
// }
// class _CustomDropDownPopularTagState extends State<CustomDropDownPopularTag> {
// RxBool onDropTap = false.obs;
// RxList<Data> selectedTags = <Data>[].obs;
// RxList<Data> filteredTags = <Data>[].obs;
// TextEditingController textEditingController = TextEditingController();
// @override
// void initState() {
// super.initState();
// filteredTags.value = widget.tags;
// textEditingController.addListener(() {
// filterTags();
// });
// }
// void _handleDropdownTap() {
// if (widget.isFirstDropdownSelected) {
// onDropTap.value = !onDropTap.value;
// } else {
// utils.showToast('Please select an item from the first dropdown.');
// }
// }
// void filterTags() {
// String query = textEditingController.text.toLowerCase();
// if (query.isNotEmpty) {
// filteredTags.value = widget.tags
// .where((tag) =>
// tag.name!.toLowerCase().contains(query) &&
// !selectedTags.contains(tag))
// .toList();
// } else {
// filteredTags.value =
// widget.tags.where((tag) => !selectedTags.contains(tag)).toList();
// }
// onDropTap.value = filteredTags.isNotEmpty;
// }
// @override
// Widget build(BuildContext context) {
// return Obx(
// () => Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// // Dropdown Search Input
// Container(
// width: double.infinity,
// height: 50,
// padding: const EdgeInsets.symmetric(horizontal: 12),
// decoration: BoxDecoration(
// color: const Color(0xFFFFFFFF).withOpacity(0.10),
// borderRadius: onDropTap.value && filteredTags.isNotEmpty
// ? const BorderRadius.vertical(
// top: Radius.circular(30),
// )
// : BorderRadius.circular(30),
// border: Border.all(color: const Color(0xFF434A53)),
// ),
// child: Center(
// child: TextFormField(
// controller: textEditingController,
// style: const TextStyle(
// fontSize: 16,
// color: Colors.white,
// fontFamily: 'Helvetica',
// ),
// cursorColor: Colors.red,
// obscureText: false,
// decoration: InputDecoration(
// hintText: 'Search Tags',
// hintStyle: const TextStyle(
// fontSize: 16,
// color: Colors.white,
// fontWeight: FontWeight.w400,
// fontFamily: 'Helvetica',
// ),
// suffixIcon: GestureDetector(
// onTap: _handleDropdownTap,
// // () {
// // onDropTap.value = !onDropTap.value;
// // },
// child: SizedBox(
// height: 20,
// width: 20,
// child: Center(
// child: Icon(
// onDropTap.value
// ? Icons.arrow_drop_up
// : Icons.arrow_drop_down,
// color: Colors.white,
// ),
// ),
// ),
// ),
// border: InputBorder.none,
// ),
// onTap: _handleDropdownTap
// // () {
// // onDropTap.value = !onDropTap.value;
// // },
// ),
// ),
// ),
// // Dropdown List
// if (onDropTap.value && filteredTags.isNotEmpty)
// Container(
// width: double.infinity,
// decoration: BoxDecoration(
// color: const Color(0xFFFFFFFF).withOpacity(0.10),
// borderRadius: const BorderRadius.vertical(
// bottom: Radius.circular(30),
// ),
// border: Border.all(color: const Color(0xFF434A53)),
// ),
// child: ListView.builder(
// shrinkWrap: true,
// itemCount: filteredTags.length,
// itemBuilder: (context, index) {
// return InkWell(
// onTap: () {
// Data selectedItem = filteredTags[index];
// if (selectedTags.contains(selectedItem)) {
// selectedTags.remove(selectedItem);
// } else {
// selectedTags.add(selectedItem);
// }
// textEditingController.clear();
// widget.onItemSelected(selectedTags.toList());
// filterTags(); // Update the filtered list
// },
// child: Padding(
// padding: const EdgeInsets.all(10.0),
// child: Row(
// children: [
// Text(
// filteredTags[index].name!,
// style: const TextStyle(
// color: Colors.white,
// fontSize: 16,
// fontWeight: FontWeight.w400,
// fontFamily: 'Helvetica',
// ),
// ),
// const Spacer(),
// Text(
// 'Popularity: ${filteredTags[index].tagPopularity}',
// style: const TextStyle(
// color: Colors.white70,
// fontSize: 12,
// ),
// ),
// ],
// ),
// ),
// );
// },
// ),
// ),
// sizedBoxHeight(20.h),
// // Selected Tags Displayed as Chips
// if (selectedTags.isNotEmpty)
// Wrap(
// spacing: 8.0,
// runSpacing: 4.0,
// children: selectedTags.map((tag) {
// return Chip(
// label: Text('#${tag.name!}',
// style: const TextStyle(color: Colors.white)),
// backgroundColor: const Color(0xFFD90B2E).withOpacity(0.9),
// // Color(0xFFD90B2E).withOpacity(0.90),
// // Colors.transparent, // Make Chip background transparent
// side: BorderSide(color: Colors.black),
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(30.r),
// side: BorderSide(width: 1, color: Colors.white)),
// onDeleted: () {
// selectedTags.remove(tag);
// widget.onItemSelected(selectedTags.toList());
// filterTags(); // Update the filtered list after removing a tag
// },
// materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
// padding: const EdgeInsets.symmetric(horizontal: 16),
// );
// }).toList(),
// ),
// ],
// ),
// );
// }
// }
class CreateData {
final int id;
final String name;

File diff suppressed because it is too large Load Diff

View File

@@ -4,8 +4,11 @@ import 'package:regroup/Common/api_urls.dart';
import 'package:regroup/Common/base_manager.dart';
import 'package:regroup/Common/controller/data/network/network_api.dart';
import 'package:regroup/Main_Screens/Community_HomePage/Model/tagdetailModel.dart';
import 'package:regroup/Main_Screens/Community_HomePage/Model/tagpopulardetailsModel.dart';
TagdetailsModel? tagdetailobj;
TagPopulardetailsModel? tagpopulardetailobj;
class Communitygetmethod {
Future<ResponseData<dynamic>> getTagsdata(updata) async {
@@ -19,4 +22,16 @@ class Communitygetmethod {
}
return response;
}
Future<ResponseData<dynamic>> getPopularTagsdata(updata) async {
final response = await NetworkApiServices().getApi(
"${ApiUrls.getpopularTagsdetails}?search_post_by_tag_id=$updata",
);
if (response.status == ResponseStatus.SUCCESS) {
tagpopulardetailobj = TagPopulardetailsModel.fromJson(response.data);
log(tagpopulardetailobj!.data.toString());
}
return response;
}
}

View File

@@ -31,7 +31,7 @@ class CustomTextFormField extends StatefulWidget {
this.onTap,
this.suffixIcon,
this.opacity1 = 0.04,
this.opacity2 = 0.05,
this.opacity2 = 0.05, this.focusNode,
}) : super(key: key);
dynamic validator;
@@ -52,7 +52,7 @@ class CustomTextFormField extends StatefulWidget {
final Widget? suffixIcon;
final double opacity1;
final double opacity2;
final FocusNode? focusNode;
String? validationMessage;
@override
@@ -99,6 +99,7 @@ class _CustomTextFormFieldState extends State<CustomTextFormField> {
borderRadius: BorderRadius.circular(30.r),
border: Border.all(color: const Color(0xff434A53), width: 0.8),
child: TextFormField(
focusNode: widget.focusNode,
style: TextStyle(
fontSize: 16.sp, color: Colors.white, fontFamily: 'Helvetica'),
cursorColor: Colors.red,
@@ -153,9 +154,7 @@ class _CustomTextFormFieldState extends State<CustomTextFormField> {
],
),
)
: widget.suffixIcon == null
? null
: widget.suffixIcon!,
: widget.suffixIcon,
border: InputBorder.none,
contentPadding:
EdgeInsets.symmetric(horizontal: 20.h, vertical: 13.w),
@@ -237,8 +236,8 @@ class _CustomTextFormField2State extends State<CustomTextFormField2> {
void validateField(String value) {
setState(() {
widget.validationMessage = widget.validator?.call(value) ??
(value.isEmpty ? "" : null);
widget.validationMessage =
widget.validator?.call(value) ?? (value.isEmpty ? "" : null);
});
}

View File

@@ -115,6 +115,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
@override
Widget build(BuildContext context) {
return ScreenUtilInit(
//useInheritedMediaQuery: true,
builder: (BuildContext context, Widget? child) => GetMaterialApp(
title: 'Regroup',
theme: ThemeData(
@@ -124,14 +125,11 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
debugShowCheckedModeBanner: false,
// initialRoute: RouteName.individualactivitystep2,
initialRoute: RouteName.splashScreen,
getPages: AppRoutes.appRoutes(),
),
designSize: const Size(390, 844),
);
}
}
}

View File

@@ -36,11 +36,16 @@ class Getuserdetails {
'phone', getuserobj?.data?.userData?.phoneNumber ?? "");
await prefs.setString('accountTypefromLogin',
getuserobj?.data?.userData?.principalTypeXid.toString() ?? "");
await prefs.setString(
'userId', getuserobj?.data?.userData?.id.toString() ?? "");
emailid = prefs.getString('email');
myusername = prefs.getString('username');
fullname = prefs.getString('fullname');
phonenumber = prefs.getString('phone');
globalAccountType = prefs.getString('accountTypefromLogin');
userIdGlobal = prefs.getString('userId') ?? "0";
globalAccountType =
getuserobj?.data?.userData?.principalTypeXid.toString();
} else if (responseData is String) {

View File

@@ -208,415 +208,330 @@ class _SideMenuState extends State<SideMenu> {
}
Widget _buildBody(context) {
return Column(
return ListView(
padding: EdgeInsets.zero,
children: [
sizedBoxHeight(50.h),
Expanded(
child: ListView(physics: ScrollPhysics(), children: [
GestureDetector(
onTap: () {
Get.toNamed(RouteName.mycommunity);
},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Row(
children: [
text16w400_FCFCFC("My communities"),
sizedBoxWidth(4.w),
Image.asset('assets/images/png/sidemenu/rightarrow.png')
],
GestureDetector(
onTap: () {
Get.toNamed(RouteName.mycommunity);
},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Row(
children: [
text16w400_FCFCFC("My communities"),
sizedBoxWidth(4.w),
Image.asset('assets/images/png/sidemenu/rightarrow.png')
],
),
),
),
sizedBoxHeight(18.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Container(
height: 1,
margin: EdgeInsets.symmetric(vertical: 10.h),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: const Color.fromRGBO(255, 255, 255, 0.3),
width: 1.w,
),
),
),
const Spacer(),
sizedBoxHeight(18.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Container(
height: 1,
margin: EdgeInsets.symmetric(vertical: 10.h),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: const Color.fromRGBO(255, 255, 255, 0.3),
width: 1.w,
),
),
),
),
sizedBoxHeight(18.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: text16w400_FCFCFC("My pinned content"),
),
sizedBoxHeight(18.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Container(
height: 1,
margin: EdgeInsets.symmetric(vertical: 10.h),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: const Color.fromRGBO(255, 255, 255, 0.3),
width: 1.w,
),
),
),
sizedBoxHeight(18.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: text16w400_FCFCFC("My pinned content"),
),
const Spacer(),
sizedBoxHeight(18.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Container(
height: 1,
margin: EdgeInsets.symmetric(vertical: 10.h),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: const Color.fromRGBO(255, 255, 255, 0.3),
width: 1.w,
),
),
),
),
),
sizedBoxHeight(18.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Row(
children: [
text16w400_FCFCFC("interest"),
const Spacer(),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.viewalltags);
},
child: text14w400_FCFCFC("View all")),
],
),
),
sizedBoxHeight(20.h),
userpinnedobj!.data!.pinnedTag!.isEmpty
? Center(child: text16400white("Pin tags"))
: SizedBox(
height: 200.h,
child:
// Obx( () {
// return
ListView.builder(
shrinkWrap: true,
itemCount: userpinnedobj!.data!.pinnedTag!.take(5).length,
itemBuilder: (context, index) {
final tagid = userpinnedobj!
.data!.pinnedTag![index].manageTagsXid!;
),
),
sizedBoxHeight(18.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Row(
children: [
text16w400_FCFCFC("interest"),
const Spacer(),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.viewalltags);
},
child: text14w400_FCFCFC("View all")),
],
),
),
sizedBoxHeight(0.h),
userpinnedobj!.data!.pinnedTag!.isEmpty
? Center(child: text16400white("Pin tags"))
: SizedBox(
height: 200.h,
child: ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: userpinnedobj!.data!.pinnedTag!.take(5).length,
itemBuilder: (context, index) {
final tagid =
userpinnedobj!.data!.pinnedTag![index].manageTagsXid!;
return ListTile(
leading: commonContainer(
width: 29.w,
height: 29.h,
borderwidth: 0.9,
boxShape: BoxShape.circle,
customWidget: Center(
child: Image.asset(
'assets/images/png/sidemenu/rowing 1 (traced).png',
width: 13.w,
height: 13.h,
),
)),
title: userpinnedobj!.data!.pinnedTag![index].tag ==
null ||
return ListTile(
leading: commonContainer(
width: 29.w,
height: 29.h,
borderwidth: 0.9,
boxShape: BoxShape.circle,
customWidget: Center(
child: Image.asset(
'assets/images/png/sidemenu/rowing 1 (traced).png',
width: 13.w,
height: 13.h,
),
)),
title:
userpinnedobj!.data!.pinnedTag![index].tag == null ||
userpinnedobj!.data!.pinnedTag![index].tag!
.name!.isEmpty
? text14w400_FCFCFC('')
: text14w400_FCFCFC(userpinnedobj!
.data!.pinnedTag![index].tag!.name!),
trailing: InkWell(
onTap: () async {
setState(() {
pinunpinTag(tagid);
userpinnedobj!.data!.pinnedTag!.removeWhere(
(item) => item.manageTagsXid == tagid);
});
// toggleSelectedIndex(tagid);
},
child:
// Obx(
// () {
// return selectedIndices.contains(tagid)
// ?
// Image.asset(
// "assets/images/png/sidemenu/f7_pin-fill (1).png",
// width: 19,
// height: 19,
// )
// :
Image.asset(
"assets/images/png/sidemenu/f7_pin-fill.png",
width: 19,
height: 19,
),
// },
// ),
),
// onTap: () {},
);
},
),
// }
// )
),
sizedBoxHeight(18.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Container(
height: 1,
margin: EdgeInsets.symmetric(vertical: 10.h),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: const Color.fromRGBO(255, 255, 255, 0.3),
width: 1.w,
),
),
trailing: InkWell(
onTap: () async {
setState(() {
pinunpinTag(tagid);
userpinnedobj!.data!.pinnedTag!.removeWhere(
(item) => item.manageTagsXid == tagid);
});
},
child: Image.asset(
"assets/images/png/sidemenu/f7_pin-fill.png",
width: 19,
height: 19,
),
),
);
},
),
),
sizedBoxHeight(18.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Container(
height: 1,
margin: EdgeInsets.symmetric(vertical: 10.h),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: const Color.fromRGBO(255, 255, 255, 0.3),
width: 1.w,
),
),
),
sizedBoxHeight(18.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Row(
children: [
text16w400_FCFCFC("Communities"),
const Spacer(),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.viewallcommunitiespinned);
},
child: text14w400_FCFCFC("View all")),
],
),
),
sizedBoxHeight(20.h),
userpinnedobj!.data!.pinnedCommunity!.isEmpty
? Center(child: text16400white("Pin communities"))
: SizedBox(
height: 200.h,
child: ListView.builder(
shrinkWrap: true,
itemCount:
userpinnedobj!.data!.pinnedCommunity!.take(5).length,
itemBuilder: (context, index) {
final commnityid = userpinnedobj!.data!
.pinnedCommunity![index].manageCommunitiesXid!;
),
),
sizedBoxHeight(18.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Row(
children: [
text16w400_FCFCFC("Communities"),
const Spacer(),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.viewallcommunitiespinned);
},
child: text14w400_FCFCFC("View all")),
],
),
),
sizedBoxHeight(0.h),
userpinnedobj!.data!.pinnedCommunity!.isEmpty
? Center(child: text16400white("Pin communities"))
: SizedBox(
height: 200.h,
child: ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount:
userpinnedobj!.data!.pinnedCommunity!.take(5).length,
itemBuilder: (context, index) {
final commnityid = userpinnedobj!
.data!.pinnedCommunity![index].manageCommunitiesXid!;
return ListTile(
leading: Container(
width: 29.w,
height: 29.h,
decoration: BoxDecoration(
shape: BoxShape.circle,
// color: Colors.amber,
),
child:
userpinnedobj!
.data!
.pinnedCommunity![index]
.community!
.communityProfilePhoto ==
null ||
userpinnedobj!
.data!
.pinnedCommunity![index]
.community!
.communityProfilePhoto!
.isEmpty
? CircleAvatar(
backgroundImage: AssetImage(
'assets/images/png/sidemenu/rowing 1 (traced).png',
),
)
: CircleAvatar(
backgroundImage: NetworkImage(
userpinnedobj!
.data!
.pinnedCommunity![index]
.community!
.communityProfilePhoto!),
)
),
title: userpinnedobj!.data!.pinnedCommunity![index]
.community ==
return ListTile(
leading: Container(
width: 29.w,
height: 29.h,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: userpinnedobj!.data!.pinnedCommunity![index]
.community!.communityProfilePhoto ==
null ||
userpinnedobj!.data!.pinnedCommunity![index]
.community!.communityName!.isEmpty
? text14w400_FCFCFC('')
: text14w400_FCFCFC(userpinnedobj!
.data!
.pinnedCommunity![index]
.community!
.communityName!),
trailing: InkWell(
onTap: () async {
setState(() {
pinunpinCommunities(commnityid);
userpinnedobj!.data!.pinnedCommunity!
.removeWhere((item) =>
item.manageCommunitiesXid ==
commnityid);
});
// toggleSelectedIndex(tagid);
},
// () {
// pinunpinTag(tagid);
// // toggleSelectedIndex(tagid);
// },
child: Image.asset(
"assets/images/png/sidemenu/f7_pin-fill.png",
width: 19,
height: 19,
),
// Obx(
// () {
// return selectedIndicescommunity.contains(tagid)
// ? Image.asset(
// "assets/images/png/sidemenu/f7_pin-fill (1).png",
// width: 19,
// height: 19,
// )
// : Image.asset(
// "assets/images/png/sidemenu/f7_pin-fill.png",
// width: 19,
// height: 19,
// );
// },
// ),
),
);
},
),
),
sizedBoxHeight(18.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Container(
height: 1,
margin: EdgeInsets.symmetric(vertical: 10.h),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: const Color.fromRGBO(255, 255, 255, 0.3),
width: 1.w,
),
),
.community!.communityProfilePhoto!.isEmpty
? CircleAvatar(
backgroundImage: AssetImage(
'assets/images/png/sidemenu/rowing 1 (traced).png',
),
)
: CircleAvatar(
backgroundImage: NetworkImage(userpinnedobj!
.data!
.pinnedCommunity![index]
.community!
.communityProfilePhoto!),
)),
title: userpinnedobj!.data!.pinnedCommunity![index]
.community ==
null ||
userpinnedobj!.data!.pinnedCommunity![index]
.community!.communityName!.isEmpty
? text14w400_FCFCFC('')
: text14w400_FCFCFC(userpinnedobj!
.data!
.pinnedCommunity![index]
.community!
.communityName!),
trailing: InkWell(
onTap: () async {
setState(() {
pinunpinCommunities(commnityid);
userpinnedobj!.data!.pinnedCommunity!.removeWhere(
(item) =>
item.manageCommunitiesXid == commnityid);
});
},
child: Image.asset(
"assets/images/png/sidemenu/f7_pin-fill.png",
width: 19,
height: 19,
),
),
);
},
),
),
sizedBoxHeight(18.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Container(
height: 1,
margin: EdgeInsets.symmetric(vertical: 10.h),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: const Color.fromRGBO(255, 255, 255, 0.3),
width: 1.w,
),
),
),
sizedBoxHeight(18.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Row(
children: [
text16w400_FCFCFC("Users"),
const Spacer(),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.viewalluserspinned);
},
child: text14w400_FCFCFC("View all")),
],
),
),
sizedBoxHeight(20.h),
userpinnedobj!.data!.pinnedUser!.isEmpty
? Center(child: text16400white("Pin users"))
: SizedBox(
height: 200.h,
child: ListView.builder(
shrinkWrap: true,
itemCount:
userpinnedobj!.data!.pinnedUser!.take(5).length,
itemBuilder: (context, index) {
final userid = userpinnedobj!
.data!.pinnedUser![index].pinIamPrincipalXid!;
),
),
sizedBoxHeight(18.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Row(
children: [
text16w400_FCFCFC("Users"),
const Spacer(),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.viewalluserspinned);
},
child: text14w400_FCFCFC("View all")),
],
),
),
sizedBoxHeight(0.h),
userpinnedobj!.data!.pinnedUser!.isEmpty
? Center(child: text16400white("Pin users"))
: SizedBox(
height: 200.h,
child: ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: userpinnedobj!.data!.pinnedUser!.take(5).length,
itemBuilder: (context, index) {
final userid = userpinnedobj!
.data!.pinnedUser![index].pinIamPrincipalXid!;
return ListTile(
leading: commonContainer(
width: 29.w,
height: 29.h,
borderwidth: 0.9,
boxShape: BoxShape.circle,
customWidget: Center(
child: userpinnedobj!.data!.pinnedUser![index]
.pinUser!.profilePhoto ==
null ||
userpinnedobj!
.data!
.pinnedUser![index]
.pinUser!
.profilePhoto!
.isEmpty
? Image.asset(
return ListTile(
leading: commonContainer(
width: 29.w,
height: 29.h,
borderwidth: 0.9,
boxShape: BoxShape.circle,
customWidget: Center(
child: userpinnedobj!.data!.pinnedUser![index]
.pinUser!.profilePhoto ==
null ||
userpinnedobj!.data!.pinnedUser![index]
.pinUser!.profilePhoto!.isEmpty
? Image.asset(
'assets/images/png/sidemenu/rowing 1 (traced).png',
width: 13.w,
height: 13.h,
)
: Image.network(
userpinnedobj!.data!.pinnedUser![index]
.pinUser!.profilePhoto!,
width: 13.w,
height: 13.h,
errorBuilder:
(context, error, stackTrace) {
return Image.asset(
'assets/images/png/sidemenu/rowing 1 (traced).png',
width: 13.w,
height: 13.h,
)
: Image.network(
userpinnedobj!
.data!
.pinnedUser![index]
.pinUser!
.profilePhoto!,
width: 13.w,
height: 13.h,
errorBuilder:
(context, error, stackTrace) {
// Error handling when image fails to load
return Image.asset(
'assets/images/png/sidemenu/rowing 1 (traced).png',
width: 13.w,
height: 13.h,
);
},
))),
title: userpinnedobj!.data!.pinnedUser![index]
.pinUser!.fullName ==
null ||
userpinnedobj!.data!.pinnedUser![index]
.pinUser!.fullName!.isEmpty
? text14w400_FCFCFC('')
: text14w400_FCFCFC(userpinnedobj!
.data!.pinnedUser![index].pinUser!.fullName!),
trailing: InkWell(
onTap: () async {
setState(() {
pinunpinUser(userid);
userpinnedobj!.data!.pinnedUser!.removeWhere(
(item) =>
item.pinIamPrincipalXid == userid);
});
// toggleSelectedIndex(tagid);
},
child: Image.asset(
"assets/images/png/sidemenu/f7_pin-fill.png",
width: 19,
height: 19,
),
// Obx(
// () {
// return selectedIndicesuser.contains(userid)
// ? Image.asset(
// "assets/images/png/sidemenu/f7_pin-fill (1).png",
// width: 19,
// height: 19,
// )
// : Image.asset(
// "assets/images/png/sidemenu/f7_pin-fill.png",
// width: 19,
// height: 19,
// );
// },
// ),
),
);
},
),
),
sizedBoxHeight(18.h),
sizedBoxHeight(80.h),
]),
),
);
},
))),
title: userpinnedobj!.data!.pinnedUser![index].pinUser!
.fullName ==
null ||
userpinnedobj!.data!.pinnedUser![index].pinUser!
.fullName!.isEmpty
? text14w400_FCFCFC('')
: text14w400_FCFCFC(userpinnedobj!
.data!.pinnedUser![index].pinUser!.fullName!),
trailing: InkWell(
onTap: () async {
setState(() {
pinunpinUser(userid);
userpinnedobj!.data!.pinnedUser!.removeWhere(
(item) => item.pinIamPrincipalXid == userid);
});
},
child: Image.asset(
"assets/images/png/sidemenu/f7_pin-fill.png",
width: 19,
height: 19,
),
),
);
},
),
),
sizedBoxHeight(18.h),
sizedBoxHeight(80.h),
],
);
}

View File

@@ -350,6 +350,54 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.0-beta.2"
flutter_keyboard_visibility:
dependency: "direct main"
description:
name: flutter_keyboard_visibility
sha256: "98664be7be0e3ffca00de50f7f6a287ab62c763fc8c762e0a21584584a3ff4f8"
url: "https://pub.dev"
source: hosted
version: "6.0.0"
flutter_keyboard_visibility_linux:
dependency: transitive
description:
name: flutter_keyboard_visibility_linux
sha256: "6fba7cd9bb033b6ddd8c2beb4c99ad02d728f1e6e6d9b9446667398b2ac39f08"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
flutter_keyboard_visibility_macos:
dependency: transitive
description:
name: flutter_keyboard_visibility_macos
sha256: c5c49b16fff453dfdafdc16f26bdd8fb8d55812a1d50b0ce25fc8d9f2e53d086
url: "https://pub.dev"
source: hosted
version: "1.0.0"
flutter_keyboard_visibility_platform_interface:
dependency: transitive
description:
name: flutter_keyboard_visibility_platform_interface
sha256: e43a89845873f7be10cb3884345ceb9aebf00a659f479d1c8f4293fcb37022a4
url: "https://pub.dev"
source: hosted
version: "2.0.0"
flutter_keyboard_visibility_web:
dependency: transitive
description:
name: flutter_keyboard_visibility_web
sha256: d3771a2e752880c79203f8d80658401d0c998e4183edca05a149f5098ce6e3d1
url: "https://pub.dev"
source: hosted
version: "2.0.0"
flutter_keyboard_visibility_windows:
dependency: transitive
description:
name: flutter_keyboard_visibility_windows
sha256: fc4b0f0b6be9b93ae527f3d527fb56ee2d918cd88bbca438c478af7bcfd0ef73
url: "https://pub.dev"
source: hosted
version: "1.0.0"
flutter_launcher_icons:
dependency: "direct dev"
description:

View File

@@ -76,6 +76,7 @@ dependencies:
timer_button: ^2.1.1
flutter_html: ^3.0.0-beta.2
comment_tree: ^0.3.0
flutter_keyboard_visibility: ^6.0.0
dev_dependencies:
flutter_test: