tags popular done fixes in feed tab and create post screen

This commit is contained in:
Shubhamshirva
2024-08-08 18:52:09 +05:30
parent ff08056369
commit 255faca290
8 changed files with 4226 additions and 649 deletions

View File

@@ -134,6 +134,8 @@ class ApiUrls {
static const postusersave = "${baseUrl}save-post";
static const getpopularTagsdetails = "${baseUrl}fetch-popular-post";
}

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"],
);
}
}

File diff suppressed because it is too large Load Diff

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

@@ -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

@@ -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),
],
);
}