663 lines
27 KiB
Dart
663 lines
27 KiB
Dart
|
|
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),
|
||
|
|
]),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
));
|
||
|
|
}
|
||
|
|
}
|