diff --git a/lib/Common/api_urls.dart b/lib/Common/api_urls.dart index d4c7974..6bbed48 100644 --- a/lib/Common/api_urls.dart +++ b/lib/Common/api_urls.dart @@ -90,6 +90,8 @@ class ApiUrls { static const getComPostdetail = "${baseUrl}fetch-community-all-posts"; + static const postleavecommunity = "${baseUrl}leave-community"; + static const getrequestedcommunity = diff --git a/lib/main.dart b/lib/main.dart index 1ca9fa7..171c6cc 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -125,7 +125,7 @@ class _MyAppState extends State with WidgetsBindingObserver { debugShowCheckedModeBanner: false, // initialRoute: RouteName.individualactivitystep2, - initialRoute: RouteName.individualactivitystep2, + initialRoute: RouteName.splashScreen, getPages: AppRoutes.appRoutes(), ), diff --git a/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart b/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart index 2d54159..70701e3 100644 --- a/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart +++ b/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart @@ -14,8 +14,42 @@ import 'package:regroup/onboarding/Signup/view_model/postmethod.dart'; import 'package:regroup/resources/routes/route_name.dart'; import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart'; -int? _firstSelectedIndex; -bool _isFirstSelectionActive = false; +class ActivityController extends GetxController { + var selectedIndices = [].obs; + var firstSelectedIndex = Rxn(); + var isFirstSelectionActive = false.obs; + + void onContainerTap(int index) { + if (selectedIndices.contains(index)) { + selectedIndices.remove(index); + if (firstSelectedIndex.value == index) { + // If the first selected container is unselected, reset the active state + firstSelectedIndex.value = null; + isFirstSelectionActive.value = false; + selectedIndices.clear(); + } + } else { + if (firstSelectedIndex.value == null) { + // The first item is being selected + firstSelectedIndex.value = index; + isFirstSelectionActive.value = true; + } + selectedIndices.add(index); + } + } + + Color getGradientColor(int index) { + if (selectedIndices.isEmpty) { + return Colors.transparent; + } else if (firstSelectedIndex.value == index && + isFirstSelectionActive.value) { + return Color(0XFFD90B2E); + } else if (selectedIndices.contains(index)) { + return Color(0xFF009DAB); + } + return Colors.transparent; + } +} class SelectIndividualActivity extends StatefulWidget { const SelectIndividualActivity({super.key}); @@ -26,8 +60,8 @@ class SelectIndividualActivity extends StatefulWidget { } class _SelectIndividualActivityState extends State { - final List _selectedIndices = []; TextEditingController otheractivitycontroller = TextEditingController(); + final ActivityController controller = Get.put(ActivityController()); // to select only two containers // void _onContainerTap(int index) { @@ -44,40 +78,6 @@ class _SelectIndividualActivityState extends State { // }); // } - void _onContainerTap(int index) { - setState(() { - if (_selectedIndices.contains(index)) { - _selectedIndices.remove(index); - if (_firstSelectedIndex == index) { - // If the first selected container is unselected, reset the active state - _firstSelectedIndex = null; - _isFirstSelectionActive = false; - _selectedIndices.clear(); - } - } else { - if (_firstSelectedIndex == null) { - // The first item is being selected - _firstSelectedIndex = index; - _isFirstSelectionActive = true; - } - _selectedIndices.add(index); - } - }); - } - - Color _getGradientColor(int index) { - if (_selectedIndices.isEmpty) { - return Colors.transparent; - } else if (_firstSelectedIndex == index && _isFirstSelectionActive) { - // Apply Color(0XFFD90B2E) to the first selected item - return Color(0XFFD90B2E); - } else if (_selectedIndices.contains(index)) { - // Apply Color(0xFF009DAB) to all other selected items - return Color(0xFF009DAB); - } - return Colors.transparent; - } - // void _onContainerTap(int id) { // setState(() { // if (_selectedIndices.contains(id)) { @@ -114,7 +114,7 @@ class _SelectIndividualActivityState extends State { Uploadata() async { utils.loader(); - String selectedIndicesString = '[${_selectedIndices.join(',')}]'; + String selectedIndicesString = '[${controller.selectedIndices.join(',')}]'; Map updata = { "manage_interest_xid": selectedIndicesString, "other_interest": otheractivitycontroller.text, @@ -145,11 +145,11 @@ class _SelectIndividualActivityState extends State { child: CustomButton( text: "Continue", onPressed: () { - if (_selectedIndices.isEmpty && + if (controller.selectedIndices.isEmpty && otheractivitycontroller.text.isEmpty) { utils.showToast('Please select activity'); } else { - print(_selectedIndices.toString()); + print(controller.selectedIndices.toString()); // String selectedIndicesString = // _selectedIndices.join(','); // print( @@ -292,8 +292,7 @@ class _SelectIndividualActivityState extends State { text20400white( 'What are your interests?'), // sizedBoxHeight(5.w), - - _isFirstSelectionActive + controller.isFirstSelectionActive.value ? text13400A7A7A7( 'Select your secondary interests') : text13400A7A7A7( @@ -336,13 +335,7 @@ class _SelectIndividualActivityState extends State { image: indiactivityobj! .data![index].image, // 'assets/images/svg/individualact7.svg', - isSelected: _selectedIndices - .contains(indiactivityobj! - .data![index].id!), - gradientColor: _getGradientColor( - indiactivityobj! - .data![index].id!), - onTap: _onContainerTap, + controller: controller, ); }, ), @@ -556,103 +549,92 @@ class ActivityContainer extends StatelessWidget { final int index; final String titleString; final String? image; - final bool isSelected; - final Color gradientColor; - final Function(int) onTap; + final ActivityController controller; ActivityContainer({ required this.index, required this.titleString, required this.image, - required this.isSelected, - required this.gradientColor, - required this.onTap, + required this.controller, }); @override Widget build(BuildContext context) { - return GestureDetector( - onTap: () => onTap(index), - child: Container( - // width: 110.w, - // height: 120.h, - decoration: ShapeDecoration( - gradient: LinearGradient( - begin: const Alignment(0.98, 0.10), - end: const Alignment(-0.40, -0.70), - colors: isSelected - ? _firstSelectedIndex == index && - _isFirstSelectionActive == true - ? [ - Color(0xFF009DAB).withOpacity(0.80), - Color(0xFF009DAB).withOpacity(0.77), - gradientColor.withOpacity(0.70), - gradientColor.withOpacity(0.50), - ] + return Obx( + () { + bool isSelected = controller.selectedIndices.contains(index); + Color gradientColor = controller.getGradientColor(index); + + return GestureDetector( + onTap: () => controller.onContainerTap(index), + child: Container( + decoration: ShapeDecoration( + gradient: LinearGradient( + begin: const Alignment(0.98, 0.10), + end: const Alignment(-0.40, -0.70), + colors: isSelected + ? controller.firstSelectedIndex.value == index && + controller.isFirstSelectionActive.value + ? [ + Color(0xFF009DAB).withOpacity(0.80), + Color(0xFF009DAB).withOpacity(0.77), + gradientColor.withOpacity(0.70), + gradientColor.withOpacity(0.50), + ] + : [ + Colors.white.withOpacity(0.06), + Colors.white.withOpacity(0.08), + ] : [ Colors.white.withOpacity(0.06), Colors.white.withOpacity(0.08), - ] - : [ - Colors.white.withOpacity(0.06), - Colors.white.withOpacity(0.08), - ], - ), - shape: RoundedRectangleBorder( - side: isSelected - ? _firstSelectedIndex == index && - _isFirstSelectionActive == true - ? BorderSide(width: 0.4.w, color: Colors.transparent) - : BorderSide(width: 3.w, color: gradientColor) - : BorderSide(width: 2.w, color: Color(0xFF434A53)), - borderRadius: BorderRadius.circular(10), - ), - ), - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 0.w, vertical: 10.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - // image.isEmpty - // ? SvgPicture.asset( - // "assets/images/svg/individualact7.svg", - // width: 50.w, - // height: 50.h, - // ) - // : Image.network(image), - image == null || image!.isEmpty - ? Image.asset( - 'assets/images/png/redregroup.png', - color: Colors.white, - width: 50.w, - height: 50.h, - ) - // SvgPicture.asset( - // "assets/images/svg/individualact7.svg", - // width: 50.w, - // height: 50.h, - // ) - : Image.network( - image!, - width: 50.w, - height: 50.h, - ), - const Spacer(flex: 3), - SizedBox( - child: Text( - titleString, - style: TextStyle( - fontSize: 14.sp, - color: Colors.white, - fontWeight: FontWeight.w400, - ), - textAlign: TextAlign.center, - ), + ], ), - ], + shape: RoundedRectangleBorder( + side: isSelected + ? controller.firstSelectedIndex.value == index && + controller.isFirstSelectionActive.value + ? BorderSide(width: 0.4.w, color: Colors.transparent) + : BorderSide(width: 3.w, color: gradientColor) + : BorderSide(width: 2.w, color: Color(0xFF434A53)), + borderRadius: BorderRadius.circular(10), + ), + ), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 0.w, vertical: 10.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + image == null || image!.isEmpty + ? Image.asset( + 'assets/images/png/redregroup.png', + color: Colors.white, + width: 50.w, + height: 50.h, + ) + : Image.network( + image!, + width: 50.w, + height: 50.h, + ), + const Spacer(flex: 3), + SizedBox( + child: Text( + titleString, + style: TextStyle( + fontSize: 14.sp, + color: Colors.white, + fontWeight: FontWeight.w400, + ), + textAlign: TextAlign.center, + ), + ), + ], + ), + ), ), - ), - ), + ); + }, ); } } diff --git a/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart b/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart index 2dc972a..6af995e 100644 --- a/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart +++ b/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart @@ -18,6 +18,7 @@ import 'package:regroup/Main_Screens/Community_HomePage/view_model/CountersHelpe import 'package:regroup/Utils/Common/CommonAppbar.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/Community/MyCommunity/view_model/ComDetails.dart'; @@ -45,20 +46,36 @@ class _CommunityDetailsState extends State { super.initState(); } + leaveCommunity() async { + utils.loader(); + Map updata = {}; + final data = + await CommunityDetail().postLeaveCommunity(updata, CommunityId); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + Get.offNamed(RouteName.mycommunity); + // toggleSelectedIndex(tagid); + return utils.showToast(data.message); + } else { + Get.back(); + return utils.showToast(data.message); + } + } + @override Widget build(BuildContext context) { return Scaffold( // key: _scaffoldKey1, - backgroundColor: Color(0xFF222935), + backgroundColor: const Color(0xFF222935), extendBody: true, resizeToAvoidBottomInset: false, appBar: CommonAppbar( titleTxt: "", customActionWidget: PopupMenuButton( - surfaceTintColor: Color(0xFF222935), - constraints: BoxConstraints.tightFor(width: 180.w), - offset: Offset(0, 40), - color: Color(0xFF222935), + surfaceTintColor: const Color(0xFF222935), + constraints: BoxConstraints.tightFor(width: 190.w), + offset: const Offset(0, 40), + color: const Color(0xFF222935), tooltip: "", itemBuilder: (BuildContext context) => [ PopupMenuItem( @@ -68,7 +85,7 @@ class _CommunityDetailsState extends State { child: Row( children: [ text14w400white("Invite"), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/uiw_user-add.png", height: 15.h, @@ -78,7 +95,7 @@ class _CommunityDetailsState extends State { ), ), ), - PopupMenuDivider(), + const PopupMenuDivider(), PopupMenuItem( onTap: () {}, child: Padding( @@ -86,7 +103,7 @@ class _CommunityDetailsState extends State { child: Row( children: [ text14w400white("Share"), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/share.png", height: 20.h, @@ -96,7 +113,7 @@ class _CommunityDetailsState extends State { ), ), ), - PopupMenuDivider(), + const PopupMenuDivider(), PopupMenuItem( onTap: () {}, child: Padding( @@ -104,7 +121,7 @@ class _CommunityDetailsState extends State { child: Row( children: [ text14w400white("Search"), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/Frame 58575.png", height: 18.h, @@ -114,7 +131,7 @@ class _CommunityDetailsState extends State { ), ), ), - PopupMenuDivider(), + const PopupMenuDivider(), PopupMenuItem( onTap: () {}, child: Padding( @@ -122,7 +139,7 @@ class _CommunityDetailsState extends State { child: Row( children: [ text14w400white("Mute notification"), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/Black1233.png", height: 16.h, @@ -132,7 +149,7 @@ class _CommunityDetailsState extends State { ), ), ), - PopupMenuDivider(), + const PopupMenuDivider(), PopupMenuItem( onTap: () {}, child: Padding( @@ -140,7 +157,7 @@ class _CommunityDetailsState extends State { child: Row( children: [ text14w400white("Pin"), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/f7_pin-fill (2).png", height: 25.h, @@ -150,21 +167,19 @@ class _CommunityDetailsState extends State { ), ), ), - PopupMenuDivider(), + const PopupMenuDivider(), PopupMenuItem( onTap: () { - Get.toNamed(RouteName.communitysetting,arguments: { - 'communityid' : CommunityId, - }); + leaveCommunity(); }, child: Padding( padding: EdgeInsets.symmetric(horizontal: 8.w), child: Row( children: [ - text14w400white("Edit community"), - Spacer(), + text14w400white("Leave community"), + const Spacer(), Image.asset( - "assets/images/png/setting2.png", + "assets/images/png/logout 1 (traced).png", height: 18.h, width: 18.w, ) @@ -249,10 +264,10 @@ class _CommunityDetailsState extends State { decoration: BoxDecoration( shape: BoxShape.circle, border: Border.all( - color: Color.fromRGBO(255, 255, 255, 0.5), + color: const Color.fromRGBO(255, 255, 255, 0.5), width: 1, ), - boxShadow: [ + boxShadow: const [ BoxShadow( color: Color.fromRGBO(0, 0, 0, 0.25), blurRadius: 12, @@ -260,21 +275,21 @@ class _CommunityDetailsState extends State { ), ], ), - child: comdetailobj!.data!.communityProfilePhoto != - null - ? CircleAvatar( - radius: 42.5.r, - foregroundImage: NetworkImage(comdetailobj! - .data! - .communityProfilePhoto!), // Replace with your API image URL - backgroundColor: Colors - .transparent, // Optional: If the image fails to load, a transparent background is shown - ) - : CircleAvatar( - radius: 42.5.r, - foregroundImage: - AssetImage("assets/images/png/img2.png"), - ), + child: + comdetailobj!.data!.communityProfilePhoto != null + ? CircleAvatar( + radius: 42.5.r, + foregroundImage: NetworkImage(comdetailobj! + .data! + .communityProfilePhoto!), // Replace with your API image URL + backgroundColor: Colors + .transparent, // Optional: If the image fails to load, a transparent background is shown + ) + : CircleAvatar( + radius: 42.5.r, + foregroundImage: const AssetImage( + "assets/images/png/img2.png"), + ), )) ]), sizedBoxHeight(40.h), @@ -285,7 +300,7 @@ class _CommunityDetailsState extends State { children: [ text20w700_FCFCFC( comdetailobj!.data!.communityName ?? ""), - Spacer(), + const Spacer(), commonGlassUI( width: 35.w, height: 35.h, @@ -409,7 +424,7 @@ class _CommunityDetailsState extends State { ), sizedBoxWidth(90.w), text16w400_white('7 members'), - Spacer(), + const Spacer(), Icon( Icons.arrow_forward, size: 20.sp, @@ -447,7 +462,7 @@ class _CommunityDetailsState extends State { sizedBoxWidth(15.w), text16w400white( '${comdetailobj!.data!.totalGroup} groups'), - Spacer(), + const Spacer(), Icon( Icons.arrow_forward, size: 20.sp, @@ -492,12 +507,12 @@ class _CommunityDetailsState extends State { "${comdetailobj!.data!.totalAnnouncements.toString()} New Announcements Request") ], ), - Spacer(), + const Spacer(), Container( height: 21.h, width: 43.w, decoration: BoxDecoration( - color: Color(0xFFD90B2E), + color: const Color(0xFFD90B2E), borderRadius: BorderRadius.circular(30.r)), child: Center( @@ -517,7 +532,7 @@ class _CommunityDetailsState extends State { height: 40.h, width: 200.w, decoration: BoxDecoration( - color: Color(0xFFD90B2E), + color: const Color(0xFFD90B2E), borderRadius: BorderRadius.circular(30.r)), child: Center( child: text14w400white("Leave the community")), @@ -529,7 +544,7 @@ class _CommunityDetailsState extends State { // initialIndex: selectedIndex.value, child: Column( children: [ - CommonTabBar(tabs: const [ + const CommonTabBar(tabs: [ Tab( text: 'Posts', ), @@ -541,7 +556,7 @@ class _CommunityDetailsState extends State { height: 600.h, child: TabBarView( children: [ - PostsTab(), + const PostsTab(), eventstab(), ], ), @@ -778,7 +793,7 @@ class _PostsTabState extends State { } Widget eventstab() { - return Column( + return const Column( children: [], ); } @@ -830,7 +845,7 @@ Widget normalcardtile({ sizedBoxWidth(7.w), Icon( Icons.circle, - color: Color(0xFFFCFCFC), + color: const Color(0xFFFCFCFC), size: 4.sp, ), sizedBoxWidth(6.w), @@ -839,12 +854,12 @@ Widget normalcardtile({ ) ], ), - Spacer(), + const Spacer(), PopupMenuButton( - surfaceTintColor: Color(0xFF222935), + surfaceTintColor: const Color(0xFF222935), constraints: BoxConstraints.tightFor(width: 176.w), - offset: Offset(0, 50), - color: Color(0xFF222935), + offset: const Offset(0, 50), + color: const Color(0xFF222935), tooltip: "", itemBuilder: (BuildContext context) => [ PopupMenuItem( @@ -862,7 +877,7 @@ Widget normalcardtile({ fontFamily: "Nunito Sans", ), ), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/Vector (5).png", height: 15.h, @@ -872,7 +887,7 @@ Widget normalcardtile({ ), ), ), - PopupMenuDivider(), + const PopupMenuDivider(), PopupMenuItem( onTap: () {}, child: Padding( @@ -888,7 +903,7 @@ Widget normalcardtile({ fontFamily: "Nunito Sans", ), ), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/share.png", height: 20.h, @@ -898,7 +913,7 @@ Widget normalcardtile({ ), ), ), - PopupMenuDivider(), + const PopupMenuDivider(), PopupMenuItem( onTap: () {}, child: Padding( @@ -914,7 +929,7 @@ Widget normalcardtile({ fontFamily: "Nunito Sans", ), ), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/f7_pin-fill (2).png", height: 25.h, @@ -979,7 +994,7 @@ Widget normalcardtile({ 'assets/images/png/heart 2.png', 'assets/images/png/party-popper 2.png' ]), - Spacer(), + const Spacer(), commonGlassUI( borderwidth: 0.43, width: 30.w, @@ -1062,11 +1077,11 @@ Widget normalcardtile({ boxRadius: 30, itemsSpacing: 8, itemScale: 0.4, - itemSize: Size(45, 45), - boxPadding: EdgeInsets.all(8), - boxAnimationDuration: Duration(milliseconds: 200), - itemAnimationDuration: Duration(milliseconds: 500), - hoverDuration: Duration(milliseconds: 700), + 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), @@ -1140,7 +1155,7 @@ Widget containertile({required String text}) { width: 100.w, height: 30.h, borderRadius: BorderRadius.circular(30.r), - borderColor: Color(0xFFD90B2E), + borderColor: const Color(0xFFD90B2E), customWidget: Padding( padding: EdgeInsets.symmetric(horizontal: 10.w), child: Center(child: text14w400_FCFCFC(text)), diff --git a/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart b/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart index 2374dff..b5f5549 100644 --- a/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart +++ b/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart @@ -71,78 +71,84 @@ class _MyCommunityState extends State { @override Widget build(BuildContext context) { - return Scaffold( - // key: _scaffoldKey1, - backgroundColor: const Color(0xFF222935), - extendBody: true, - resizeToAvoidBottomInset: false, - appBar: CommonAppbar( - titleTxt: "My Communities", - customActionWidget: Row( - children: [ - GestureDetector( - onTap: () { - Get.toNamed(RouteName.newcommunity); - }, - 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, + 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( + titleTxt: "My Communities", + customActionWidget: Row( + children: [ + GestureDetector( + onTap: () { + Get.toNamed(RouteName.newcommunity); + }, + 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, - ) - ], + 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, - children: [ - Center( - child: CircularProgressIndicator( - color: Color(0xFFC18948), - ), - ) - ], - ); - } - if (snapshot.connectionState == ConnectionState.done) { - if (snapshot.hasError) { - return Center( - child: Text( - '${snapshot.error} occured', - style: TextStyle(fontSize: 18.spMin), - ), + body: FutureBuilder( + future: myfuture, + builder: (ctx, snapshot) { + if (snapshot.data == null) { + return const Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: CircularProgressIndicator( + color: Color(0xFFC18948), + ), + ) + ], ); } - } - return 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), + ), + ); + } + } + return myCommunityobj!.data!.isEmpty + ? _buildNoDataBody(context) + : _buildBody(context); + }, + ), ), ); } @@ -200,7 +206,9 @@ class _MyCommunityState extends State { padding: EdgeInsets.only(bottom: 25.h), child: GestureDetector( onTap: () { - Get.toNamed(RouteName.communityDetails, arguments: {"CommunityID" : joinnedComData.manageCommunityXid}); + Get.toNamed(RouteName.communityDetails, arguments: { + "CommunityID": joinnedComData.manageCommunityXid + }); }, child: commonGlassUI( borderwidth: 0.9, diff --git a/lib/sidemenu/Community/MyCommunity/view_model/ComDetails.dart b/lib/sidemenu/Community/MyCommunity/view_model/ComDetails.dart index 03ea356..4c7a265 100644 --- a/lib/sidemenu/Community/MyCommunity/view_model/ComDetails.dart +++ b/lib/sidemenu/Community/MyCommunity/view_model/ComDetails.dart @@ -41,4 +41,15 @@ class CommunityDetail { response.data['message'], ResponseStatus.FAILED); } } + + Future> postLeaveCommunity(updata, comId) async { + final response = await NetworkApiServices().postApi( + updata, + "${ApiUrls.postleavecommunity}?manage_community_xid=$comId", + ); + if (response.status == ResponseStatus.SUCCESS) { + + } + return response; + } } \ No newline at end of file