new tag api done and tag detail screen
This commit is contained in:
@@ -22,7 +22,7 @@ class TextInputField extends StatefulWidget {
|
||||
class _TextInputFieldState extends State<TextInputField> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
height: 46.h,
|
||||
child: TextFormField(
|
||||
@@ -274,7 +274,7 @@ Widget stackContainersGroups({
|
||||
const maxImagesToShow = 3;
|
||||
|
||||
// Calculate the number of images to show and the remaining count
|
||||
final remainingCount = containerImages.length - maxImagesToShow;
|
||||
// final remainingCount = containerImages.length - maxImagesToShow;
|
||||
final imagesToShow = containerImages.take(maxImagesToShow).toList();
|
||||
|
||||
return Row(
|
||||
@@ -304,7 +304,7 @@ Widget stackContainersGroups({
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
: SizedBox(
|
||||
height: 30.h,
|
||||
width: 30.w,
|
||||
),
|
||||
|
||||
@@ -99,6 +99,8 @@ class ApiUrls {
|
||||
|
||||
static const getInvitecommunity = "${baseUrl}fetch-all-invite";
|
||||
|
||||
static const postnewinterest = "${baseUrl}store-tags";
|
||||
|
||||
static const postcancelrequest = "${baseUrl}cancel-request-of-community";
|
||||
|
||||
static const postacceptinvite = "${baseUrl}accept-invite-to-join-community";
|
||||
|
||||
662
lib/Common/controller/NormalPostCard.dart
Normal file
662
lib/Common/controller/NormalPostCard.dart
Normal file
@@ -0,0 +1,662 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_reaction_button/flutter_reaction_button.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:regroup/Common/CommonGlassmorphism.dart';
|
||||
import 'package:regroup/Common/CommonWidget.dart';
|
||||
import 'package:regroup/Common/base_manager.dart';
|
||||
import 'package:regroup/Main_Screens/Community/Model/CommonDatumObjModel.dart';
|
||||
import 'package:regroup/Main_Screens/Community/Model/fetchicons.dart';
|
||||
import 'package:regroup/Main_Screens/Community/ViewModel/postmethod.dart';
|
||||
import 'package:regroup/Main_Screens/Community_HomePage/view_model/CountersHelper.dart';
|
||||
import 'package:regroup/Main_Screens/Community_HomePage/view_model/communitypostmethod.dart';
|
||||
import 'package:regroup/Utils/Common/sized_box.dart';
|
||||
import 'package:regroup/Utils/dialogs.dart';
|
||||
import 'package:regroup/Utils/texts.dart';
|
||||
import 'package:regroup/resources/routes/route_name.dart';
|
||||
import 'package:regroup/sidemenu/view_model/postmethod.dart';
|
||||
|
||||
class NormalCardTile extends StatefulWidget {
|
||||
List<ManageTagPopular> tags;
|
||||
String? createAt;
|
||||
CommonDatumObjModelData commonObj;
|
||||
String forWhichTab;
|
||||
List<ReactionData> reactions;
|
||||
Map<int, ReactionData?> selectedReactions;
|
||||
bool? coachbool;
|
||||
|
||||
int currentIndex;
|
||||
NormalCardTile({
|
||||
Key? key,
|
||||
required this.tags,
|
||||
this.createAt,
|
||||
required this.forWhichTab,
|
||||
required this.commonObj,
|
||||
required this.reactions,
|
||||
required this.selectedReactions,
|
||||
required this.currentIndex,
|
||||
this.coachbool
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_NormalCardTileState createState() => _NormalCardTileState();
|
||||
}
|
||||
|
||||
class _NormalCardTileState extends State<NormalCardTile> {
|
||||
|
||||
RxString mainImage = 'assets/images/png/uiw_like-o.png'.obs;
|
||||
final CountersHelper countersHelper = Get.find<CountersHelper>();
|
||||
int saveCount = 0;
|
||||
_handleReactionChange(Reaction<String>? reaction) async {
|
||||
if (widget.selectedReactions[widget.commonObj.id] != null &&
|
||||
reaction?.value ==
|
||||
widget.selectedReactions[widget.commonObj.id]!.id.toString() ||
|
||||
reaction?.value == null) {
|
||||
// User tapped on the currently selected reaction, so remove it
|
||||
|
||||
//api call for dislike
|
||||
|
||||
await LikeUploaddata(
|
||||
widget.selectedReactions[widget.commonObj.id]?.id,
|
||||
widget.commonObj.id!,
|
||||
);
|
||||
setState(() {
|
||||
widget.selectedReactions[widget.commonObj.id!] = null;
|
||||
//decrement gloally
|
||||
countersHelper.likesCounterPopular[widget.currentIndex]--;
|
||||
log("global value ${countersHelper.likesCounterPopular[widget.currentIndex]}");
|
||||
});
|
||||
} else {
|
||||
// User selected a new reaction
|
||||
var newSelectedReaction = widget.reactions.firstWhere(
|
||||
(r) => r.id.toString() == reaction?.value,
|
||||
orElse: () => widget.reactions.first, // Default reaction if not found
|
||||
);
|
||||
await _handleReactionChangeApiCall(
|
||||
newSelectedReaction, widget.commonObj.id!);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _handleReactionChangeApiCall(
|
||||
ReactionData? reaction, int postId) async {
|
||||
setState(() {
|
||||
widget.selectedReactions[postId] =
|
||||
reaction; // Set the selected reaction for this post
|
||||
|
||||
if (countersHelper.likesCounterPopular[widget.currentIndex] <=
|
||||
widget.commonObj.totalReactionCount!) {
|
||||
countersHelper.likesCounterPopular[widget.currentIndex]++;
|
||||
}
|
||||
});
|
||||
|
||||
await LikeUploaddata(
|
||||
reaction?.id,
|
||||
postId,
|
||||
);
|
||||
}
|
||||
|
||||
LikeUploaddata(int? likeIconId, int? postid) async {
|
||||
Map<String, dynamic> updata = {
|
||||
"manage_posts_xid": postid,
|
||||
"like_icons_xid": likeIconId ?? '',
|
||||
};
|
||||
final data = await CommunitypostMethod().postLikepost(updata);
|
||||
if (data.status == ResponseStatus.SUCCESS) {
|
||||
// return utils.showToast(data.message);
|
||||
} else {
|
||||
return utils.showToast(data.message);
|
||||
}
|
||||
}
|
||||
|
||||
void updateImage(String reaction) {
|
||||
switch (reaction) {
|
||||
case 'like':
|
||||
mainImage.value = 'assets/images/png/f7_hand-thumbsup.png';
|
||||
break;
|
||||
case 'heart':
|
||||
mainImage.value = 'assets/images/png/heart 2.png';
|
||||
break;
|
||||
case 'party':
|
||||
mainImage.value = 'assets/images/png/party-popper 2.png';
|
||||
break;
|
||||
default:
|
||||
// Handle any other cases or do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
saveunsavepost(int popularpostid) async {
|
||||
// utils.loader();
|
||||
Map<String, dynamic> updata = {
|
||||
"manage_posts_xid": popularpostid,
|
||||
};
|
||||
final data = await Communitypostmethod().postUserSave(updata);
|
||||
if (data.status == ResponseStatus.SUCCESS) {
|
||||
if (countersHelper.saveButtonPopular[widget.currentIndex] == false) {
|
||||
countersHelper.savePostCounterPopular[widget.currentIndex]++;
|
||||
} else {
|
||||
countersHelper.savePostCounterPopular[widget.currentIndex]--;
|
||||
}
|
||||
countersHelper.saveButtonPopular[widget.currentIndex] =
|
||||
!countersHelper.saveButtonPopular[widget.currentIndex];
|
||||
return utils.showToast(data.message);
|
||||
} else {
|
||||
return utils.showToast(data.message);
|
||||
}
|
||||
}
|
||||
|
||||
pinunpinUser(int userid) async {
|
||||
Map<String, dynamic> updata = {
|
||||
"pin_iam_principal_xid": userid,
|
||||
};
|
||||
final data = await SidebarTags().postUserpin(updata);
|
||||
if (data.status == ResponseStatus.SUCCESS) {
|
||||
countersHelper.pinButtonPopular[widget.currentIndex] =
|
||||
!countersHelper.pinButtonPopular[widget.currentIndex];
|
||||
countersHelper.updateFeedsPage.value =
|
||||
!countersHelper.updateFeedsPage.value;
|
||||
return utils.showToast(data.message);
|
||||
} else {
|
||||
return utils.showToast(data.message);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var imgUrl = widget.commonObj.image!
|
||||
.split(
|
||||
"https://regroup.betadelivery.com/storage/app/public/uploads/post_image/")
|
||||
.last;
|
||||
return commonGlassUI(
|
||||
width: double.infinity,
|
||||
height: 765.h,
|
||||
mainOpacity: 1,
|
||||
borderRadius: BorderRadius.circular(1),
|
||||
customWidget: Column(
|
||||
children: [
|
||||
sizedBoxHeight(25.h),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
backgroundImage: widget
|
||||
.commonObj.iamPrincipal?.profilePhoto !=
|
||||
null
|
||||
? NetworkImage(
|
||||
widget.commonObj.iamPrincipal!.profilePhoto!)
|
||||
as ImageProvider<Object>
|
||||
: const AssetImage('assets/images/default_profile.png')
|
||||
as ImageProvider<Object>,
|
||||
radius: 25.r,
|
||||
),
|
||||
sizedBoxWidth(12.w),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
text16w400_FCFCFC(
|
||||
widget.commonObj.iamPrincipal!.fullName ??
|
||||
"Regroup"),
|
||||
sizedBoxWidth(10.w),
|
||||
widget.coachbool == true
|
||||
? Container(
|
||||
width: 75.w,
|
||||
height: 25.h,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: const Color(0xFFD90B2E),
|
||||
width: 1.w,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.r),
|
||||
),
|
||||
child:
|
||||
Center(child: text12w400_FCFCFC("Coach")),
|
||||
)
|
||||
: const SizedBox(),
|
||||
],
|
||||
),
|
||||
sizedBoxHeight(5.h),
|
||||
Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/png/community 1 (traced).png',
|
||||
height: 14.w,
|
||||
width: 14.w,
|
||||
),
|
||||
sizedBoxWidth(7.w),
|
||||
text12w400_FCFCFC(
|
||||
widget.commonObj.community!.communityName ?? ""),
|
||||
sizedBoxWidth(7.w),
|
||||
Icon(
|
||||
Icons.circle,
|
||||
color: const Color(0xFFFCFCFC),
|
||||
size: 4.sp,
|
||||
),
|
||||
sizedBoxWidth(6.w),
|
||||
text12w400_FCFCFC(widget.createAt!),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
PopupMenuButton(
|
||||
surfaceTintColor: const Color(0xFF222935),
|
||||
constraints: BoxConstraints.tightFor(width: 176.w),
|
||||
offset: const Offset(0, 50),
|
||||
color: const Color(0xFF222935),
|
||||
tooltip: "",
|
||||
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
||||
PopupMenuItem(
|
||||
onTap: () {},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.w),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'Report Post',
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontFamily: "Nunito Sans",
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Image.asset(
|
||||
"assets/images/png/Vector (5).png",
|
||||
height: 15.h,
|
||||
width: 15.w,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const PopupMenuDivider(),
|
||||
PopupMenuItem(
|
||||
onTap: () {},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.w),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'Share post',
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontFamily: "Nunito Sans",
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Image.asset(
|
||||
"assets/images/png/share.png",
|
||||
height: 20.h,
|
||||
width: 20.w,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const PopupMenuDivider(),
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
pinunpinUser(widget.commonObj.iamPrincipal!.id!);
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.w),
|
||||
child: Row(
|
||||
children: [
|
||||
countersHelper.pinButtonPopular[widget.currentIndex]
|
||||
? Text(
|
||||
'Unpin',
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontFamily: "Nunito Sans",
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'Pin',
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontFamily: "Nunito Sans",
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
countersHelper
|
||||
.pinButtonPopular[widget.currentIndex]
|
||||
? Image.asset(
|
||||
"assets/images/png/PinnedIcon.png",
|
||||
height: 25.h,
|
||||
width: 25.w,
|
||||
)
|
||||
: Image.asset(
|
||||
"assets/images/png/f7_pin-fill (2).png",
|
||||
height: 25.h,
|
||||
width: 25.w,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
child: Image.asset(
|
||||
'assets/images/png/Group 1000004071.png',
|
||||
width: 16.w,
|
||||
height: 18.h,
|
||||
),
|
||||
),
|
||||
sizedBoxWidth(5.w)
|
||||
],
|
||||
),
|
||||
),
|
||||
sizedBoxHeight(20.h),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
bool result = await Get.toNamed(RouteName.postdetailsScreen,
|
||||
arguments: {
|
||||
'postId': widget.commonObj.id,
|
||||
'tagsList': widget.tags,
|
||||
'created_at': widget.createAt,
|
||||
'commonObj': widget.commonObj,
|
||||
'fromWhichTab': widget.forWhichTab,
|
||||
'reactions': widget.reactions,
|
||||
'selectedReactions': widget.selectedReactions,
|
||||
'currentIndex': widget.currentIndex
|
||||
});
|
||||
if (result) {
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
child: SizedBox(
|
||||
height: 360,
|
||||
width: double.infinity,
|
||||
child: CachedNetworkImage(
|
||||
cacheKey: imgUrl,
|
||||
imageUrl: widget.commonObj.image!,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context, url) => const Center(
|
||||
child:
|
||||
CircularProgressIndicator()), // Optional: shows a loading indicator while the image is loading
|
||||
errorWidget: (context, url, error) => const Center(
|
||||
child: Icon(Icons
|
||||
.error)), // Optional: shows an error icon if the image fails to load
|
||||
),
|
||||
)),
|
||||
sizedBoxHeight(20.h),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
child: Column(children: [
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
shrinkWrap: true,
|
||||
itemCount: widget.tags.length,
|
||||
itemBuilder: (context, index) {
|
||||
var manageTag = widget.tags[index];
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(right: 12.w),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.tagdetailscreen, arguments: {
|
||||
'tagid': manageTag.id,
|
||||
'tagname': manageTag.name,
|
||||
'ispinnedtag': manageTag.isPinned,
|
||||
});
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
commonContainer(
|
||||
width: 130.w,
|
||||
height: 30.h,
|
||||
borderRadius: BorderRadius.circular(30.r),
|
||||
borderColor: const Color(0xFFD90B2E),
|
||||
opacity1: 0.04,
|
||||
opacity2: 0.05,
|
||||
customWidget: Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 10.w),
|
||||
child: Center(
|
||||
child: text14w400_FCFCFC(
|
||||
'#${manageTag.name}',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
sizedBoxHeight(20.h),
|
||||
SizedBox(
|
||||
height: 80.h,
|
||||
width: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: text16w400_FCFCFC(widget.commonObj.caption ?? "")),
|
||||
),
|
||||
sizedBoxHeight(20.h),
|
||||
Row(children: [
|
||||
Obx(
|
||||
() => InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.reactionview, arguments: {
|
||||
'postId': widget.commonObj.id,
|
||||
});
|
||||
},
|
||||
child: stackReaction(
|
||||
number: countersHelper
|
||||
.likesCounterPopular[widget.currentIndex]
|
||||
.toString(),
|
||||
containerImages: [
|
||||
'assets/images/png/f7_hand-thumbsup.png',
|
||||
'assets/images/png/heart 2.png',
|
||||
'assets/images/png/party-popper 2.png'
|
||||
]),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
commonContainer(
|
||||
width: 30.w,
|
||||
height: 30.h,
|
||||
borderColor: const Color(0xFF434A53),
|
||||
borderwidth: 0.43,
|
||||
opacity1: 0.2,
|
||||
opacity2: 0.2,
|
||||
boxShape: BoxShape.circle,
|
||||
customWidget: Center(
|
||||
child: Image.asset(
|
||||
'assets/images/png/Frame 1000004088.png',
|
||||
height: 13.h,
|
||||
width: 13.w,
|
||||
),
|
||||
),
|
||||
),
|
||||
sizedBoxWidth(12.w),
|
||||
text14w400_FCFCFC(
|
||||
widget.commonObj.totalCommentCount.toString()),
|
||||
sizedBoxWidth(20.w),
|
||||
commonContainer(
|
||||
width: 30.w,
|
||||
height: 30.h,
|
||||
borderColor: const Color(0xFF434A53),
|
||||
borderwidth: 0.43,
|
||||
opacity1: 0.2,
|
||||
opacity2: 0.2,
|
||||
boxShape: BoxShape.circle,
|
||||
customWidget: Center(
|
||||
child: Image.asset(
|
||||
'assets/images/png/Vector (1).png',
|
||||
height: 12.h,
|
||||
width: 12.w,
|
||||
),
|
||||
),
|
||||
),
|
||||
sizedBoxWidth(12.w),
|
||||
Obx(
|
||||
() => text14w400_FCFCFC(countersHelper
|
||||
.savePostCounterPopular[widget.currentIndex]
|
||||
.toString()),
|
||||
),
|
||||
]),
|
||||
sizedBoxHeight(12.h),
|
||||
commonDivider(),
|
||||
sizedBoxHeight(12.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
ReactionButton<String>(
|
||||
onReactionChanged: (reaction) async {
|
||||
_handleReactionChange(reaction);
|
||||
},
|
||||
reactions: widget.reactions
|
||||
.map((reaction) => Reaction<String>(
|
||||
value: reaction.id.toString(),
|
||||
previewIcon: Image.network(reaction.image,
|
||||
width: 24,
|
||||
height: 24,
|
||||
fit: BoxFit.cover),
|
||||
icon: Image.network(reaction.image,
|
||||
width: 24,
|
||||
height: 24,
|
||||
fit: BoxFit.cover),
|
||||
))
|
||||
.toList(),
|
||||
selectedReaction: widget
|
||||
.selectedReactions[widget.commonObj.id] !=
|
||||
null
|
||||
? Reaction<String>(
|
||||
value: widget
|
||||
.selectedReactions[widget.commonObj.id]!
|
||||
.id
|
||||
.toString(),
|
||||
icon: Image.network(
|
||||
widget
|
||||
.selectedReactions[widget.commonObj.id]!
|
||||
.image,
|
||||
width: 24,
|
||||
height: 24,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
boxColor: Colors.white,
|
||||
boxElevation: 9,
|
||||
boxRadius: 30,
|
||||
itemsSpacing: 20,
|
||||
itemScale: 0.3,
|
||||
itemSize: const Size(30, 30),
|
||||
boxPadding: const EdgeInsets.all(8),
|
||||
boxAnimationDuration:
|
||||
const Duration(milliseconds: 200),
|
||||
itemAnimationDuration:
|
||||
const Duration(milliseconds: 500),
|
||||
hoverDuration: const Duration(milliseconds: 700),
|
||||
child: widget
|
||||
.selectedReactions[widget.commonObj.id] !=
|
||||
null
|
||||
? Image.network(
|
||||
widget.selectedReactions[widget.commonObj.id]!
|
||||
.image,
|
||||
width: 24,
|
||||
height: 24,
|
||||
fit: BoxFit.cover,
|
||||
)
|
||||
: Image.asset(
|
||||
'assets/images/png/uiw_like-o.png',
|
||||
width: 24,
|
||||
height: 24,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
sizedBoxHeight(8.h),
|
||||
text11w400_FCFCFC('Like'),
|
||||
],
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
bool result = await Get.toNamed(
|
||||
RouteName.postdetailsScreen,
|
||||
arguments: {
|
||||
'postId': widget.commonObj.id,
|
||||
'tagsList': widget.tags,
|
||||
'created_at': widget.createAt,
|
||||
'commonObj': widget.commonObj,
|
||||
'fromWhichTab': widget.forWhichTab,
|
||||
'reactions': widget.reactions,
|
||||
'selectedReactions': widget.selectedReactions,
|
||||
'currentIndex': widget.currentIndex
|
||||
});
|
||||
if (result) {
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/png/Frame 1000004088.png',
|
||||
height: 19.h,
|
||||
width: 19.w,
|
||||
),
|
||||
sizedBoxHeight(8.h),
|
||||
text11w400_FCFCFC('Comment')
|
||||
],
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => Column(
|
||||
//here
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () async =>
|
||||
await saveunsavepost(widget.commonObj.id!),
|
||||
child: countersHelper
|
||||
.saveButtonPopular[widget.currentIndex]
|
||||
? Image.asset(
|
||||
'assets/images/png/postSaved.png',
|
||||
height: 19.h,
|
||||
width: 19.w,
|
||||
)
|
||||
: Image.asset(
|
||||
'assets/images/png/Frame 1000004089.png',
|
||||
height: 19.h,
|
||||
width: 19.w,
|
||||
),
|
||||
),
|
||||
sizedBoxHeight(8.h),
|
||||
text11w400_FCFCFC('Save')
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
sizedBoxHeight(12.h),
|
||||
commonDivider(),
|
||||
sizedBoxHeight(12.h),
|
||||
]),
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -47,15 +47,13 @@ class NetworkApiServices {
|
||||
: Options(
|
||||
headers: {
|
||||
'authorization': basicAuth,
|
||||
'access-token':
|
||||
token
|
||||
'access-token': token
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
on Exception catch (e) {
|
||||
} on Exception catch (e) {
|
||||
// log(e.toString());
|
||||
if (e is DioException) {
|
||||
if (e is DioException) {
|
||||
log(e.response.toString());
|
||||
if (e.response == null) {
|
||||
return ResponseData<dynamic>(
|
||||
@@ -75,7 +73,6 @@ class NetworkApiServices {
|
||||
ResponseStatus.FAILED,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
if (e.response!.statusCode == 403) {
|
||||
if (e.response!.data['message'] is List) {
|
||||
@@ -212,9 +209,7 @@ class NetworkApiServices {
|
||||
},
|
||||
)
|
||||
: Options(
|
||||
headers: {'authorization': basicAuth, 'access-token':
|
||||
token
|
||||
},
|
||||
headers: {'authorization': basicAuth, 'access-token': token},
|
||||
),
|
||||
);
|
||||
log(response.toString());
|
||||
@@ -250,6 +245,10 @@ class NetworkApiServices {
|
||||
return ResponseData<dynamic>(
|
||||
e.response!.data['message'][0]!, ResponseStatus.FAILED,
|
||||
data: e.response!.data);
|
||||
} else if (e.response!.data['message']['name'] is List) {
|
||||
return ResponseData<dynamic>(
|
||||
e.response!.data['message']['name'][0]!, ResponseStatus.FAILED,
|
||||
data: e.response!.data);
|
||||
} else {
|
||||
return ResponseData<dynamic>(
|
||||
e.response!.data['message'], ResponseStatus.FAILED,
|
||||
|
||||
@@ -22,7 +22,6 @@ import 'package:regroup/resources/routes/route_name.dart';
|
||||
import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:async/src/future_group.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class AddTimeline extends StatefulWidget {
|
||||
const AddTimeline({super.key});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'dart:developer';
|
||||
|
||||
|
||||
import 'package:regroup/Common/api_urls.dart';
|
||||
import 'package:regroup/Common/base_manager.dart';
|
||||
|
||||
@@ -3,17 +3,14 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:async/src/future_group.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_reaction_button/flutter_reaction_button.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:regroup/Common/CommonBottomNavigationBar.dart';
|
||||
import 'package:regroup/Common/CommonGlassmorphism.dart';
|
||||
import 'package:regroup/Common/CommonTabBar.dart';
|
||||
import 'package:regroup/Common/CommonWidget.dart';
|
||||
import 'package:regroup/Common/ConvertServerDateToUserDate.dart';
|
||||
import 'package:regroup/Common/base_manager.dart';
|
||||
import 'package:regroup/Common/controller/NormalPostCard.dart';
|
||||
import 'package:regroup/Common/controller/MainScreen.dart';
|
||||
import 'package:regroup/Main_Screens/Community/Model/CommonDatumObjModel.dart';
|
||||
import 'package:regroup/Main_Screens/Community/Model/FeedPostModel.dart'
|
||||
@@ -25,17 +22,13 @@ import 'package:regroup/Main_Screens/Community/ViewModel/FeedPost.dart';
|
||||
import 'package:regroup/Main_Screens/Community/ViewModel/LatestPost.dart';
|
||||
import 'package:regroup/Main_Screens/Community/ViewModel/PopularPost.dart';
|
||||
import 'package:regroup/Main_Screens/Community/ViewModel/getmethod.dart';
|
||||
import 'package:regroup/Main_Screens/Community/ViewModel/postmethod.dart';
|
||||
import 'package:regroup/Main_Screens/Community_HomePage/PostDetailScreen/View/ReactionView.dart';
|
||||
import 'package:regroup/Main_Screens/Community_HomePage/view_model/communitypostmethod.dart';
|
||||
import 'package:regroup/Utils/Common/ShimmerCommon.dart';
|
||||
// import 'package:regroup/Feed%20Module/sidemenu/sidemenu.dart';
|
||||
import 'package:regroup/Utils/Common/sized_box.dart';
|
||||
import 'package:regroup/Utils/dialogs.dart';
|
||||
import 'package:regroup/Utils/texts.dart';
|
||||
import 'package:regroup/resources/routes/route_name.dart';
|
||||
import 'package:regroup/sidemenu/sidemenu.dart';
|
||||
import 'package:regroup/sidemenu/view_model/postmethod.dart';
|
||||
|
||||
import 'view_model/CountersHelper.dart';
|
||||
|
||||
@@ -387,7 +380,7 @@ class _FeedTabState extends State<FeedTab> {
|
||||
children: [
|
||||
NormalCardTile(
|
||||
tags: _sortTags(index),
|
||||
create_at: timeAgo ?? '1 hour',
|
||||
createAt: timeAgo ?? '1 hour',
|
||||
commonObj:
|
||||
commonobjmodel!.data[index],
|
||||
forWhichTab: 'feed',
|
||||
@@ -475,7 +468,7 @@ class _FeedTabState extends State<FeedTab> {
|
||||
children: [
|
||||
NormalCardTile(
|
||||
tags: _sortTags(index),
|
||||
create_at: timeAgo ?? '1 hour',
|
||||
createAt: timeAgo ?? '1 hour',
|
||||
commonObj:
|
||||
commonobjmodel!.data[index],
|
||||
forWhichTab: 'feed',
|
||||
@@ -503,624 +496,8 @@ class _FeedTabState extends State<FeedTab> {
|
||||
}
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class NormalCardTile extends StatefulWidget {
|
||||
List<ManageTagPopular> tags;
|
||||
String? create_at;
|
||||
CommonDatumObjModelData commonObj;
|
||||
String forWhichTab;
|
||||
List<ReactionData> reactions;
|
||||
Map<int, ReactionData?> selectedReactions;
|
||||
|
||||
int currentIndex;
|
||||
NormalCardTile({
|
||||
Key? key,
|
||||
required this.tags,
|
||||
this.create_at,
|
||||
required this.forWhichTab,
|
||||
required this.commonObj,
|
||||
required this.reactions,
|
||||
required this.selectedReactions,
|
||||
required this.currentIndex,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_NormalCardTileState createState() => _NormalCardTileState();
|
||||
}
|
||||
|
||||
class _NormalCardTileState extends State<NormalCardTile> {
|
||||
RxString mainImage = 'assets/images/png/uiw_like-o.png'.obs;
|
||||
final CountersHelper countersHelper = Get.find<CountersHelper>();
|
||||
int saveCount = 0;
|
||||
_handleReactionChange(Reaction<String>? reaction) async {
|
||||
if (widget.selectedReactions[widget.commonObj.id] != null &&
|
||||
reaction?.value ==
|
||||
widget.selectedReactions[widget.commonObj.id]!.id.toString() ||
|
||||
reaction?.value == null) {
|
||||
// User tapped on the currently selected reaction, so remove it
|
||||
|
||||
//api call for dislike
|
||||
|
||||
await LikeUploaddata(
|
||||
widget.selectedReactions[widget.commonObj.id]?.id,
|
||||
widget.commonObj.id!,
|
||||
);
|
||||
setState(() {
|
||||
widget.selectedReactions[widget.commonObj.id!] = null;
|
||||
//decrement gloally
|
||||
countersHelper.likesCounterPopular[widget.currentIndex]--;
|
||||
log("global value ${countersHelper.likesCounterPopular[widget.currentIndex]}");
|
||||
});
|
||||
} else {
|
||||
// User selected a new reaction
|
||||
var newSelectedReaction = widget.reactions.firstWhere(
|
||||
(r) => r.id.toString() == reaction?.value,
|
||||
orElse: () => widget.reactions.first, // Default reaction if not found
|
||||
);
|
||||
await _handleReactionChangeApiCall(
|
||||
newSelectedReaction, widget.commonObj.id!);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _handleReactionChangeApiCall(
|
||||
ReactionData? reaction, int postId) async {
|
||||
setState(() {
|
||||
widget.selectedReactions[postId] =
|
||||
reaction; // Set the selected reaction for this post
|
||||
|
||||
if (countersHelper.likesCounterPopular[widget.currentIndex] <=
|
||||
widget.commonObj.totalReactionCount!) {
|
||||
countersHelper.likesCounterPopular[widget.currentIndex]++;
|
||||
}
|
||||
});
|
||||
|
||||
await LikeUploaddata(
|
||||
reaction?.id,
|
||||
postId,
|
||||
);
|
||||
}
|
||||
|
||||
LikeUploaddata(int? likeIconId, int? postid) async {
|
||||
Map<String, dynamic> updata = {
|
||||
"manage_posts_xid": postid,
|
||||
"like_icons_xid": likeIconId ?? '',
|
||||
};
|
||||
final data = await CommunitypostMethod().postLikepost(updata);
|
||||
if (data.status == ResponseStatus.SUCCESS) {
|
||||
// return utils.showToast(data.message);
|
||||
} else {
|
||||
return utils.showToast(data.message);
|
||||
}
|
||||
}
|
||||
|
||||
void updateImage(String reaction) {
|
||||
switch (reaction) {
|
||||
case 'like':
|
||||
mainImage.value = 'assets/images/png/f7_hand-thumbsup.png';
|
||||
break;
|
||||
case 'heart':
|
||||
mainImage.value = 'assets/images/png/heart 2.png';
|
||||
break;
|
||||
case 'party':
|
||||
mainImage.value = 'assets/images/png/party-popper 2.png';
|
||||
break;
|
||||
default:
|
||||
// Handle any other cases or do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
saveunsavepost(int popularpostid) async {
|
||||
// utils.loader();
|
||||
Map<String, dynamic> updata = {
|
||||
"manage_posts_xid": popularpostid,
|
||||
};
|
||||
final data = await Communitypostmethod().postUserSave(updata);
|
||||
if (data.status == ResponseStatus.SUCCESS) {
|
||||
if (countersHelper.saveButtonPopular[widget.currentIndex] == false) {
|
||||
countersHelper.savePostCounterPopular[widget.currentIndex]++;
|
||||
} else {
|
||||
countersHelper.savePostCounterPopular[widget.currentIndex]--;
|
||||
}
|
||||
countersHelper.saveButtonPopular[widget.currentIndex] =
|
||||
!countersHelper.saveButtonPopular[widget.currentIndex];
|
||||
return utils.showToast(data.message);
|
||||
} else {
|
||||
return utils.showToast(data.message);
|
||||
}
|
||||
}
|
||||
|
||||
pinunpinUser(int userid) async {
|
||||
Map<String, dynamic> updata = {
|
||||
"pin_iam_principal_xid": userid,
|
||||
};
|
||||
final data = await SidebarTags().postUserpin(updata);
|
||||
if (data.status == ResponseStatus.SUCCESS) {
|
||||
countersHelper.pinButtonPopular[widget.currentIndex] =
|
||||
!countersHelper.pinButtonPopular[widget.currentIndex];
|
||||
countersHelper.updateFeedsPage.value =
|
||||
!countersHelper.updateFeedsPage.value;
|
||||
return utils.showToast(data.message);
|
||||
} else {
|
||||
return utils.showToast(data.message);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var imgUrl = widget.commonObj.image!
|
||||
.split(
|
||||
"https://regroup.betadelivery.com/storage/app/public/uploads/post_image/")
|
||||
.last;
|
||||
return commonGlassUI(
|
||||
width: double.infinity,
|
||||
height: 765.h,
|
||||
mainOpacity: 1,
|
||||
borderRadius: BorderRadius.circular(1),
|
||||
customWidget: Column(
|
||||
children: [
|
||||
sizedBoxHeight(25.h),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
backgroundImage: widget
|
||||
.commonObj.iamPrincipal?.profilePhoto !=
|
||||
null
|
||||
? NetworkImage(
|
||||
widget.commonObj.iamPrincipal!.profilePhoto!)
|
||||
as ImageProvider<Object>
|
||||
: const AssetImage('assets/images/default_profile.png')
|
||||
as ImageProvider<Object>,
|
||||
radius: 25.r,
|
||||
),
|
||||
sizedBoxWidth(12.w),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
text16w400_FCFCFC(
|
||||
widget.commonObj.iamPrincipal!.fullName ?? "Regroup"),
|
||||
sizedBoxHeight(5.h),
|
||||
Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/png/community 1 (traced).png',
|
||||
height: 14.w,
|
||||
width: 14.w,
|
||||
),
|
||||
sizedBoxWidth(7.w),
|
||||
text12w400_FCFCFC(
|
||||
widget.commonObj.community!.communityName ?? ""),
|
||||
sizedBoxWidth(7.w),
|
||||
Icon(
|
||||
Icons.circle,
|
||||
color: const Color(0xFFFCFCFC),
|
||||
size: 4.sp,
|
||||
),
|
||||
sizedBoxWidth(6.w),
|
||||
text12w400_FCFCFC(widget.create_at!),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
PopupMenuButton(
|
||||
surfaceTintColor: const Color(0xFF222935),
|
||||
constraints: BoxConstraints.tightFor(width: 176.w),
|
||||
offset: const Offset(0, 50),
|
||||
color: const Color(0xFF222935),
|
||||
tooltip: "",
|
||||
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
||||
PopupMenuItem(
|
||||
onTap: () {},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.w),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'Report Post',
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontFamily: "Nunito Sans",
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Image.asset(
|
||||
"assets/images/png/Vector (5).png",
|
||||
height: 15.h,
|
||||
width: 15.w,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const PopupMenuDivider(),
|
||||
PopupMenuItem(
|
||||
onTap: () {},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.w),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'Share post',
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontFamily: "Nunito Sans",
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Image.asset(
|
||||
"assets/images/png/share.png",
|
||||
height: 20.h,
|
||||
width: 20.w,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const PopupMenuDivider(),
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
pinunpinUser(widget.commonObj.iamPrincipal!.id!);
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.w),
|
||||
child: Row(
|
||||
children: [
|
||||
countersHelper
|
||||
.pinButtonPopular[widget.currentIndex]
|
||||
? Text(
|
||||
'Unpin',
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontFamily: "Nunito Sans",
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'Pin',
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontFamily: "Nunito Sans",
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
countersHelper
|
||||
.pinButtonPopular[widget.currentIndex]
|
||||
? Image.asset(
|
||||
"assets/images/png/PinnedIcon.png",
|
||||
height: 25.h,
|
||||
width: 25.w,
|
||||
)
|
||||
: Image.asset(
|
||||
"assets/images/png/f7_pin-fill (2).png",
|
||||
height: 25.h,
|
||||
width: 25.w,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
child: Image.asset(
|
||||
'assets/images/png/Group 1000004071.png',
|
||||
width: 16.w,
|
||||
height: 18.h,
|
||||
),
|
||||
),
|
||||
sizedBoxWidth(5.w)
|
||||
],
|
||||
),
|
||||
),
|
||||
sizedBoxHeight(20.h),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
bool result = await Get.toNamed(RouteName.postdetailsScreen,
|
||||
arguments: {
|
||||
'postId': widget.commonObj.id,
|
||||
'tagsList': widget.tags,
|
||||
'created_at': widget.create_at,
|
||||
'commonObj': widget.commonObj,
|
||||
'fromWhichTab': widget.forWhichTab,
|
||||
'reactions': widget.reactions,
|
||||
'selectedReactions': widget.selectedReactions,
|
||||
'currentIndex': widget.currentIndex
|
||||
});
|
||||
if (result) {
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
child: SizedBox(
|
||||
height: 360,
|
||||
width: double.infinity,
|
||||
child: CachedNetworkImage(
|
||||
cacheKey: imgUrl,
|
||||
imageUrl: widget.commonObj.image!,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context, url) => const Center(
|
||||
child:
|
||||
CircularProgressIndicator()), // Optional: shows a loading indicator while the image is loading
|
||||
errorWidget: (context, url, error) => const Center(
|
||||
child: Icon(Icons
|
||||
.error)), // Optional: shows an error icon if the image fails to load
|
||||
),
|
||||
)),
|
||||
sizedBoxHeight(20.h),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
child: Column(children: [
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
shrinkWrap: true,
|
||||
itemCount: widget.tags.length,
|
||||
itemBuilder: (context, index) {
|
||||
var manageTag = widget.tags[index];
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(right: 12.w),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.tagdetailscreen, arguments: {
|
||||
'tagid': manageTag.id,
|
||||
'tagname': manageTag.name,
|
||||
'ispinnedtag': manageTag.isPinned,
|
||||
});
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
commonContainer(
|
||||
width: 130.w,
|
||||
height: 30.h,
|
||||
borderRadius: BorderRadius.circular(30.r),
|
||||
borderColor: const Color(0xFFD90B2E),
|
||||
opacity1: 0.04,
|
||||
opacity2: 0.05,
|
||||
customWidget: Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 10.w),
|
||||
child: Center(
|
||||
child: text14w400_FCFCFC(
|
||||
'#${manageTag.name}',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
sizedBoxHeight(20.h),
|
||||
SizedBox(
|
||||
height: 80.h,
|
||||
width: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: text16w400_FCFCFC(widget.commonObj.caption ?? "")),
|
||||
),
|
||||
sizedBoxHeight(20.h),
|
||||
Row(children: [
|
||||
Obx(
|
||||
() => InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.reactionview, arguments: {
|
||||
'postId': widget.commonObj.id,
|
||||
});
|
||||
},
|
||||
child: stackReaction(
|
||||
number: countersHelper
|
||||
.likesCounterPopular[widget.currentIndex]
|
||||
.toString(),
|
||||
containerImages: [
|
||||
'assets/images/png/f7_hand-thumbsup.png',
|
||||
'assets/images/png/heart 2.png',
|
||||
'assets/images/png/party-popper 2.png'
|
||||
]),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
commonContainer(
|
||||
width: 30.w,
|
||||
height: 30.h,
|
||||
borderColor: const Color(0xFF434A53),
|
||||
borderwidth: 0.43,
|
||||
opacity1: 0.2,
|
||||
opacity2: 0.2,
|
||||
boxShape: BoxShape.circle,
|
||||
customWidget: Center(
|
||||
child: Image.asset(
|
||||
'assets/images/png/Frame 1000004088.png',
|
||||
height: 13.h,
|
||||
width: 13.w,
|
||||
),
|
||||
),
|
||||
),
|
||||
sizedBoxWidth(12.w),
|
||||
text14w400_FCFCFC(
|
||||
widget.commonObj.totalCommentCount.toString()),
|
||||
sizedBoxWidth(20.w),
|
||||
commonContainer(
|
||||
width: 30.w,
|
||||
height: 30.h,
|
||||
borderColor: const Color(0xFF434A53),
|
||||
borderwidth: 0.43,
|
||||
opacity1: 0.2,
|
||||
opacity2: 0.2,
|
||||
boxShape: BoxShape.circle,
|
||||
customWidget: Center(
|
||||
child: Image.asset(
|
||||
'assets/images/png/Vector (1).png',
|
||||
height: 12.h,
|
||||
width: 12.w,
|
||||
),
|
||||
),
|
||||
),
|
||||
sizedBoxWidth(12.w),
|
||||
Obx(
|
||||
() => text14w400_FCFCFC(countersHelper
|
||||
.savePostCounterPopular[widget.currentIndex]
|
||||
.toString()),
|
||||
),
|
||||
]),
|
||||
sizedBoxHeight(12.h),
|
||||
commonDivider(),
|
||||
sizedBoxHeight(12.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
ReactionButton<String>(
|
||||
onReactionChanged: (reaction) async {
|
||||
_handleReactionChange(reaction);
|
||||
},
|
||||
reactions: widget.reactions
|
||||
.map((reaction) => Reaction<String>(
|
||||
value: reaction.id.toString(),
|
||||
previewIcon: Image.network(reaction.image,
|
||||
width: 24,
|
||||
height: 24,
|
||||
fit: BoxFit.cover),
|
||||
icon: Image.network(reaction.image,
|
||||
width: 24,
|
||||
height: 24,
|
||||
fit: BoxFit.cover),
|
||||
))
|
||||
.toList(),
|
||||
selectedReaction: widget
|
||||
.selectedReactions[widget.commonObj.id] !=
|
||||
null
|
||||
? Reaction<String>(
|
||||
value: widget
|
||||
.selectedReactions[widget.commonObj.id]!
|
||||
.id
|
||||
.toString(),
|
||||
icon: Image.network(
|
||||
widget
|
||||
.selectedReactions[widget.commonObj.id]!
|
||||
.image,
|
||||
width: 24,
|
||||
height: 24,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
boxColor: Colors.white,
|
||||
boxElevation: 9,
|
||||
boxRadius: 30,
|
||||
itemsSpacing: 20,
|
||||
itemScale: 0.3,
|
||||
itemSize: const Size(30, 30),
|
||||
boxPadding: const EdgeInsets.all(8),
|
||||
boxAnimationDuration:
|
||||
const Duration(milliseconds: 200),
|
||||
itemAnimationDuration:
|
||||
const Duration(milliseconds: 500),
|
||||
hoverDuration: const Duration(milliseconds: 700),
|
||||
child: widget
|
||||
.selectedReactions[widget.commonObj.id] !=
|
||||
null
|
||||
? Image.network(
|
||||
widget.selectedReactions[widget.commonObj.id]!
|
||||
.image,
|
||||
width: 24,
|
||||
height: 24,
|
||||
fit: BoxFit.cover,
|
||||
)
|
||||
: Image.asset(
|
||||
'assets/images/png/uiw_like-o.png',
|
||||
width: 24,
|
||||
height: 24,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
sizedBoxHeight(8.h),
|
||||
text11w400_FCFCFC('Like'),
|
||||
],
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
bool result = await Get.toNamed(
|
||||
RouteName.postdetailsScreen,
|
||||
arguments: {
|
||||
'postId': widget.commonObj.id,
|
||||
'tagsList': widget.tags,
|
||||
'created_at': widget.create_at,
|
||||
'commonObj': widget.commonObj,
|
||||
'fromWhichTab': widget.forWhichTab,
|
||||
'reactions': widget.reactions,
|
||||
'selectedReactions': widget.selectedReactions,
|
||||
'currentIndex': widget.currentIndex
|
||||
});
|
||||
if (result) {
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/png/Frame 1000004088.png',
|
||||
height: 19.h,
|
||||
width: 19.w,
|
||||
),
|
||||
sizedBoxHeight(8.h),
|
||||
text11w400_FCFCFC('Comment')
|
||||
],
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => Column(
|
||||
//here
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () async =>
|
||||
await saveunsavepost(widget.commonObj.id!),
|
||||
child: countersHelper
|
||||
.saveButtonPopular[widget.currentIndex]
|
||||
? Image.asset(
|
||||
'assets/images/png/postSaved.png',
|
||||
height: 19.h,
|
||||
width: 19.w,
|
||||
)
|
||||
: Image.asset(
|
||||
'assets/images/png/Frame 1000004089.png',
|
||||
height: 19.h,
|
||||
width: 19.w,
|
||||
),
|
||||
),
|
||||
sizedBoxHeight(8.h),
|
||||
text11w400_FCFCFC('Save')
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
sizedBoxHeight(12.h),
|
||||
commonDivider(),
|
||||
sizedBoxHeight(12.h),
|
||||
]),
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Widget containertile({required String text}) {
|
||||
return commonGlassContainer(
|
||||
@@ -1334,7 +711,7 @@ class _PopularTabState extends State<PopularTab> {
|
||||
children: [
|
||||
NormalCardTile(
|
||||
tags: _sortTags(index),
|
||||
create_at: timeAgo ?? '1 hour',
|
||||
createAt: timeAgo ?? '1 hour',
|
||||
commonObj: commonobjmodel!.data[index],
|
||||
forWhichTab: 'popular',
|
||||
reactions: _reactions,
|
||||
@@ -1548,7 +925,7 @@ class _LatestTabState extends State<LatestTab> {
|
||||
children: [
|
||||
NormalCardTile(
|
||||
tags: _sortTags(index),
|
||||
create_at: timeAgo ?? '1 hour',
|
||||
createAt: timeAgo ?? '1 hour',
|
||||
commonObj: commonobjmodel!.data[index],
|
||||
forWhichTab: 'latest',
|
||||
reactions: _reactions,
|
||||
|
||||
@@ -34,6 +34,7 @@ class Datum {
|
||||
required this.postIn,
|
||||
required this.caption,
|
||||
required this.image,
|
||||
required this.manageTagsXids,
|
||||
required this.postAs,
|
||||
required this.ctaTitle,
|
||||
required this.ctaLink,
|
||||
@@ -61,6 +62,8 @@ class Datum {
|
||||
final int? postIn;
|
||||
final String? caption;
|
||||
final String? image;
|
||||
final String? manageTagsXids;
|
||||
|
||||
final String? postAs;
|
||||
final String? ctaTitle;
|
||||
final String? ctaLink;
|
||||
@@ -89,6 +92,7 @@ class Datum {
|
||||
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"],
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
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_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_state_manager/get_state_manager.dart';
|
||||
|
||||
import 'package:regroup/Common/base_manager.dart';
|
||||
import 'package:regroup/Common/controller/NormalPostCard.dart';
|
||||
import 'package:regroup/Global.dart';
|
||||
import 'package:regroup/Main_Screens/Community/Model/CommonDatumObjModel.dart';
|
||||
import 'package:regroup/Main_Screens/Community/Model/fetchicons.dart';
|
||||
import 'package:regroup/Main_Screens/Community_HomePage/Community.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/Main_Screens/Community_HomePage/PostDetailScreen/ViewModel/PostDetailApi.dart';
|
||||
@@ -36,7 +31,7 @@ class PostDetailsScreen extends StatefulWidget {
|
||||
class _PostDetailsScreenState extends State<PostDetailsScreen> {
|
||||
int? followunfollowid;
|
||||
|
||||
FollowUnfollowUploadata() async {
|
||||
followUnfollowUploadata() async {
|
||||
// utils.loader();
|
||||
Map<String, dynamic> newupdata = {
|
||||
"following_iam_principal_xid": followunfollowid,
|
||||
@@ -238,7 +233,7 @@ class _PostDetailsScreenState extends State<PostDetailsScreen> {
|
||||
|
||||
NormalCardTile(
|
||||
tags: tags!,
|
||||
create_at: create_at!,
|
||||
createAt: create_at!,
|
||||
commonObj: commonObj!,
|
||||
forWhichTab: formWhichTab!,
|
||||
reactions: reactions!,
|
||||
|
||||
@@ -9,7 +9,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart' hide MultipartFile, FormData;
|
||||
import 'package:regroup/Common/CommonButton.dart';
|
||||
|
||||
import 'package:regroup/Common/CommonGlassmorphism.dart';
|
||||
import 'package:regroup/Common/base_manager.dart';
|
||||
@@ -236,15 +235,15 @@ class _PostScreenState extends State<PostScreen> {
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
backgroundColor: Color(0xFF222935).withOpacity(0.9),
|
||||
title: Text(
|
||||
backgroundColor: const Color(0xFF222935).withOpacity(0.9),
|
||||
title: const Text(
|
||||
"Add Tag",
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
content: TextField(
|
||||
style: TextStyle(color: Colors.white),
|
||||
style: const TextStyle(color: Colors.white),
|
||||
controller: _tagController,
|
||||
decoration: InputDecoration(
|
||||
decoration: const InputDecoration(
|
||||
labelText: "Tag",
|
||||
labelStyle: TextStyle(color: AppColors.white),
|
||||
disabledBorder: UnderlineInputBorder(
|
||||
@@ -261,14 +260,14 @@ class _PostScreenState extends State<PostScreen> {
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text("Cancel", style: TextStyle(color: AppColors.white)),
|
||||
child: const Text("Cancel", style: TextStyle(color: AppColors.white)),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
tagUploadata();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text("Submit", style: TextStyle(color: AppColors.white)),
|
||||
child: const Text("Submit", style: TextStyle(color: AppColors.white)),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -289,10 +288,10 @@ class _PostScreenState extends State<PostScreen> {
|
||||
label:
|
||||
Text('#${tag.name}', style: const TextStyle(color: Colors.white)),
|
||||
backgroundColor: const Color(0xFFD90B2E).withOpacity(0.9),
|
||||
side: BorderSide(color: Colors.black),
|
||||
side: const BorderSide(color: Colors.black),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(30.r),
|
||||
side: BorderSide(width: 1, color: Colors.white)),
|
||||
side: const BorderSide(width: 1, color: Colors.white)),
|
||||
onDeleted: () {
|
||||
setState(() {
|
||||
selectedpopularid.remove(tag.id);
|
||||
@@ -612,10 +611,10 @@ class _PostScreenState extends State<PostScreen> {
|
||||
),
|
||||
],
|
||||
)
|
||||
: SizedBox(),
|
||||
: const SizedBox(),
|
||||
sizedBoxHeight(25.h),
|
||||
globalAccountType == '1'
|
||||
? SizedBox()
|
||||
? const SizedBox()
|
||||
: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -735,8 +734,8 @@ class _PostScreenState extends State<PostScreen> {
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
insetPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 15),
|
||||
contentPadding: EdgeInsets.fromLTRB(24, 8, 24, 24),
|
||||
insetPadding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15),
|
||||
contentPadding: const EdgeInsets.fromLTRB(24, 8, 24, 24),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(14.r))),
|
||||
backgroundColor: const Color(0xFF222935),
|
||||
@@ -1262,10 +1261,10 @@ class _CustomDropDownPopularTagState extends State<CustomDropDownPopularTag> {
|
||||
label: Text('#${tag.name!}',
|
||||
style: const TextStyle(color: Colors.white)),
|
||||
backgroundColor: const Color(0xFFD90B2E).withOpacity(0.9),
|
||||
side: BorderSide(color: Colors.black),
|
||||
side: const BorderSide(color: Colors.black),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(30.r),
|
||||
side: BorderSide(width: 1, color: Colors.white)),
|
||||
side: const BorderSide(width: 1, color: Colors.white)),
|
||||
onDeleted: () {
|
||||
selectedTags.remove(tag);
|
||||
widget.onItemSelected(selectedTags.toList());
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -59,7 +59,7 @@ List<bool> pinButtonPopular = <bool>[];
|
||||
RxList<int> commentsCounterComPosts = <int>[].obs;
|
||||
RxList<int> savePostCounterComPosts = <int>[].obs;
|
||||
RxList<bool> saveButtonComPosts = <bool>[].obs;
|
||||
RxList<bool> pinButtonComPosts = <bool>[].obs;
|
||||
// RxList<bool> pinButtonComPosts = <bool>[].obs;
|
||||
|
||||
setListsComPosts() {
|
||||
likesCounterComPosts.clear();
|
||||
@@ -73,9 +73,35 @@ List<bool> pinButtonPopular = <bool>[];
|
||||
.add(commonobjmodel?.data[i].totalCommentCount ?? 0);
|
||||
savePostCounterComPosts.add(commonobjmodel?.data[i].totalSave ?? 0);
|
||||
saveButtonComPosts.add(commonobjmodel?.data[i].isISaved ?? false);
|
||||
pinButtonComPosts
|
||||
.add(commonobjmodel?.data[i].iamPrincipal?.isUserPinned ?? false);
|
||||
// pinButtonComPosts
|
||||
// .add(commonobjmodel?.data[i].iamPrincipal?.isUserPinned ?? false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//tagPostPopular
|
||||
RxList<int> likesCountertagPopular = <int>[].obs;
|
||||
RxList<int> commentsCountertagPopular = <int>[].obs;
|
||||
RxList<int> savePostCountertagPopular = <int>[].obs;
|
||||
|
||||
setListstagPopular() {
|
||||
for (var i = 0; i < combinedListGlobal.length; i++) {
|
||||
likesCounterLatest.add(combinedListGlobal[i].likecount ?? 0);
|
||||
commentsCounterLatest.add(combinedListGlobal[i].totalCommentCount ?? 0);
|
||||
savePostCounterLatest.add(combinedListGlobal[i].totalSave ?? 0);
|
||||
}
|
||||
}
|
||||
|
||||
//tagPostLatest
|
||||
RxList<int> likesCountertagLatest = <int>[].obs;
|
||||
RxList<int> commentsCountertagLatest = <int>[].obs;
|
||||
RxList<int> savePostCountertagLatest = <int>[].obs;
|
||||
|
||||
setListstagtagLatest() {
|
||||
for (var i = 0; i < combinedListGlobal.length; i++) {
|
||||
likesCounterLatest.add(combinedListGlobal[i].likecount ?? 0);
|
||||
commentsCounterLatest.add(combinedListGlobal[i].totalCommentCount ?? 0);
|
||||
savePostCounterLatest.add(combinedListGlobal[i].totalSave ?? 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'dart:io';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart' hide MultipartFile, FormData;
|
||||
import 'package:regroup/Common/base_manager.dart';
|
||||
@@ -155,7 +154,7 @@ class _AddCertificateState extends State<AddCertificate> {
|
||||
text16400white("Certification name"),
|
||||
sizedBoxHeight(16.h),
|
||||
CustomTextFormField(
|
||||
leadingIcon: Container(
|
||||
leadingIcon: SizedBox(
|
||||
height: 17.h,
|
||||
width: 18.w,
|
||||
child: Center(
|
||||
@@ -186,7 +185,7 @@ class _AddCertificateState extends State<AddCertificate> {
|
||||
text16400white("Certification reason"),
|
||||
sizedBoxHeight(16.h),
|
||||
CustomTextFormField(
|
||||
leadingIcon: Container(
|
||||
leadingIcon: SizedBox(
|
||||
height: 17.h,
|
||||
width: 18.w,
|
||||
child: Center(
|
||||
|
||||
@@ -17,7 +17,7 @@ class EditProfileApi {
|
||||
EditProfileApi();
|
||||
|
||||
Future<ResponseData<dynamic>> postEditProfileIndividual(var data) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
// SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
final response =
|
||||
await NetworkApiServices().postApi(data, ApiUrls.posteditprofile);
|
||||
|
||||
@@ -62,7 +62,7 @@ class EditProfileApi {
|
||||
}
|
||||
|
||||
Future<ResponseData<dynamic>> postEditProfileBusiness(var data) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
// SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
final response = await NetworkApiServices()
|
||||
.postApi(data, ApiUrls.posteditprofilebusiness);
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class _FollowersState extends State<Followers> {
|
||||
int? blockid;
|
||||
int? removeid;
|
||||
|
||||
RemoveUploadata() async {
|
||||
removeUploadata() async {
|
||||
utils.loader();
|
||||
Map<String, dynamic> updata = {
|
||||
"iam_principal_xid": removeid,
|
||||
@@ -85,7 +85,7 @@ class _FollowersState extends State<Followers> {
|
||||
}
|
||||
}
|
||||
|
||||
BlockUploadata() async {
|
||||
blockUploadata() async {
|
||||
utils.loader();
|
||||
Map<String, dynamic> updata = {
|
||||
"blocked_iam_principal_xid": blockid,
|
||||
@@ -334,7 +334,7 @@ class _FollowersState extends State<Followers> {
|
||||
followersobj!.data!.removeWhere((item) =>
|
||||
item.follower!.id ==
|
||||
removeid);
|
||||
RemoveUploadata();
|
||||
removeUploadata();
|
||||
});
|
||||
},
|
||||
child:
|
||||
@@ -399,7 +399,7 @@ class _FollowersState extends State<Followers> {
|
||||
followersobj!.data!.removeWhere((item) =>
|
||||
item.follower!.id ==
|
||||
blockid);
|
||||
BlockUploadata();
|
||||
blockUploadata();
|
||||
});
|
||||
},
|
||||
child:
|
||||
|
||||
@@ -346,6 +346,9 @@ Widget text18w400white(String text, {TextAlign? textAlign}) {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Widget text14w400white(String text, {TextAlign? textAlign}) {
|
||||
return Text(
|
||||
text,
|
||||
|
||||
@@ -68,8 +68,8 @@ import 'package:regroup/onboarding/Signup/View/Business/View/busSignupScreen.dar
|
||||
import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/CommunitySetting.dart';
|
||||
import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/EditCommunity/EditCommunity.dart';
|
||||
import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/ManageGroup.dart';
|
||||
import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/ManageTags.dart/ManageTags.dart';
|
||||
import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/ManageTags.dart/NewTag/NewTag.dart';
|
||||
import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/ManageTags.dart/ManageInterest.dart';
|
||||
import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/ManageTags.dart/View/NewTag/NewTag.dart';
|
||||
import 'package:regroup/sidemenu/Community/Announcements/AnnouncementRequest.dart';
|
||||
import 'package:regroup/sidemenu/Community/Announcements/ManageMembers.dart';
|
||||
import 'package:regroup/sidemenu/Community/Announcements/NewAnnouncement/NewAnnounceent.dart';
|
||||
|
||||
@@ -16,8 +16,7 @@ class CommunitySetting extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _CommunitySettingState extends State<CommunitySetting> {
|
||||
|
||||
int communityid = Get.arguments['communityid'];
|
||||
int communityid = Get.arguments['communityid'];
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -39,11 +38,9 @@ class _CommunitySettingState extends State<CommunitySetting> {
|
||||
sizedBoxHeight(30.h),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.editcommunity,
|
||||
arguments: {
|
||||
'communityid' : communityid,
|
||||
}
|
||||
);
|
||||
Get.toNamed(RouteName.editcommunity, arguments: {
|
||||
'communityid': communityid,
|
||||
});
|
||||
},
|
||||
child: rowTile(text: 'Edit community info')),
|
||||
commonDivider(),
|
||||
@@ -61,9 +58,11 @@ class _CommunitySettingState extends State<CommunitySetting> {
|
||||
commonDivider(),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.managetags);
|
||||
Get.toNamed(RouteName.managetags, arguments: {
|
||||
'communityid': communityid,
|
||||
});
|
||||
},
|
||||
child: rowTile(text: 'Manage tags')),
|
||||
child: rowTile(text: 'Manage interest')),
|
||||
sizedBoxHeight(20.h),
|
||||
])
|
||||
]));
|
||||
|
||||
@@ -19,6 +19,8 @@ class ManageTags extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ManageTagsState extends State<ManageTags> {
|
||||
int communityid = Get.arguments['communityid'];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -26,7 +28,7 @@ class _ManageTagsState extends State<ManageTags> {
|
||||
backgroundColor: Color(0xFF222935),
|
||||
extendBody: true,
|
||||
appBar: CommonAppbar(
|
||||
titleTxt: "Manage tags",
|
||||
titleTxt: "Manage interest",
|
||||
),
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: Stack(children: [
|
||||
@@ -45,7 +47,7 @@ class _ManageTagsState extends State<ManageTags> {
|
||||
child: Column(children: [
|
||||
CommonTabBar(tabs: const [
|
||||
Tab(
|
||||
text: 'Tags',
|
||||
text: 'Interest',
|
||||
),
|
||||
Tab(
|
||||
text: 'Tag requests',
|
||||
@@ -79,7 +81,9 @@ class _ManageTagsState extends State<ManageTags> {
|
||||
),
|
||||
child: FloatingActionButton(
|
||||
onPressed: () {
|
||||
Get.toNamed(RouteName.newtag);
|
||||
Get.toNamed(RouteName.newtag, arguments: {
|
||||
'communityid': communityid,
|
||||
});
|
||||
},
|
||||
backgroundColor: Color(0xFFD90B2E),
|
||||
autofocus: true,
|
||||
@@ -102,7 +106,7 @@ Widget tagsTab() {
|
||||
sizedBoxHeight(25.h),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
child: text16400white("Special Announcement Tags"),
|
||||
child: text16400white("Special Announcement Interest"),
|
||||
),
|
||||
sizedBoxHeight(15.h),
|
||||
ListView.builder(
|
||||
@@ -171,7 +175,7 @@ Widget rowTagRequestTile({
|
||||
child: commonGlassUI(
|
||||
width: double.infinity,
|
||||
height: 60.h,
|
||||
borderRadius: BorderRadius.circular( 10.r),
|
||||
borderRadius: BorderRadius.circular(10.r),
|
||||
customWidget: Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
@@ -183,7 +187,7 @@ Widget rowTagRequestTile({
|
||||
height: 35.h,
|
||||
opacity1: 0.24,
|
||||
opacity2: 0.24,
|
||||
borderRadius: BorderRadius.circular( 100),
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
customWidget: Center(
|
||||
child: Icon(
|
||||
Icons.clear,
|
||||
@@ -1,60 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:regroup/Utils/Common/CommonAppbar.dart';
|
||||
import 'package:regroup/Utils/Common/CustomNextButton.dart';
|
||||
import 'package:regroup/Utils/Common/CustomTextformfield.dart';
|
||||
|
||||
import 'package:regroup/Utils/Common/sized_box.dart';
|
||||
import 'package:regroup/Utils/texts.dart';
|
||||
|
||||
class NewTag extends StatefulWidget {
|
||||
const NewTag({super.key});
|
||||
|
||||
@override
|
||||
State<NewTag> createState() => _NewTagState();
|
||||
}
|
||||
|
||||
class _NewTagState extends State<NewTag> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
// key: _scaffoldKey1,
|
||||
backgroundColor: Color(0xFF222935),
|
||||
extendBody: true,
|
||||
appBar: CommonAppbar(
|
||||
titleTxt: "New tag",
|
||||
),
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: Stack(children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage("assets/images/png/Ellipse 1496.png"),
|
||||
fit: BoxFit.fill)),
|
||||
),
|
||||
SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
sizedBoxHeight(30.h),
|
||||
text16w400_FCFCFC("Tag name"),
|
||||
sizedBoxHeight(16.h),
|
||||
CustomTextFormField(
|
||||
hintText: "",
|
||||
validator: (val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return 'Enter a tag name';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
sizedBoxHeight(80.h),
|
||||
CustomButton(text: "Add", onPressed: () {})
|
||||
]),
|
||||
))
|
||||
]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:regroup/Common/base_manager.dart';
|
||||
import 'package:regroup/Utils/Common/CommonAppbar.dart';
|
||||
import 'package:regroup/Utils/Common/CustomNextButton.dart';
|
||||
import 'package:regroup/Utils/Common/CustomTextformfield.dart';
|
||||
|
||||
import 'package:regroup/Utils/Common/sized_box.dart';
|
||||
import 'package:regroup/Utils/dialogs.dart';
|
||||
import 'package:regroup/Utils/texts.dart';
|
||||
import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/ManageTags.dart/ViewModel/maanageInterestApi.dart';
|
||||
|
||||
enum Interests { tag1, tag2 }
|
||||
|
||||
class NewTag extends StatefulWidget {
|
||||
const NewTag({super.key});
|
||||
|
||||
@override
|
||||
State<NewTag> createState() => _NewTagState();
|
||||
}
|
||||
|
||||
class _NewTagState extends State<NewTag> {
|
||||
int communityid = Get.arguments['communityid'];
|
||||
Interests? _tags = Interests.tag1;
|
||||
final interestController = TextEditingController();
|
||||
|
||||
addSuccess() async {
|
||||
String isSpecialValue = _tags == Interests.tag1 ? "0" : "1";
|
||||
Map<String, dynamic> updata = {
|
||||
"manage_community_xid": communityid.toString(),
|
||||
"name": interestController.text,
|
||||
"is_special": isSpecialValue,
|
||||
};
|
||||
final data = await ManageInterestApi().postNewInterest(updata);
|
||||
if (data.status == ResponseStatus.SUCCESS) {
|
||||
print("success");
|
||||
Get.back();
|
||||
|
||||
return utils.showToast(data.message);
|
||||
} else {
|
||||
// Get.back();
|
||||
print("Failed");
|
||||
return utils.showToast(data.message);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
// key: _scaffoldKey1,
|
||||
backgroundColor: const Color(0xFF222935),
|
||||
extendBody: true,
|
||||
appBar: const CommonAppbar(
|
||||
titleTxt: "New interest",
|
||||
),
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: Stack(children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage("assets/images/png/Ellipse 1496.png"),
|
||||
fit: BoxFit.fill)),
|
||||
),
|
||||
SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
sizedBoxHeight(30.h),
|
||||
text16w400_FCFCFC("Interest name"),
|
||||
sizedBoxHeight(16.h),
|
||||
CustomTextFormField(
|
||||
textEditingController: interestController,
|
||||
hintText: "",
|
||||
validator: (val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return 'Enter a interest name';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
sizedBoxHeight(40.h),
|
||||
text16w400_FCFCFC("Nature of interest"),
|
||||
sizedBoxHeight(40.h),
|
||||
Row(
|
||||
children: [
|
||||
Transform.scale(
|
||||
scale: 1.2,
|
||||
child: Radio<Interests>(
|
||||
fillColor:
|
||||
const MaterialStatePropertyAll(Color(0xFFD90B2E)),
|
||||
activeColor: const Color(0xFFD90B2E),
|
||||
value: Interests.tag1,
|
||||
groupValue: _tags,
|
||||
onChanged: (Interests? val) {
|
||||
setState(() {
|
||||
_tags = val;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
text18w400white("Special Announcement Tag")
|
||||
],
|
||||
),
|
||||
sizedBoxHeight(10.h),
|
||||
Row(
|
||||
children: [
|
||||
Transform.scale(
|
||||
scale: 1.2,
|
||||
child: Radio<Interests>(
|
||||
fillColor:
|
||||
const MaterialStatePropertyAll(Color(0xFFD90B2E)),
|
||||
activeColor: const Color(0xFFD90B2E),
|
||||
value: Interests.tag2,
|
||||
groupValue: _tags,
|
||||
onChanged: (Interests? val) {
|
||||
setState(() {
|
||||
_tags = val;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
text18w400white("Standard Tag")
|
||||
],
|
||||
),
|
||||
sizedBoxHeight(80.h),
|
||||
CustomButton(
|
||||
text: "Add",
|
||||
onPressed: () {
|
||||
if (interestController.text.isBlank!) {
|
||||
utils.showToast("Enter your interest");
|
||||
} else {
|
||||
addSuccess();
|
||||
}
|
||||
})
|
||||
]),
|
||||
))
|
||||
]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// InviteComModel ? inviteComobj;
|
||||
|
||||
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/Utils/dialogs.dart';
|
||||
|
||||
class ManageInterestApi {
|
||||
Future<ResponseData<dynamic>> postNewInterest(updata) async {
|
||||
print("updata is $updata");
|
||||
final response = await NetworkApiServices().postApi(
|
||||
updata,
|
||||
ApiUrls.postnewinterest,
|
||||
);
|
||||
if (response.status == ResponseStatus.SUCCESS) {
|
||||
if (response.data["status"] == "success") {
|
||||
// likepostobj = LikepostModel.fromJson(response.data);
|
||||
}
|
||||
|
||||
return ResponseData<dynamic>(
|
||||
response.data['message'], ResponseStatus.SUCCESS,
|
||||
data: response.data);
|
||||
} else if (response.status == ResponseStatus.FAILED) {
|
||||
if (response.data["status"] == "error") {
|
||||
utils.showToast(response.message);
|
||||
}
|
||||
|
||||
return ResponseData<dynamic>(
|
||||
response.data['message'], ResponseStatus.FAILED,
|
||||
data: response.data);
|
||||
} else {
|
||||
return ResponseData<dynamic>(
|
||||
response.data['message'], ResponseStatus.FAILED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import 'package:regroup/Common/CommonTabBar.dart';
|
||||
import 'package:regroup/Common/CommonWidget.dart';
|
||||
import 'package:regroup/Common/ConvertServerDateToUserDate.dart';
|
||||
import 'package:regroup/Common/base_manager.dart';
|
||||
import 'package:regroup/Common/controller/NormalPostCard.dart';
|
||||
import 'package:regroup/Main_Screens/Community/Model/CommonDatumObjModel.dart';
|
||||
import 'package:regroup/Main_Screens/Community/Model/fetchicons.dart';
|
||||
import 'package:regroup/Main_Screens/Community/ViewModel/getmethod.dart';
|
||||
@@ -163,6 +164,28 @@ class _CommunityDetailsState extends State<CommunityDetails> {
|
||||
),
|
||||
),
|
||||
const PopupMenuDivider(),
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.communitysetting, arguments: {
|
||||
'communityid': CommunityId,
|
||||
});
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.w),
|
||||
child: Row(
|
||||
children: [
|
||||
text14w400white("Edit community"),
|
||||
const Spacer(),
|
||||
Image.asset(
|
||||
"assets/images/png/setting2.png",
|
||||
height: 18.h,
|
||||
width: 18.w,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const PopupMenuDivider(),
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
leaveCommunity();
|
||||
@@ -523,15 +546,15 @@ class _CommunityDetailsState extends State<CommunityDetails> {
|
||||
borderwidth: 1),
|
||||
),
|
||||
sizedBoxHeight(40.h),
|
||||
Container(
|
||||
height: 40.h,
|
||||
width: 200.w,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFD90B2E),
|
||||
borderRadius: BorderRadius.circular(30.r)),
|
||||
child: Center(
|
||||
child: text14w400white("Leave the community")),
|
||||
),
|
||||
// Container(
|
||||
// height: 40.h,
|
||||
// width: 200.w,
|
||||
// decoration: BoxDecoration(
|
||||
// color: const Color(0xFFD90B2E),
|
||||
// borderRadius: BorderRadius.circular(30.r)),
|
||||
// child: Center(
|
||||
// child: text14w400white("Leave the community")),
|
||||
// ),
|
||||
sizedBoxHeight(50.h),
|
||||
])),
|
||||
DefaultTabController(
|
||||
@@ -587,7 +610,7 @@ class _PostsTabState extends State<PostsTab> {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
_fetchIcons() {
|
||||
_fetchIcons() {
|
||||
_reactions = fetchlikeIconsModel!.data ?? [];
|
||||
for (var post in commonobjmodel!.data) {
|
||||
//Check if post as a like icon
|
||||
@@ -755,12 +778,13 @@ class _PostsTabState extends State<PostsTab> {
|
||||
children: [
|
||||
NormalCardTile(
|
||||
tags: _sortTags(index),
|
||||
create_at: timeAgo ?? '1 hour',
|
||||
createAt: timeAgo ?? '1 hour',
|
||||
commonObj: commonobjmodel!.data[index],
|
||||
forWhichTab: 'popular',
|
||||
reactions: _reactions,
|
||||
selectedReactions: _selectedReactions,
|
||||
currentIndex: index,
|
||||
coachbool: true,
|
||||
),
|
||||
sizedBoxHeight(20.h)
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user