diff --git a/lib/sidemenu/Community/Announcements/View/Announcements.dart b/lib/sidemenu/Community/Announcements/View/Announcements.dart index 0973ce2..7b7b82c 100644 --- a/lib/sidemenu/Community/Announcements/View/Announcements.dart +++ b/lib/sidemenu/Community/Announcements/View/Announcements.dart @@ -133,7 +133,7 @@ Widget announcementWidget({ return commonGlassUI( width: double.infinity, height: 120.h, - borderRadius: BorderRadius.circular( 10.r), + borderRadius: BorderRadius.circular(10.r), customWidget: Padding( padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h), child: Column( diff --git a/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart b/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart index cfe0bed..cbd8cc8 100644 --- a/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart +++ b/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart @@ -228,24 +228,8 @@ class _CommunityDetailsState extends State { child: Row( children: [ iscommunitypin == true - ? 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", - ), - ), + ? text14w400white('Unpin') + : text14w400white('Pin'), const Spacer(), iscommunitypin == true ? Image.asset( @@ -595,7 +579,25 @@ class _CommunityDetailsState extends State { .toList() ?? [], ), - sizedBoxWidth(75.w), + sizedBoxWidth(comdetailobj! + .data! + .userLinkInCommunity! + .totalCommunityMember! == + 1 + ? 5.w + : comdetailobj! + .data! + .userLinkInCommunity! + .totalCommunityMember! == + 2 + ? 30.w + : comdetailobj! + .data! + .userLinkInCommunity! + .totalCommunityMember! == + 3 + ? 40.w + : 75.w), comdetailobj! .data! .userLinkInCommunity! @@ -688,7 +690,7 @@ class _CommunityDetailsState extends State { GestureDetector( onTap: () { // Get.toNamed(RouteName.addgroup); - Get.toNamed(RouteName.group, arguments: { + Get.toNamed(RouteName.announcement, arguments: { 'id': CommunityId, 'iscommunity': true, }); diff --git a/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart b/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart index 55b2019..7121090 100644 --- a/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart +++ b/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart @@ -50,149 +50,149 @@ class _MyCommunityState extends State { void refreshData() { setState(() { - myfuture = MyCommunityAPI().getMyCommunity(); + // await MyCommunityAPI().getMyCommunity(); }); } + Future setValues() async { + if (mounted) { + isMuteList.clear(); + isPinList.clear(); + + for (int i = 0; i < myCommunityobj!.data.length; i++) { + isMuteList.add(myCommunityobj!.data[i].isMute!); + if (myCommunityobj!.data[i].joinedAndRequestedCommunity != null) { + isPinList.add(myCommunityobj! + .data[i].joinedAndRequestedCommunity!.isCommunityPinned!); + } + } + } + } + @override Widget build(BuildContext context) { return WillPopScope( - onWillPop: () async { - Get.toNamed(RouteName.mainscreen, arguments: 0); - return true; - }, - child: Scaffold( - // key: _scaffoldKey1, - backgroundColor: const Color(0xFF222935), - extendBody: true, - resizeToAvoidBottomInset: false, - appBar: CommonAppbar( - customBack: true, - titleTxt: "My Communities", - customActionWidget: Row( - children: [ - GestureDetector( - onTap: () async { - var result = await Get.toNamed(RouteName.newcommunity); - if (result != null && result) { - refreshData(); - // CommunityDetail().getCommunityDetail(CommunityId); - print("Updating community details..."); - // setState(() {}); - } - }, - child: Container( - height: 30.h, - width: 30.w, - decoration: const BoxDecoration( - color: Color(0xFFD90B2E), - boxShadow: [ - BoxShadow( - color: Color(0x40000000), - offset: Offset(0, 6), - blurRadius: 8, - spreadRadius: 0, - ), - ], - shape: BoxShape.circle), - child: const Icon( - Icons.add, - color: Colors.white, - ), - ), - ), - sizedBoxWidth(12.w), - Image.asset( - "assets/images/png/Frame 9.png", - height: 22.h, - width: 22.w, - ) - ], - ), - ), - body: FutureBuilder( - future: myfuture, - builder: (ctx, snapshot) { - if (snapshot.data == null) { - return const Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, + onWillPop: () async { + Get.back(); + return true; + }, + child: Scaffold( + // key: _scaffoldKey1, + backgroundColor: const Color(0xFF222935), + extendBody: true, + resizeToAvoidBottomInset: false, + appBar: CommonAppbar( + customBack: true, + titleTxt: "My Communities", + customActionWidget: Row( children: [ - Center( - child: CircularProgressIndicator( - color: Color(0xFFC18948), + GestureDetector( + onTap: () async { + var result = await Get.toNamed(RouteName.newcommunity); + if (result != null && result) { + refreshData(); + // CommunityDetail().getCommunityDetail(CommunityId); + print("Updating community details..."); + // setState(() {}); + } + }, + child: Container( + height: 30.h, + width: 30.w, + decoration: const BoxDecoration( + color: Color(0xFFD90B2E), + boxShadow: [ + BoxShadow( + color: Color(0x40000000), + offset: Offset(0, 6), + blurRadius: 8, + spreadRadius: 0, + ), + ], + shape: BoxShape.circle), + child: const Icon( + Icons.add, + color: Colors.white, + ), ), + ), + sizedBoxWidth(12.w), + Image.asset( + "assets/images/png/Frame 9.png", + height: 22.h, + width: 22.w, ) ], - ); - } - if (snapshot.connectionState == ConnectionState.done) { - if (snapshot.hasError) { - return Center( - child: Text( - '${snapshot.error} occured', - style: TextStyle(fontSize: 18.spMin), - ), - ); - } - } - // for (int i = 0; i < myCommunityobj!.data.length; i++) { - // ismute = myCommunityobj!.data[i].isMute; - // iscommunitypin = myCommunityobj! - // .data[i].joinedAndRequestedCommunity!.isCommunityPinned; - // } - for (int i = 0; i < myCommunityobj!.data.length; i++) { - // Check if the current data item and its joinedAndRequestedCommunity property are not null - - isMuteList.add(myCommunityobj!.data[i].isMute!); - - if (myCommunityobj!.data[i].joinedAndRequestedCommunity != null) { - isPinList.add(myCommunityobj! - .data[i] - .joinedAndRequestedCommunity! - .isCommunityPinned!); // Handle null with a default value if needed - } - } - - return Stack(children: [ - Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/png/Ellipse 1496.png"), - fit: BoxFit.fill)), ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), - child: Column(children: [ - sizedBoxHeight(20.h), - Row( + ), + body: FutureBuilder( + future: MyCommunityAPI().getMyCommunity(), + builder: (ctx, snapshot) { + if (snapshot.data == null) { + return const Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Spacer(), - GestureDetector( - onTap: () async { - var result = - await Get.toNamed(RouteName.requestscreen); - if (result != null && result) { - refreshData(); - // CommunityDetail().getCommunityDetail(CommunityId); - print("Updating community details..."); - // setState(() {}); - } - }, - child: - text16w700_FCFCFC_line("Request and Invites")) + Center( + child: CircularProgressIndicator( + color: Color(0xFFC18948), + ), + ) ], - ), - sizedBoxHeight(20.h), - myCommunityobj!.data!.isEmpty - ? _buildNoDataBody(context) - : _buildBody(context), - ])) - ]); - }, - ), - ), - ); + ); + } + if (snapshot.connectionState == ConnectionState.done) { + if (snapshot.hasError) { + return Center( + child: Text( + '${snapshot.error} occured', + style: TextStyle(fontSize: 18.spMin), + ), + ); + } + } + + if (snapshot.hasData) { + setValues(); + + return Stack(children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage( + "assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Column(children: [ + sizedBoxHeight(20.h), + Row( + children: [ + Spacer(), + GestureDetector( + onTap: () async { + var result = await Get.toNamed( + RouteName.requestscreen); + if (result != null && result) { + refreshData(); + print("Updating community details..."); + // setState(() {}); + } + }, + child: text16w700_FCFCFC_line( + "Request and Invites")) + ], + ), + sizedBoxHeight(20.h), + myCommunityobj!.data!.isEmpty + ? _buildNoDataBody(context) + : _buildBody(context), + ])) + ]); + } + return Container(); + }))); } Widget _buildNoDataBody(context) { @@ -235,7 +235,7 @@ class _MyCommunityState extends State { if (result != null && result) { refreshData(); - print("Updating community details..."); + print("Updating community details...$result"); } }, child: commonGlassUI( @@ -484,6 +484,7 @@ class _MyCommunityState extends State { // .joinedAndRequestedCommunity! // .id // .toString()); + Map updata = { "manage_communities_xid": myCommunityobj! @@ -523,28 +524,8 @@ class _MyCommunityState extends State { child: Row( children: [ isPinList[index] == true - ? 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", - ), - ), + ? text14w400white('Unpin') + : text14w400white('Pin'), const Spacer(), isPinList[index] == true ? Image.asset( @@ -638,7 +619,24 @@ class _MyCommunityState extends State { .toList() ?? [], ), - sizedBoxWidth(75.w), + sizedBoxWidth(joinnedComData + .totalCommunityMember == + null || + joinnedComData.totalCommunityMember == 1 + ? 5.w + : joinnedComData.totalCommunityMember == + null || + joinnedComData + .totalCommunityMember == + 2 + ? 30.w + : joinnedComData.totalCommunityMember == + null || + joinnedComData + .totalCommunityMember == + 3 + ? 40.w + : 75.w), joinnedComData.totalCommunityMember == null || joinnedComData .totalCommunityMember.isBlank! diff --git a/lib/sidemenu/Community/MyCommunity/View/RequestsScreen.dart b/lib/sidemenu/Community/MyCommunity/View/RequestsScreen.dart index ccafb2d..d9b56e8 100644 --- a/lib/sidemenu/Community/MyCommunity/View/RequestsScreen.dart +++ b/lib/sidemenu/Community/MyCommunity/View/RequestsScreen.dart @@ -1,6 +1,4 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:regroup/Common/CommonGlassmorphism.dart'; @@ -268,7 +266,28 @@ class _RequestedTabState extends State { .toList() ?? [], ), - sizedBoxWidth(75.w), + sizedBoxWidth(requestedComData + .totalCommunityMember == + null || + requestedComData + .totalCommunityMember == + 1 + ? 5.w + : requestedComData + .totalCommunityMember == + null || + requestedComData + .totalCommunityMember == + 2 + ? 30.w + : requestedComData + .totalCommunityMember == + null || + requestedComData + .totalCommunityMember == + 3 + ? 40.w + : 75.w), requestedComData.totalCommunityMember == null || requestedComData @@ -485,8 +504,8 @@ class _RequestedTabState extends State { borderRadius: BorderRadius .circular(30.r), - color: - Color(0xFFD90B2E)), + color: const Color( + 0xFFD90B2E)), child: Center( child: text12w400_FCFCFC( "Cancel request")), @@ -954,8 +973,8 @@ class _InvitedTabState extends State { borderRadius: BorderRadius .circular(30.r), - color: - Color(0xFFD90B2E)), + color: const Color( + 0xFFD90B2E)), child: Center( child: text12w400_FCFCFC(