Merge pull request #102 from WDI-Ideas/Development
community tab error fixed
This commit is contained in:
@@ -1,197 +1,212 @@
|
||||
class FeedPostModel {
|
||||
FeedPostModel({
|
||||
required this.status,
|
||||
required this.statusCode,
|
||||
required this.message,
|
||||
required this.data,
|
||||
});
|
||||
FeedPostModel({
|
||||
required this.status,
|
||||
required this.statusCode,
|
||||
required this.message,
|
||||
required this.data,
|
||||
});
|
||||
|
||||
final String? status;
|
||||
final int? statusCode;
|
||||
final String? message;
|
||||
final Data? data;
|
||||
|
||||
factory FeedPostModel.fromJson(Map<String, dynamic> json){
|
||||
return FeedPostModel(
|
||||
status: json["status"],
|
||||
statusCode: json["status_code"],
|
||||
message: json["message"],
|
||||
data: json["data"] == null ? null : Data.fromJson(json["data"]),
|
||||
);
|
||||
}
|
||||
final String? status;
|
||||
final int? statusCode;
|
||||
final String? message;
|
||||
final Data? data;
|
||||
|
||||
factory FeedPostModel.fromJson(Map<String, dynamic> json) {
|
||||
return FeedPostModel(
|
||||
status: json["status"],
|
||||
statusCode: json["status_code"],
|
||||
message: json["message"],
|
||||
data: json["data"] == null ? null : Data.fromJson(json["data"]),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Data {
|
||||
Data({
|
||||
required this.pinnedCommunityPost,
|
||||
required this.pinnedUserPost,
|
||||
required this.pinnedTagsPost,
|
||||
});
|
||||
Data({
|
||||
required this.pinnedCommunityPost,
|
||||
required this.pinnedUserPost,
|
||||
required this.pinnedTagsPost,
|
||||
});
|
||||
|
||||
final List<PinnedPost> pinnedCommunityPost;
|
||||
final List<PinnedPost> pinnedUserPost;
|
||||
final List<PinnedPost> pinnedTagsPost;
|
||||
|
||||
factory Data.fromJson(Map<String, dynamic> json){
|
||||
return Data(
|
||||
pinnedCommunityPost: json["pinned_community_post"] == null ? [] : List<PinnedPost>.from(json["pinned_community_post"]!.map((x) => PinnedPost.fromJson(x))),
|
||||
pinnedUserPost: json["pinned_user_post"] == null ? [] : List<PinnedPost>.from(json["pinned_user_post"]!.map((x) => PinnedPost.fromJson(x))),
|
||||
pinnedTagsPost: json["pinned_tags_post"] == null ? [] : List<PinnedPost>.from(json["pinned_tags_post"]!.map((x) => PinnedPost.fromJson(x))),
|
||||
);
|
||||
}
|
||||
final List<PinnedPost> pinnedCommunityPost;
|
||||
final List<PinnedPost> pinnedUserPost;
|
||||
final List<PinnedPost> pinnedTagsPost;
|
||||
|
||||
factory Data.fromJson(Map<String, dynamic> json) {
|
||||
return Data(
|
||||
pinnedCommunityPost: json["pinned_community_post"] == null
|
||||
? []
|
||||
: List<PinnedPost>.from(json["pinned_community_post"]!
|
||||
.map((x) => PinnedPost.fromJson(x))),
|
||||
pinnedUserPost: json["pinned_user_post"] == null
|
||||
? []
|
||||
: List<PinnedPost>.from(
|
||||
json["pinned_user_post"]!.map((x) => PinnedPost.fromJson(x))),
|
||||
// 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))),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
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.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,
|
||||
});
|
||||
|
||||
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;
|
||||
|
||||
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"]),
|
||||
);
|
||||
}
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
factory Community.fromJson(Map<String, dynamic> json){
|
||||
return Community(
|
||||
id: json["id"],
|
||||
communityProfilePhoto: json["community_profile_photo"],
|
||||
communityName: json["community_name"],
|
||||
);
|
||||
}
|
||||
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.principalTypeXid,
|
||||
required this.userName,
|
||||
required this.fullName,
|
||||
required this.profilePhoto,
|
||||
});
|
||||
IamPrincipal({
|
||||
required this.id,
|
||||
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;
|
||||
|
||||
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"],
|
||||
);
|
||||
}
|
||||
final int? id;
|
||||
final int? principalTypeXid;
|
||||
final String? userName;
|
||||
final String? fullName;
|
||||
final String? profilePhoto;
|
||||
|
||||
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;
|
||||
|
||||
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"]),
|
||||
);
|
||||
}
|
||||
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,
|
||||
});
|
||||
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"],
|
||||
);
|
||||
}
|
||||
final int? id;
|
||||
final String? image;
|
||||
|
||||
factory LikeIconClass.fromJson(Map<String, dynamic> json) {
|
||||
return LikeIconClass(
|
||||
id: json["id"],
|
||||
image: json["image"],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,75 +250,102 @@ class _FeedTabState extends State<FeedTab> {
|
||||
fit: BoxFit.fill),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
sizedBoxHeight(16.h),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: combinedList.length,
|
||||
itemBuilder: (context, index) {
|
||||
var timeAgo = ConvertServerDateToUserDate()
|
||||
.convertServerDateToReadableFormate(
|
||||
combinedList[index].createdAt.toString());
|
||||
if (index == 1) {
|
||||
return announcecardtile(
|
||||
profileImg: combinedList[index]
|
||||
.iamPrincipal!
|
||||
.profilePhoto ??
|
||||
'',
|
||||
title: combinedList[index].iamPrincipal!.fullName ??
|
||||
'',
|
||||
mainImg: combinedList[index].image ?? '',
|
||||
containerTitle:
|
||||
combinedList[index].tagNames ?? [''],
|
||||
create_at: timeAgo,
|
||||
community_name:
|
||||
combinedList[index].community!.communityName ??
|
||||
'',
|
||||
totalcomments:
|
||||
combinedList[index].totalComment.toString(),
|
||||
description: combinedList[index].caption ?? '',
|
||||
totalSave: combinedList[index].totalSave.toString(),
|
||||
);
|
||||
} else {
|
||||
return Column(
|
||||
children: [
|
||||
normalcardtile2(
|
||||
profileImg: combinedList[index]
|
||||
.iamPrincipal!
|
||||
.profilePhoto ??
|
||||
'',
|
||||
title: combinedList[index]
|
||||
.iamPrincipal!
|
||||
.fullName ??
|
||||
'',
|
||||
mainImg: combinedList[index].image ?? '',
|
||||
containerTitle:
|
||||
combinedList[index].tagNames ?? [],
|
||||
description: combinedList[index].caption ?? '',
|
||||
create_at: timeAgo,
|
||||
total_comments:
|
||||
combinedList[index].totalComment.toString(),
|
||||
total_likes:
|
||||
combinedList[index].likecount.toString(),
|
||||
total_save:
|
||||
combinedList[index].totalSave.toString(),
|
||||
community_name: combinedList[index]
|
||||
.community!
|
||||
.communityName
|
||||
.toString(),
|
||||
RecationId: combinedList[index].id.toString(),
|
||||
),
|
||||
sizedBoxHeight(20.h)
|
||||
],
|
||||
);
|
||||
}
|
||||
},
|
||||
combinedList.isEmpty
|
||||
? Expanded(
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
"No Data Found",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: Column(
|
||||
children: [
|
||||
sizedBoxHeight(16.h),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: combinedList.length,
|
||||
itemBuilder: (context, index) {
|
||||
var timeAgo = ConvertServerDateToUserDate()
|
||||
.convertServerDateToReadableFormate(
|
||||
combinedList[index].createdAt.toString());
|
||||
if (index == 1) {
|
||||
return announcecardtile(
|
||||
profileImg: combinedList[index]
|
||||
.iamPrincipal!
|
||||
.profilePhoto ??
|
||||
'',
|
||||
title: combinedList[index]
|
||||
.iamPrincipal!
|
||||
.fullName ??
|
||||
'',
|
||||
mainImg: combinedList[index].image ?? '',
|
||||
containerTitle:
|
||||
combinedList[index].tagNames ?? [''],
|
||||
create_at: timeAgo,
|
||||
community_name: combinedList[index]
|
||||
.community!
|
||||
.communityName ??
|
||||
'',
|
||||
totalcomments: combinedList[index]
|
||||
.totalComment
|
||||
.toString(),
|
||||
description:
|
||||
combinedList[index].caption ?? '',
|
||||
totalSave:
|
||||
combinedList[index].totalSave.toString(),
|
||||
);
|
||||
} else {
|
||||
return Column(
|
||||
children: [
|
||||
normalcardtile2(
|
||||
profileImg: combinedList[index]
|
||||
.iamPrincipal!
|
||||
.profilePhoto ??
|
||||
'',
|
||||
title: combinedList[index]
|
||||
.iamPrincipal!
|
||||
.fullName ??
|
||||
'',
|
||||
mainImg: combinedList[index].image ?? '',
|
||||
containerTitle:
|
||||
combinedList[index].tagNames ?? [],
|
||||
description:
|
||||
combinedList[index].caption ?? '',
|
||||
create_at: timeAgo,
|
||||
total_comments: combinedList[index]
|
||||
.totalComment
|
||||
.toString(),
|
||||
total_likes: combinedList[index]
|
||||
.likecount
|
||||
.toString(),
|
||||
total_save: combinedList[index]
|
||||
.totalSave
|
||||
.toString(),
|
||||
community_name: combinedList[index]
|
||||
.community!
|
||||
.communityName
|
||||
.toString(),
|
||||
RecationId:
|
||||
combinedList[index].id.toString(),
|
||||
),
|
||||
sizedBoxHeight(20.h)
|
||||
],
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ class _SelectIndividualActivityState extends State<SelectIndividualActivity> {
|
||||
// If the first selected container is unselected, reset the active state
|
||||
_firstSelectedIndex = null;
|
||||
_isFirstSelectionActive = false;
|
||||
_selectedIndices.clear();
|
||||
}
|
||||
} else {
|
||||
if (_firstSelectedIndex == null) {
|
||||
|
||||
11
pubspec.yaml
11
pubspec.yaml
@@ -2,7 +2,7 @@ name: regroup
|
||||
description: A new Flutter project.
|
||||
# The following line prevents the package from being accidentally published to
|
||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
# The following defines the version and build number for your application.
|
||||
# A version number is three numbers separated by dots, like 1.2.43
|
||||
@@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: '>=2.19.6 <3.0.0'
|
||||
sdk: ">=2.19.6 <3.0.0"
|
||||
|
||||
# Dependencies specify other packages that your package needs in order to work.
|
||||
# To automatically upgrade your package dependencies to the latest versions
|
||||
@@ -31,7 +31,6 @@ dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.2
|
||||
@@ -48,7 +47,7 @@ dependencies:
|
||||
image_cropper: ^6.0.0
|
||||
image_picker: ^1.0.8
|
||||
lottie: ^3.1.2
|
||||
connectivity_plus:
|
||||
connectivity_plus:
|
||||
animations: ^2.0.11
|
||||
shimmer: ^3.0.0
|
||||
device_info_plus: ^9.1.2
|
||||
@@ -78,15 +77,12 @@ dependencies:
|
||||
flutter_html: ^3.0.0-beta.2
|
||||
comment_tree: ^0.3.0
|
||||
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
flutter_lints: ^2.0.0
|
||||
|
||||
|
||||
flutter_launcher_icons: ^0.13.1
|
||||
|
||||
flutter_launcher_icons:
|
||||
@@ -101,7 +97,6 @@ flutter_launcher_icons:
|
||||
|
||||
# The following section is specific to Flutter packages.
|
||||
flutter:
|
||||
|
||||
# The following line ensures that the Material Icons font is
|
||||
# included with your application, so that you can use the icons in
|
||||
# the material Icons class.
|
||||
|
||||
Reference in New Issue
Block a user