bug fixed

This commit is contained in:
Dakshesh42
2024-08-09 19:46:45 +05:30
parent 0c3c1d1449
commit b97ee0c77c
3 changed files with 210 additions and 126 deletions

View File

@@ -489,7 +489,7 @@ class _FeedTabState extends State<FeedTab> {
children: [
commonGlassUIBlue(
width: double.infinity,
height: 780.h,
height: 840.h,
borderRadius: BorderRadius.circular(1),
customWidget: Column(
crossAxisAlignment:
@@ -788,17 +788,13 @@ class _FeedTabState extends State<FeedTab> {
),
sizedBoxHeight(20.h),
SizedBox(
height: 80.h,
width: double.infinity,
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
text16w400_FCFCFC(
combinedList[index]
.caption ??
''),
],
child: SingleChildScrollView(
child: text16w400_FCFCFC(
combinedList[index]
.caption ??
''),
),
),
Row(children: [
@@ -1423,19 +1419,16 @@ class _FeedTabState extends State<FeedTab> {
),
sizedBoxHeight(20.h),
SizedBox(
height: 80.h,
width: double.infinity,
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
text16w400_FCFCFC(
combinedList![index]
.caption ??
''),
],
child: SingleChildScrollView(
child: text16w400_FCFCFC(
combinedList![index]
.caption ??
''),
),
),
sizedBoxHeight(20.h),
Row(children: [
InkWell(
onTap: () {
@@ -2176,14 +2169,12 @@ class _NormalCardTileState extends State<NormalCardTile> {
),
sizedBoxHeight(20.h),
SizedBox(
height: 80.h,
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text16w400_FCFCFC(widget.description),
],
),
child: SingleChildScrollView(
child: text16w400_FCFCFC(widget.description)),
),
sizedBoxHeight(20.h),
Row(children: [
InkWell(
onTap: () {
@@ -3155,7 +3146,7 @@ class _LatestTabState extends State<LatestTab> {
children: [
commonGlassUIBlue(
width: double.infinity,
height: 780.h,
height: 840.h,
borderRadius: BorderRadius.circular(1),
customWidget: Column(
crossAxisAlignment:
@@ -3485,20 +3476,17 @@ class _LatestTabState extends State<LatestTab> {
),
sizedBoxHeight(20.h),
SizedBox(
height: 60.h,
width: double.infinity,
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
text16w400_FCFCFC(
latestpostobj!
.data[index]
.caption ??
''),
],
child: SingleChildScrollView(
child: text16w400_FCFCFC(
latestpostobj!
.data[index]
.caption ??
''),
),
),
sizedBoxHeight(20.h),
Row(children: [
InkWell(
onTap: () {},
@@ -4232,20 +4220,17 @@ class _LatestTabState extends State<LatestTab> {
),
sizedBoxHeight(20.h),
SizedBox(
height: 80.h,
width: double.infinity,
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
text16w400_FCFCFC(
latestpostobj!
.data[index]
.caption ??
''),
],
child: SingleChildScrollView(
child: text16w400_FCFCFC(
latestpostobj!
.data[index]
.caption ??
''),
),
),
sizedBoxHeight(20.h),
Row(children: [
InkWell(
onTap: () {

View File

@@ -3,6 +3,7 @@ import 'dart:developer';
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
import 'package:flutter_reaction_button/flutter_reaction_button.dart';
@@ -24,6 +25,7 @@ import 'package:regroup/Main_Screens/Community_HomePage/PostDetailScreen/ViewMod
import 'package:regroup/Main_Screens/Community_HomePage/PostDetailScreen/ViewModel/CommentsRepository.dart';
import 'package:regroup/Main_Screens/Community_HomePage/PostDetailScreen/ViewModel/PostDetailApi.dart';
import 'package:regroup/Main_Screens/Community_HomePage/view_model/communitypostmethod.dart';
import 'package:regroup/Main_Screens/ProfileTab/view_model/profilePostmethod.dart';
import 'package:regroup/Utils/Common/CommonAppbar.dart';
import 'package:regroup/Utils/Common/CustomTextformfield.dart';
import 'package:regroup/Utils/Common/sized_box.dart';
@@ -160,7 +162,7 @@ class _PostDetailsScreenState extends State<PostDetailsScreen> {
};
final data = await Communitypostmethod().postUserSave(updata);
if (data.status == ResponseStatus.SUCCESS) {
PopularpostApi().getPopularPostApi().then((value) {
PostDetailApi().getPostDetail(mainpostid).then((value) {
_initializeData();
setState(() {});
});
@@ -182,7 +184,7 @@ class _PostDetailsScreenState extends State<PostDetailsScreen> {
final data = await SidebarTags().postUserpin(updata);
if (data.status == ResponseStatus.SUCCESS) {
// Get.back();
LatespostApi().getLatestPostApi().then((value) {
PostDetailApi().getPostDetail(mainpostid).then((value) {
_initializeData();
setState(() {});
});
@@ -193,6 +195,27 @@ class _PostDetailsScreenState extends State<PostDetailsScreen> {
}
}
//followunfollow
int? followunfollowid;
FollowUnfollowUploadata() async {
// utils.loader();
Map<String, dynamic> newupdata = {
"following_iam_principal_xid": followunfollowid,
};
final data = await Profilepostmethod().postunfollowuser(newupdata);
if (data.status == ResponseStatus.SUCCESS) {
PostDetailApi().getPostDetail(mainpostid).then((value) {
_initializeData();
setState(() {});
});
} else {
Get.back();
return utils.showToast(data.message);
}
}
List<bool> hideReplies = [];
FutureGroup futureGroup = FutureGroup();
final FocusNode _focusNode = FocusNode();
@@ -204,7 +227,7 @@ class _PostDetailsScreenState extends State<PostDetailsScreen> {
@override
void initState() {
// var postId = Get.arguments['PostId'] ?? '';
mainpostid = Get.arguments['PostId'] ?? '';
mainpostid = Get.arguments['PostId'] ?? '';
futureGroup.add(CommentsRepository().getAllComments(mainpostid));
futureGroup.add(PostDetailApi().getPostDetail(mainpostid));
@@ -237,11 +260,17 @@ class _PostDetailsScreenState extends State<PostDetailsScreen> {
};
final result = await CommentsRepository().postComments(updata);
if (result.status == ResponseStatus.SUCCESS) {
CommentsRepository().getAllComments(mainpostid).then((value) => setState(() {
isOnce = true;
_commentsHelper.isLoading.value = false;
_controllerComments.clear();
}));
CommentsRepository()
.getAllComments(mainpostid)
.then((value) => setState(() {
isOnce = true;
_commentsHelper.isLoading.value = false;
_controllerComments.clear();
}));
PostDetailApi().getPostDetail(mainpostid).then((value) {
_initializeData();
setState(() {});
});
}
}
@@ -254,11 +283,17 @@ class _PostDetailsScreenState extends State<PostDetailsScreen> {
};
final result = await CommentsRepository().postRepliesOnComments(updata);
if (result.status == ResponseStatus.SUCCESS) {
CommentsRepository().getAllComments(mainpostid).then((value) => setState(() {
isOnce = true;
_commentsHelper.isLoading.value = false;
_controllerComments.clear();
}));
CommentsRepository()
.getAllComments(mainpostid)
.then((value) => setState(() {
isOnce = true;
_commentsHelper.isLoading.value = false;
_controllerComments.clear();
}));
PostDetailApi().getPostDetail(mainpostid).then((value) {
_initializeData();
setState(() {});
});
}
}
// _setComments(index) {
@@ -281,9 +316,15 @@ class _PostDetailsScreenState extends State<PostDetailsScreen> {
var updata = {"id": commentId};
final result = await CommentsRepository().deleteComments(updata);
if (result.status == ResponseStatus.SUCCESS) {
CommentsRepository().getAllComments(mainpostid).then((value) => setState(() {
isOnce = true;
}));
CommentsRepository()
.getAllComments(mainpostid)
.then((value) => setState(() {
isOnce = true;
}));
PostDetailApi().getPostDetail(mainpostid).then((value) {
_initializeData();
setState(() {});
});
}
}
@@ -291,9 +332,15 @@ class _PostDetailsScreenState extends State<PostDetailsScreen> {
var updata = {"id": commentId};
final result = await CommentsRepository().deleteRepliedComments(updata);
if (result.status == ResponseStatus.SUCCESS) {
CommentsRepository().getAllComments(mainpostid).then((value) => setState(() {
isOnce = true;
}));
CommentsRepository()
.getAllComments(mainpostid)
.then((value) => setState(() {
isOnce = true;
}));
PostDetailApi().getPostDetail(mainpostid).then((value) {
_initializeData();
setState(() {});
});
}
}
@@ -364,12 +411,13 @@ class _PostDetailsScreenState extends State<PostDetailsScreen> {
mainImg: postDetailData.image ?? "",
tags: tags,
description: postDetailData.caption ?? 'test',
create_at: timeAgo ?? '1 hour',
total_comments: postDetailData.totalCommentCount.toString() ?? '20',
total_likes: postDetailData.totalReactionCount.toString(),
total_save: postDetailData.totalSave.toString() ?? '10',
community_name: postDetailData.community!.communityName ?? 'text',
createAt: timeAgo ?? '1 hour',
totalComments: postDetailData.totalCommentCount.toString() ?? '20',
totalLikes: postDetailData.totalReactionCount.toString(),
totalSave: postDetailData.totalSave.toString() ?? '10',
communityName: postDetailData.community!.communityName ?? 'text',
postId: postDetailData.id.toString(),
UserId: postDetailData.iamPrincipalXid,
mainImagetap: () {
// Get.toNamed(RouteName.postdetailsScreen,
// arguments: {
@@ -386,6 +434,11 @@ class _PostDetailsScreenState extends State<PostDetailsScreen> {
await pinunpinUser(pinPospostid);
},
isUserPinned: postDetailData.iamPrincipal!.isUserPinned,
followTap: () {
followunfollowid = postDetailData.iamPrincipalXid;
FollowUnfollowUploadata();
},
isIamFollowing: postDetailData.isIFollow,
onReactionChangedLike: (reaction) async {
if (selectedReaction != null &&
reaction?.value == selectedReaction.id.toString()) {
@@ -867,7 +920,7 @@ class _PostDetailsScreenState extends State<PostDetailsScreen> {
],
));
}),
sizedBoxHeight(25.h),
sizedBoxHeight(50.h),
])),
Positioned.fill(
top: 625.h - MediaQuery.of(context).viewInsets.bottom,
@@ -888,6 +941,7 @@ class _PostDetailsScreenState extends State<PostDetailsScreen> {
hintText: "Add comment",
suffixIcon: GestureDetector(
onTap: () {
FocusScope.of(context).unfocus();
if (_controllerComments.text.isEmpty) {
print("Enter some text");
} else {
@@ -934,14 +988,18 @@ class PostCardTile extends StatefulWidget {
final String mainImg;
final String description;
final List<ManageTag> tags;
final String community_name;
final String total_comments;
final String total_likes;
final String total_save;
final String? create_at;
final String communityName;
final String totalComments;
final String totalLikes;
final String totalSave;
final String? createAt;
final String? postId;
final int? UserId;
final void Function()? onSaveIconTap;
final void Function()? PinPopupTap;
final void Function()? followTap;
final bool? isIamFollowing;
final bool? isISaved;
final bool? isUserPinned;
@@ -960,17 +1018,20 @@ class PostCardTile extends StatefulWidget {
required this.description,
// required this.containerTitle,
required this.tags,
required this.community_name,
required this.total_comments,
required this.total_likes,
required this.total_save,
required this.communityName,
required this.totalComments,
required this.totalLikes,
required this.totalSave,
// this.commonpostobj,
required this.onReactionChangedLike,
required this.reactionsLike,
required this.selectedReactionLike,
required this.likePopupWidget,
required this.mainImagetap,
this.create_at,
required this.isIamFollowing,
required this.followTap,
required this.UserId,
this.createAt,
this.postId,
this.onSaveIconTap,
this.PinPopupTap,
@@ -1023,14 +1084,34 @@ class _PostCardTileState extends State<PostCardTile> {
children: [
text16w400_FCFCFC(widget.title),
const Spacer(),
commonGlassUI(
width: 72.w,
height: 26.h,
borderRadius: BorderRadius.circular(5.r),
borderColor: const Color(0xFFD90B2E),
customWidget:
Center(child: text14400white("Follow")),
borderwidth: 1),
userIdGlobal == widget.UserId.toString()
? SizedBox()
: GestureDetector(
onTap: widget.followTap,
child: widget.isIamFollowing == false
? commonGlassUI(
width: 72.w,
height: 26.h,
borderRadius:
BorderRadius.circular(5.r),
borderColor:
const Color(0xFFD90B2E),
customWidget: Center(
child:
text14400white("Follow")),
borderwidth: 1)
: commonGlassUI(
width: 120.w,
height: 26.h,
borderRadius:
BorderRadius.circular(5.r),
borderColor:
const Color(0xFFD90B2E),
customWidget: Center(
child:
text14400white("Unfollow")),
borderwidth: 1),
),
sizedBoxWidth(6.w),
PopupMenuButton(
surfaceTintColor: const Color(0xFF222935),
@@ -1141,7 +1222,7 @@ class _PostCardTileState extends State<PostCardTile> {
width: 14.w,
),
sizedBoxWidth(7.w),
text12w400_FCFCFC(widget.community_name),
text12w400_FCFCFC(widget.communityName),
sizedBoxWidth(7.w),
Icon(
Icons.circle,
@@ -1149,7 +1230,7 @@ class _PostCardTileState extends State<PostCardTile> {
size: 4.sp,
),
sizedBoxWidth(6.w),
text12w400_FCFCFC(widget.create_at!),
text12w400_FCFCFC(widget.createAt!),
],
)
],
@@ -1180,6 +1261,7 @@ class _PostCardTileState extends State<PostCardTile> {
child: Column(children: [
SizedBox(
height: 30.h,
width: double.infinity,
child: ListView.builder(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
@@ -1187,7 +1269,7 @@ class _PostCardTileState extends State<PostCardTile> {
itemBuilder: (context, index) {
var manageTag = widget.tags[index];
return Padding(
padding: EdgeInsets.only(right: 12.w),
padding: EdgeInsets.only(right: 12.w, left: 12.w),
child: GestureDetector(
onTap: () {
Get.toNamed(RouteName.tagdetailscreen,
@@ -1211,14 +1293,12 @@ class _PostCardTileState extends State<PostCardTile> {
),
sizedBoxHeight(20.h),
SizedBox(
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text16w400_FCFCFC(widget.description),
],
),
),
height: 100.h,
child: SingleChildScrollView(
child: Align(
alignment: Alignment.centerLeft,
child: text16w400_FCFCFC(widget.description)))),
sizedBoxHeight(20.h),
Row(children: [
InkWell(
onTap: () {
@@ -1227,7 +1307,7 @@ class _PostCardTileState extends State<PostCardTile> {
});
},
child: stackReaction(
number: widget.total_likes,
number: widget.totalLikes,
containerImages: [
'assets/images/png/f7_hand-thumbsup.png',
'assets/images/png/heart 2.png',
@@ -1252,7 +1332,7 @@ class _PostCardTileState extends State<PostCardTile> {
),
),
sizedBoxWidth(12.w),
text14w400_FCFCFC(widget.total_comments),
text14w400_FCFCFC(widget.totalComments),
sizedBoxWidth(20.w),
commonContainer(
width: 30.w,
@@ -1271,7 +1351,7 @@ class _PostCardTileState extends State<PostCardTile> {
),
),
sizedBoxWidth(12.w),
text14w400_FCFCFC(widget.total_save),
text14w400_FCFCFC(widget.totalSave),
]),
sizedBoxHeight(12.h),
commonDivider(),

View File

@@ -114,21 +114,21 @@ class _PostScreenState extends State<PostScreen> {
// }
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
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>
@@ -448,7 +448,7 @@ class _PostScreenState extends State<PostScreen> {
inputFormatters: [
// LengthLimitingTextInputFormatter(20),
RemoveEmojiInputFormatter(),
FilteringTextInputFormatter.allow(RegExp('[a-zA-Z ]'))
// FilteringTextInputFormatter.allow(RegExp('[a-zA-Z ]'))
],
textEditingController: captioncontroller,
),
@@ -461,11 +461,32 @@ class _PostScreenState extends State<PostScreen> {
context,
false,
(result) {
var file = File(result);
if (result != null && result.isNotEmpty) {
var file = File(result);
bannerPath.add(file);
isbannerAdded = true;
setState(() {});
// Check if the file size exceeds 10 MB
int fileSizeInBytes = file.lengthSync();
double fileSizeInMB =
fileSizeInBytes / (1024 * 1024);
if (fileSizeInMB > 10) {
// Show toast message if the file size exceeds 10 MB
utils.showToast(
"The selected file is too large. Max file size is 10 MB.");
} else {
// Clear the existing image and add the new one
bannerPath.clear();
bannerPath.add(file);
isbannerAdded = true;
setState(() {});
}
} else {
// Handle case where no image is selected
bannerPath.clear();
isbannerAdded = false;
setState(() {});
}
if (Platform.isAndroid) {
Get.back();
}
@@ -839,7 +860,6 @@ class _PostScreenState extends State<PostScreen> {
);
});
}
}
class CustomDropDownCheckBoxPostNew extends StatefulWidget {
@@ -1262,7 +1282,6 @@ class _CustomDropDownPopularTagState extends State<CustomDropDownPopularTag> {
}
}
// class CustomDropDownPopularTag extends StatefulWidget {
// final List<Data> tags;
// final Function(List<Data>) onItemSelected;