diff --git a/devtools_options.yaml b/devtools_options.yaml new file mode 100644 index 0000000..7e7e7f6 --- /dev/null +++ b/devtools_options.yaml @@ -0,0 +1 @@ +extensions: diff --git a/lib/Common/CommonPostUI.dart b/lib/Common/CommonPostUI.dart deleted file mode 100644 index 0d0d057..0000000 --- a/lib/Common/CommonPostUI.dart +++ /dev/null @@ -1,401 +0,0 @@ -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/Main_Screens/Community_HomePage/Community.dart'; -import 'package:regroup/Utils/Common/sized_box.dart'; -import 'package:regroup/Utils/texts.dart'; -import 'package:regroup/resources/routes/route_name.dart'; - -class CommonPostUI extends StatefulWidget { - CommonPostUI( - {super.key, - required this.containerTitle, - required this.mainImg, - required this.profileImg, - required this.title}); - - String profileImg = ""; - String title = ""; - String mainImg = ""; - List containerTitle = []; - - @override - State createState() => _CommonPostUIState(); -} - -class _CommonPostUIState extends State { - @override - Widget build(BuildContext context) { - return postCards( - containerTitle: widget.containerTitle, - profileImg: widget.profileImg, - title: widget.title, - mainImg: widget.mainImg, - ); - } - - Widget postCards({ - required String profileImg, - required String title, - required String mainImg, - required List containerTitle, - }) { - var mainImage = 'assets/images/png/uiw_like-o.png'.obs; - void updateImage(String reaction) { - if (reaction == 'like') { - mainImage.value = 'assets/images/png/f7_hand-thumbsup.png'; - } else if (reaction == 'heart') { - mainImage.value = 'assets/images/png/heart 2.png'; - } else if (reaction == 'party') { - mainImage.value = 'assets/images/png/party-popper 2.png'; - } - } - - return commonGlassUI( - width: double.infinity, - height: 570.h, - borderwidth: 0, - borderRadius: BorderRadius.circular(0), - customWidget: Column( - children: [ - sizedBoxHeight(25.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CircleAvatar( - foregroundImage: AssetImage(profileImg), - radius: 25.r, - ), - sizedBoxWidth(12.w), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - text16w400_FCFCFC(title), - const Spacer(), - commonGlassUI( - width: 72.w, - height: 26.h, - borderRadius: BorderRadius.circular(5.r), - borderColor: const Color(0xFFD90B2E), - customWidget: - Center(child: text14400white("Follow")), - borderwidth: 1), - sizedBoxWidth(6.w), - 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: () {}, - child: Padding( - padding: - EdgeInsets.symmetric(horizontal: 12.w), - child: Row( - children: [ - Text( - 'Pin', - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: FontWeight.w800, - fontFamily: "Nunito Sans", - ), - ), - const Spacer(), - 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, - ), - ), - ], - ), - 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('Active alliance network'), - sizedBoxWidth(7.w), - Icon( - Icons.circle, - color: const Color(0xFFFCFCFC), - size: 4.sp, - ), - sizedBoxWidth(6.w), - text12w400_FCFCFC('1 Hour ago'), - ], - ) - ], - ), - ), - ], - ), - ), - sizedBoxHeight(20.h), - GestureDetector( - onTap: () { - // Get.toNamed(RouteName.postdetailsScreen); - }, - child: SizedBox( - height: 163.h, - width: double.infinity, - child: Image.asset( - mainImg, - fit: BoxFit.cover, - ), - )), - 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: containerTitle.length, - itemBuilder: (context, index) { - return Padding( - padding: EdgeInsets.only(right: 12.w), - child: GestureDetector( - onTap: () { - Get.toNamed(RouteName.tagdetailscreen); - }, - child: containertile(text: containerTitle[index])), - ); - }, - ), - ), - sizedBoxHeight(20.h), - text16w400_FCFCFC( - "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s . . ."), - Row(children: [ - stackReaction(number: '20', containerImages: [ - 'assets/images/png/f7_hand-thumbsup.png', - 'assets/images/png/heart 2.png', - 'assets/images/png/party-popper 2.png' - ]), - const Spacer(), - commonGlassUI( - borderwidth: 0.9, - width: 30.w, - height: 30.h, - borderRadius: BorderRadius.circular(100.r), - customWidget: Center( - child: Image.asset( - 'assets/images/png/Frame 1000004088.png', - height: 13.h, - width: 13.w, - ), - ), - ), - sizedBoxWidth(12.w), - text14w400_FCFCFC('20'), - sizedBoxWidth(20.w), - commonGlassUI( - borderwidth: 0.9, - width: 30.w, - height: 30.h, - borderRadius: BorderRadius.circular(100.r), - customWidget: Center( - child: Image.asset( - 'assets/images/png/Vector (1).png', - height: 12.h, - width: 12.w, - ), - ), - ), - sizedBoxWidth(12.w), - text14w400_FCFCFC('10'), - ]), - sizedBoxHeight(12.h), - commonDivider(), - sizedBoxHeight(12.h), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Obx(() { - return ReactionButton( - onReactionChanged: (reaction) { - updateImage(reaction?.value ?? 'like'); - debugPrint('Selected value: ${reaction?.value}'); - }, - reactions: ?>[ - Reaction( - value: 'like', - previewIcon: _buildReactionsPreviewIcon( - 'assets/images/png/f7_hand-thumbsup.png'), - icon: _buildReactionsIcon( - 'assets/images/png/f7_hand-thumbsup.png'), - ), - Reaction( - value: 'heart', - previewIcon: _buildReactionsPreviewIcon( - 'assets/images/png/heart 2.png'), - icon: _buildReactionsIcon( - 'assets/images/png/heart 2.png'), - ), - Reaction( - value: 'party', - previewIcon: _buildReactionsPreviewIcon( - 'assets/images/png/party-popper 2.png'), - icon: _buildReactionsIcon( - 'assets/images/png/party-popper 2.png'), - ), - ], - selectedReaction: Reaction( - value: 'like', - icon: _buildReactionsIcon( - 'assets/images/png/f7_hand-thumbsup.png'), - ), - boxColor: Colors.white, - boxElevation: 9, - boxRadius: 30, - itemsSpacing: 8, - itemScale: 0.4, - itemSize: const Size(45, 45), - boxPadding: const EdgeInsets.all(8), - boxAnimationDuration: - const Duration(milliseconds: 200), - itemAnimationDuration: - const Duration(milliseconds: 500), - hoverDuration: const Duration(milliseconds: 700), - // toggle: false, - - child: _buildReactionsIcon(mainImage.value), - ); - }) - ], - ), - Column( - children: [ - 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 _buildReactionsPreviewIcon(String assetPath) { - return Padding( - padding: const EdgeInsets.all(8.0), - child: Image.asset( - assetPath, - height: 40.h, - width: 40.w, - ), - ); - } - - Widget _buildReactionsIcon(String assetPath) { - return Column( - children: [ - Image.asset( - assetPath, - height: 19.h, - width: 19.w, - ), - sizedBoxHeight(8.h), - text11w400_FCFCFC('Like') - ], - ); - } -} diff --git a/lib/Main_Screens/Community_HomePage/Community.dart b/lib/Main_Screens/Community_HomePage/Community.dart index 1501ed7..806ee44 100644 --- a/lib/Main_Screens/Community_HomePage/Community.dart +++ b/lib/Main_Screens/Community_HomePage/Community.dart @@ -495,34 +495,6 @@ class _FeedTabState extends State { } } -// ignore: must_be_immutable - -Widget containertile({required String text}) { - return commonGlassContainer( - border: 1, - width: 130.w, - height: 30.h, - borderradius: 30.r, - borderColor: const Color(0xFFD90B2E), - customWidget: Padding( - padding: EdgeInsets.symmetric(horizontal: 10.w), - child: Center(child: text14w400_FCFCFC(text)), - )); -} - -Widget containertile2({required String text}) { - return 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(text)), - )); -} class PopularTab extends StatefulWidget { const PopularTab({super.key}); diff --git a/lib/Main_Screens/Community_HomePage/TagsdDetailScreen.dart b/lib/Main_Screens/Community_HomePage/TagsdDetailScreen.dart index 74b2314..257fca3 100644 --- a/lib/Main_Screens/Community_HomePage/TagsdDetailScreen.dart +++ b/lib/Main_Screens/Community_HomePage/TagsdDetailScreen.dart @@ -127,424 +127,6 @@ class _TagdetailScreenState extends State { } } -Widget cyclepopularTab() { - return SingleChildScrollView( - child: Column(children: [ - sizedBoxHeight(20.h), - normalcardtile( - profileImg: 'assets/images/png/Ellipse 52.png', - title: 'Ryan Dorwat', - mainImg: 'assets/images/png/img322.png', - containerTitle: [ - 'Football', - 'Teams player', - 'Events', - 'Marathon', - 'Events' - ]), - sizedBoxHeight(30.h), - normalcardtile( - profileImg: 'assets/images/png/Ellipse 43.png', - title: 'Edward Hackket', - mainImg: 'assets/images/png/Rectangle 24.png', - containerTitle: [ - 'Cycle', - 'Marathon', - 'Events', - 'Marathon', - 'Events' - ]), - ]), - ); -} - -Widget cyclelatestTab() { - return SingleChildScrollView( - child: Column(children: [ - sizedBoxHeight(20.h), - normalcardtile( - profileImg: 'assets/images/png/Ellipse 43.png', - title: 'Edward Hackket', - mainImg: 'assets/images/png/Rectangle 24.png', - containerTitle: [ - 'Cycle', - 'Marathon', - 'Events', - 'Marathon', - 'Events' - ]), - ]), - ); -} - -Widget normalcardtile({ - required String profileImg, - required String title, - required String mainImg, - required List containerTitle, -}) { - var mainImage = 'assets/images/png/uiw_like-o.png'.obs; - void updateImage(String reaction) { - if (reaction == 'like') { - mainImage.value = 'assets/images/png/f7_hand-thumbsup.png'; - } else if (reaction == 'heart') { - mainImage.value = 'assets/images/png/heart 2.png'; - } else if (reaction == 'party') { - mainImage.value = 'assets/images/png/party-popper 2.png'; - } - } - - return commonGlassUI( - width: double.infinity, - height: 570.h, - borderwidth: 0, - borderRadius: BorderRadius.circular(1), - customWidget: Column( - children: [ - sizedBoxHeight(25.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CircleAvatar( - foregroundImage: AssetImage(profileImg), - radius: 25.r, - ), - sizedBoxWidth(12.w), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - text16w400_FCFCFC(title), - 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('Active alliance network'), - sizedBoxWidth(7.w), - Icon( - Icons.circle, - color: const Color(0xFFFCFCFC), - size: 4.sp, - ), - sizedBoxWidth(6.w), - text12w400_FCFCFC('1 Hour ago'), - ], - ) - ], - ), - 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: () {}, - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 12.w), - child: Row( - children: [ - Text( - 'Pin', - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: FontWeight.w800, - fontFamily: "Nunito Sans", - ), - ), - const Spacer(), - 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: () { - Get.toNamed(RouteName.postdetailsScreen); - }, - child: SizedBox( - height: 360.h, - width: double.infinity, - child: Image.asset( - mainImg, - fit: BoxFit.cover, - ), - )), - 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: containerTitle.length, - itemBuilder: (context, index) { - return Padding( - padding: EdgeInsets.only(right: 12.w), - child: GestureDetector( - onTap: () { - // Get.toNamed(RouteName.tagdetailscreen); - }, - child: containertile(text: containerTitle[index])), - ); - }, - ), - ), - sizedBoxHeight(20.h), - text16w400_FCFCFC( - "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s . . ."), - Row(children: [ - InkWell( - onTap: () { - Get.toNamed(RouteName.reactionview); - }, - child: stackReaction(number: '20', containerImages: [ - 'assets/images/png/f7_hand-thumbsup.png', - 'assets/images/png/heart 2.png', - 'assets/images/png/party-popper 2.png' - ]), - ), - const Spacer(), - commonGlassUI( - borderwidth: 0.43, - width: 30.w, - height: 30.h, - opacity1: 0.05, - opacity2: 0.06, - borderRadius: BorderRadius.circular(100), - customWidget: Center( - child: Image.asset( - 'assets/images/png/Frame 1000004088.png', - height: 13.h, - width: 13.w, - ), - ), - ), - sizedBoxWidth(12.w), - text14w400_FCFCFC('20'), - sizedBoxWidth(20.w), - commonGlassUI( - borderwidth: 0.43, - width: 30.w, - height: 30.h, - borderRadius: BorderRadius.circular(100), - opacity1: 0.05, - opacity2: 0.06, - customWidget: Center( - child: Image.asset( - 'assets/images/png/Vector (1).png', - height: 12.h, - width: 12.w, - ), - ), - ), - sizedBoxWidth(12.w), - text14w400_FCFCFC('10'), - ]), - sizedBoxHeight(12.h), - commonDivider(), - sizedBoxHeight(12.h), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Obx(() { - return ReactionButton( - onReactionChanged: (reaction) { - updateImage(reaction?.value ?? 'like'); - debugPrint('Selected value: ${reaction?.value}'); - }, - reactions: ?>[ - Reaction( - value: 'like', - previewIcon: _buildReactionsPreviewIcon( - 'assets/images/png/f7_hand-thumbsup.png'), - icon: _buildReactionsIcon( - 'assets/images/png/f7_hand-thumbsup.png'), - ), - Reaction( - value: 'heart', - previewIcon: _buildReactionsPreviewIcon( - 'assets/images/png/heart 2.png'), - icon: _buildReactionsIcon( - 'assets/images/png/heart 2.png'), - ), - Reaction( - value: 'party', - previewIcon: _buildReactionsPreviewIcon( - 'assets/images/png/party-popper 2.png'), - icon: _buildReactionsIcon( - 'assets/images/png/party-popper 2.png'), - ), - ], - selectedReaction: Reaction( - value: 'like', - icon: _buildReactionsIcon( - 'assets/images/png/f7_hand-thumbsup.png'), - ), - boxColor: Colors.white, - boxElevation: 9, - boxRadius: 30, - itemsSpacing: 8, - itemScale: 0.4, - itemSize: const Size(45, 45), - boxPadding: const EdgeInsets.all(8), - boxAnimationDuration: - const Duration(milliseconds: 200), - itemAnimationDuration: - const Duration(milliseconds: 500), - hoverDuration: const Duration(milliseconds: 700), - // toggle: false, - - child: _buildReactionsIcon(mainImage.value), - ); - }) - ], - ), - GestureDetector( - onTap: () { - Get.toNamed(RouteName.postdetailsScreen); - }, - child: Column( - children: [ - Image.asset( - 'assets/images/png/Frame 1000004088.png', - height: 19.h, - width: 19.w, - ), - sizedBoxHeight(8.h), - text11w400_FCFCFC('Comment') - ], - ), - ), - Column( - children: [ - 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 _buildReactionsPreviewIcon(String assetPath) { - return Padding( - padding: const EdgeInsets.all(8.0), - child: Image.asset( - assetPath, - height: 40.h, - width: 40.w, - ), - ); -} - -Widget _buildReactionsIcon(String assetPath) { - return Column( - children: [ - Image.asset( - assetPath, - height: 19.h, - width: 19.w, - ), - sizedBoxHeight(8.h), - text11w400_FCFCFC('Like') - ], - ); -} - class PopularTab extends StatefulWidget { PopularTab({super.key, required this.id}); @@ -594,7 +176,7 @@ class _PopularTabState extends State { Future setValues() async { if (_isDataInitialized) { _setModel(); - countersHelper.setListstagPopular(); + countersHelper.setListsPopular(); await _fetchIcons(); _isDataInitialized = false; @@ -823,7 +405,7 @@ class _LatestTabState extends State { Future setValues() async { if (_isDataInitialized) { _setModel(); - countersHelper.setListstagtagLatest(); + countersHelper.setListsPopular(); await _fetchIcons(); _isDataInitialized = false; diff --git a/lib/Main_Screens/Community_HomePage/view_model/CountersHelper.dart b/lib/Main_Screens/Community_HomePage/view_model/CountersHelper.dart index 0a82861..b68e987 100644 --- a/lib/Main_Screens/Community_HomePage/view_model/CountersHelper.dart +++ b/lib/Main_Screens/Community_HomePage/view_model/CountersHelper.dart @@ -11,7 +11,7 @@ class CountersHelper extends GetxController { RxList commentsCounterPopular = [].obs; RxList savePostCounterPopular = [].obs; RxList saveButtonPopular = [].obs; -List pinButtonPopular = []; + List pinButtonPopular = []; RxBool updateFeedsPage = false.obs; setListsPopular() { likesCounterPopular.clear(); @@ -29,79 +29,4 @@ List pinButtonPopular = []; .add(commonobjmodel?.data[i].iamPrincipal?.isUserPinned ?? false); } } - - RxList likesCounterFeed = [].obs; - RxList commentsCounterFeed = [].obs; - RxList savePostCounterFeed = [].obs; - - setListsFeed() { - 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); - } - } - - RxList likesCounterLatest = [].obs; - RxList commentsCounterLatest = [].obs; - RxList savePostCounterLatest = [].obs; - - setListsLatest() { - for (var i = 0; i < latestpostobj!.data.length; i++) { - likesCounterFeed.add(latestpostobj!.data[i].likecount ?? 0); - commentsCounterFeed.add(latestpostobj!.data[i].totalCommentCount ?? 0); - savePostCounterFeed.add(latestpostobj!.data[i].totalSave ?? 0); - } - } - -//ComPosts - RxList likesCounterComPosts= [].obs; - RxList commentsCounterComPosts = [].obs; - RxList savePostCounterComPosts = [].obs; - RxList saveButtonComPosts = [].obs; - // RxList pinButtonComPosts = [].obs; - - setListsComPosts() { - likesCounterComPosts.clear(); - commentsCounterComPosts.clear(); - savePostCounterComPosts.clear(); - saveButtonComPosts.clear(); - - for (var i = 0; i < commonobjmodel!.data.length; i++) { - likesCounterComPosts.add(commonobjmodel?.data[i].likecount ?? 0); - commentsCounterComPosts - .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); - } - } - - -//tagPostPopular - RxList likesCountertagPopular = [].obs; - RxList commentsCountertagPopular = [].obs; - RxList savePostCountertagPopular = [].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 likesCountertagLatest = [].obs; - RxList commentsCountertagLatest = [].obs; - RxList savePostCountertagLatest = [].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); - } - } } diff --git a/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart b/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart index cd25c7b..bdf45c7 100644 --- a/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart +++ b/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart @@ -703,15 +703,12 @@ class _PostsTabState extends State { } } - bool _isDataInitialized = true; - Future setValues() async { - if (_isDataInitialized) { + + if (mounted) { _setModel(); countersHelper.setListsPopular(); await _fetchIcons(); - - _isDataInitialized = false; } } @@ -880,367 +877,3 @@ Widget eventstab() { children: [], ); } - -Widget normalcardtile({ - required String profileImg, - required String title, - required String mainImg, - required List containerTitle, -}) { - var mainImage = 'assets/images/png/uiw_like-o.png'.obs; - void updateImage(String reaction) { - if (reaction == 'like') { - mainImage.value = 'assets/images/png/f7_hand-thumbsup.png'; - } else if (reaction == 'heart') { - mainImage.value = 'assets/images/png/heart 2.png'; - } else if (reaction == 'party') { - mainImage.value = 'assets/images/png/party-popper 2.png'; - } - } - - return Column( - children: [ - sizedBoxHeight(25.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CircleAvatar( - foregroundImage: AssetImage(profileImg), - radius: 25.r, - ), - sizedBoxWidth(12.w), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - text16w400_FCFCFC(title), - 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('Active alliance network'), - sizedBoxWidth(7.w), - Icon( - Icons.circle, - color: const Color(0xFFFCFCFC), - size: 4.sp, - ), - sizedBoxWidth(6.w), - text12w400_FCFCFC('1 Hour ago'), - ], - ) - ], - ), - 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: () {}, - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 12.w), - child: Row( - children: [ - Text( - 'Pin', - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: FontWeight.w800, - fontFamily: "Nunito Sans", - ), - ), - const Spacer(), - 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: () { - Get.toNamed(RouteName.postdetailsScreen); - }, - child: SizedBox( - height: 163.h, - width: double.infinity, - child: Image.asset( - mainImg, - fit: BoxFit.cover, - ), - )), - 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: containerTitle.length, - itemBuilder: (context, index) { - return Padding( - padding: EdgeInsets.only(right: 12.w), - child: GestureDetector( - onTap: () { - Get.toNamed(RouteName.tagdetailscreen); - }, - child: containertile(text: containerTitle[index])), - ); - }, - ), - ), - sizedBoxHeight(20.h), - text16w400_FCFCFC( - "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s . . ."), - Row(children: [ - stackReaction(number: '20', containerImages: [ - 'assets/images/png/f7_hand-thumbsup.png', - 'assets/images/png/heart 2.png', - 'assets/images/png/party-popper 2.png' - ]), - const Spacer(), - commonGlassUI( - borderwidth: 0.43, - width: 30.w, - height: 30.h, - opacity1: 0.05, - opacity2: 0.06, - borderRadius: BorderRadius.circular(100), - customWidget: Center( - child: Image.asset( - 'assets/images/png/Frame 1000004088.png', - height: 13.h, - width: 13.w, - ), - ), - ), - sizedBoxWidth(12.w), - text14w400_FCFCFC('20'), - sizedBoxWidth(20.w), - commonGlassUI( - borderwidth: 0.43, - width: 30.w, - height: 30.h, - borderRadius: BorderRadius.circular(100), - opacity1: 0.05, - opacity2: 0.06, - customWidget: Center( - child: Image.asset( - 'assets/images/png/Vector (1).png', - height: 12.h, - width: 12.w, - ), - ), - ), - sizedBoxWidth(12.w), - text14w400_FCFCFC('10'), - ]), - sizedBoxHeight(30.h), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Obx(() { - return ReactionButton( - onReactionChanged: (reaction) { - updateImage(reaction?.value ?? 'like'); - debugPrint('Selected value: ${reaction?.value}'); - }, - reactions: ?>[ - Reaction( - value: 'like', - previewIcon: _buildReactionsPreviewIcon( - 'assets/images/png/f7_hand-thumbsup.png'), - icon: _buildReactionsIcon( - 'assets/images/png/f7_hand-thumbsup.png'), - ), - Reaction( - value: 'heart', - previewIcon: _buildReactionsPreviewIcon( - 'assets/images/png/heart 2.png'), - icon: _buildReactionsIcon( - 'assets/images/png/heart 2.png'), - ), - Reaction( - value: 'party', - previewIcon: _buildReactionsPreviewIcon( - 'assets/images/png/party-popper 2.png'), - icon: _buildReactionsIcon( - 'assets/images/png/party-popper 2.png'), - ), - ], - selectedReaction: Reaction( - value: 'like', - icon: _buildReactionsIcon( - 'assets/images/png/f7_hand-thumbsup.png'), - ), - boxColor: Colors.white, - boxElevation: 9, - boxRadius: 30, - itemsSpacing: 8, - itemScale: 0.4, - itemSize: const Size(45, 45), - boxPadding: const EdgeInsets.all(8), - boxAnimationDuration: const Duration(milliseconds: 200), - itemAnimationDuration: const Duration(milliseconds: 500), - hoverDuration: const Duration(milliseconds: 700), - // toggle: false, - - child: _buildReactionsIcon(mainImage.value), - ); - }) - ], - ), - GestureDetector( - onTap: () { - Get.toNamed(RouteName.postdetailsScreen); - }, - child: Column( - children: [ - Image.asset( - 'assets/images/png/Frame 1000004088.png', - height: 19.h, - width: 19.w, - ), - sizedBoxHeight(8.h), - text11w400_FCFCFC('Comment') - ], - ), - ), - Column( - children: [ - Image.asset( - 'assets/images/png/Frame 1000004089.png', - height: 19.h, - width: 19.w, - ), - sizedBoxHeight(8.h), - text11w400_FCFCFC('Save') - ], - ) - ], - ) - ]), - ), - ], - ); -} - -Widget _buildReactionsPreviewIcon(String assetPath) { - return Padding( - padding: const EdgeInsets.all(8.0), - child: Image.asset( - assetPath, - height: 40.h, - width: 40.w, - ), - ); -} - -Widget _buildReactionsIcon(String assetPath) { - return Column( - children: [ - Image.asset( - assetPath, - height: 19.h, - width: 19.w, - ), - sizedBoxHeight(8.h), - text11w400_FCFCFC('Like') - ], - ); -} - -Widget containertile({required String text}) { - return commonGlassUI( - borderwidth: 1, - width: 100.w, - height: 30.h, - borderRadius: BorderRadius.circular(30.r), - borderColor: const Color(0xFFD90B2E), - customWidget: Padding( - padding: EdgeInsets.symmetric(horizontal: 10.w), - child: Center(child: text14w400_FCFCFC(text)), - )); -}