From e84bd1b5da53eb7dd0271be2abe573b9ed00908b Mon Sep 17 00:00:00 2001 From: jayesh Date: Thu, 22 Aug 2024 18:59:09 +0530 Subject: [PATCH] overflow changes and leave community api completed --- lib/Common/CommonGlassmorphism.dart | 9 +- lib/Common/controller/NormalPostCard.dart | 972 +++++++++--------- .../MyCommunity/View/CommunityDetails.dart | 25 +- .../MyCommunity/View/MyCommunity.dart | 70 +- 4 files changed, 567 insertions(+), 509 deletions(-) diff --git a/lib/Common/CommonGlassmorphism.dart b/lib/Common/CommonGlassmorphism.dart index d049b60..d10d9d3 100644 --- a/lib/Common/CommonGlassmorphism.dart +++ b/lib/Common/CommonGlassmorphism.dart @@ -12,8 +12,7 @@ Widget commonGlassContainer({ double opacity2 = 0.05, Color borderColor = const Color(0xff434A53), }) { - return - GlassmorphicContainer( + return GlassmorphicContainer( width: width, height: height, borderRadius: borderradius, @@ -83,7 +82,7 @@ Widget commonGlassContainerblue({ Widget commonGlassUIBlue({ required double width, - required double height, + required double? height, required Widget customWidget, // required double border, double mainOpacity = 1, @@ -114,7 +113,7 @@ Widget commonGlassUIBlue({ Widget commonGlassUI({ required double width, - required double height, + required double? height, // required double border, double mainOpacity = 1, double opacity1 = 0.04, @@ -148,7 +147,7 @@ Widget commonGlassUI({ Widget commonContainer({ required double width, - required double height, + required double? height, // required double border, // double mainOpacity = 1, double opacity1 = 0.04, diff --git a/lib/Common/controller/NormalPostCard.dart b/lib/Common/controller/NormalPostCard.dart index 6096b92..0d3d7e8 100644 --- a/lib/Common/controller/NormalPostCard.dart +++ b/lib/Common/controller/NormalPostCard.dart @@ -26,27 +26,26 @@ class NormalCardTile extends StatefulWidget { String forWhichTab; List reactions; Map selectedReactions; - bool? coachbool; + 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); + 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 { - RxString mainImage = 'assets/images/png/uiw_like-o.png'.obs; final CountersHelper countersHelper = Get.find(); int saveCount = 0; @@ -175,488 +174,503 @@ class _NormalCardTileState extends State { .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 - : const AssetImage('assets/images/default_profile.png') - as ImageProvider, - 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) => [ - 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, + return ConstrainedBox( + constraints: BoxConstraints(minHeight: 750.h), + child: commonGlassUI( + width: double.infinity, + height: 600.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 + : const AssetImage( + 'assets/images/default_profile.png') + as ImageProvider, + radius: 25.r, + ), + sizedBoxWidth(12.w), Column( - mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - ReactionButton( - onReactionChanged: (reaction) async { - _handleReactionChange(reaction); + 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) => [ + 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!); }, - reactions: widget.reactions - .map((reaction) => Reaction( - 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( - value: widget - .selectedReactions[widget.commonObj.id]! - .id - .toString(), - icon: Image.network( + 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( + width: double.infinity, + child: Text( + widget.commonObj.caption ?? "", + style: TextStyle( + fontSize: 16.sp, + color: Colors.white, + fontFamily: "Nunito Sans", + ), + maxLines: 2, // Set the maximum number of lines + overflow: TextOverflow + .ellipsis, // Truncate the text with an ellipsis + ), + ), + // 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( + onReactionChanged: (reaction) async { + _handleReactionChange(reaction); + }, + reactions: widget.reactions + .map((reaction) => Reaction( + 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( + 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, - ), - ) - : 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, + 'assets/images/png/uiw_like-o.png', + width: 24, + height: 24, + fit: BoxFit.cover, ), ), sizedBoxHeight(8.h), - text11w400_FCFCFC('Save') + text11w400_FCFCFC('Like'), ], ), - ), - ], - ), - sizedBoxHeight(12.h), - commonDivider(), - sizedBoxHeight(12.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: 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), + ]), + ), + ], + )), + ); } } diff --git a/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart b/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart index 8d2e06c..084848c 100644 --- a/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart +++ b/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart @@ -7,13 +7,10 @@ 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'; -import 'package:regroup/Main_Screens/Community_HomePage/Community.dart'; import 'package:regroup/Main_Screens/Community_HomePage/view_model/CountersHelper.dart'; import 'package:regroup/Utils/Common/CommonAppbar.dart'; import 'package:regroup/Utils/Common/sized_box.dart'; @@ -94,7 +91,7 @@ class _CommunityDetailsState extends State { titleTxt: "", customActionWidget: PopupMenuButton( surfaceTintColor: const Color(0xFF222935), - constraints: BoxConstraints.tightFor(width: 190.w), + constraints: BoxConstraints.tightFor(width: 180.w), offset: const Offset(0, 40), color: const Color(0xFF222935), tooltip: "", @@ -604,15 +601,15 @@ class _CommunityDetailsState extends State { 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( @@ -736,7 +733,6 @@ class _PostsTabState extends State { likeIcon: LikeIcon1( likeIcon: LikeIconClass1( id: e.likeIcon?.likeIcon?.id, - // likeIcon?.id, image: e.likeIcon?.likeIcon?.image), likeIconsXid: e.likeIcon?.likeIconsXid, ), @@ -843,7 +839,6 @@ class _PostsTabState extends State { reactions: _reactions, selectedReactions: _selectedReactions, currentIndex: index, - coachbool: true, ), sizedBoxHeight(20.h) ], diff --git a/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart b/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart index a83cec3..1ace21d 100644 --- a/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart +++ b/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart @@ -186,8 +186,7 @@ class _MyCommunityState extends State { } } - return myCommunityobj!.data!.isEmpty - + return myCommunityobj!.data.isEmpty ? _buildNoDataBody(context) : _buildBody(context); }, @@ -302,6 +301,8 @@ class _MyCommunityState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.center, children: [ // Container( // // width: 250.w, @@ -315,16 +316,44 @@ class _MyCommunityState extends State { .joinedAndRequestedCommunity! .communityName! .isEmpty - ? text18w700_FCFCFC('Regroup') - : SizedBox( - width: 200.w, - child: text18w700_FCFCFC( + ? SizedBox( + // width: double.infinity, + child: Text( + "Regroup", + style: TextStyle( + fontSize: 16.sp, + color: Colors.white, + fontFamily: "Nunito Sans", + ), + maxLines: + 2, // Set the maximum number of lines + overflow: TextOverflow + .ellipsis, // Truncate the text with an ellipsis + ), + ) + : Wrap(children: [ + SizedBox( + // width: double.infinity, + child: Text( joinnedComData .joinedAndRequestedCommunity! - .communityName!), - ), + .communityName!, + style: TextStyle( + fontSize: 16.sp, + color: Colors.white, + fontFamily: + "Nunito Sans", + ), + maxLines: + 2, // Set the maximum number of lines + overflow: TextOverflow + .ellipsis, // Truncate the text with an ellipsis + ), + ), + ]), + // ), - sizedBoxHeight(10.h), + // sizedBoxHeight(10.h), joinnedComData.totalCommunityMember == null || joinnedComData @@ -517,7 +546,28 @@ class _MyCommunityState extends State { const PopupMenuDivider(), PopupMenuItem( onTap: () async { - await leaveCommunity(); + utils.loader(); + Map + updata = {}; + final data = + await CommunityDetail() + .postLeaveCommunity( + updata, + CommunityId); + if (data.status == + ResponseStatus + .SUCCESS) { + setState(() { + myCommunityobj!.data + .removeAt(index); + }); + return utils.showToast( + data.message); + } else { + Get.back(); + return utils.showToast( + data.message); + } }, child: Padding( padding: