From 2d0ca49d1b90c2b446dc78c6ae9425fccd358fb9 Mon Sep 17 00:00:00 2001 From: Shubhamshirva Date: Thu, 22 Aug 2024 13:20:34 +0530 Subject: [PATCH] conflict solved for page refresh in communkty details page if iser goes to edit cmmunity --- .../Community settings/CommunitySetting.dart | 107 ++++++++++-------- .../MyCommunity/View/CommunityDetails.dart | 26 ++++- 2 files changed, 78 insertions(+), 55 deletions(-) diff --git a/lib/sidemenu/Community/Admin/PopupItem/Community settings/CommunitySetting.dart b/lib/sidemenu/Community/Admin/PopupItem/Community settings/CommunitySetting.dart index 6684d16..f0cbde2 100644 --- a/lib/sidemenu/Community/Admin/PopupItem/Community settings/CommunitySetting.dart +++ b/lib/sidemenu/Community/Admin/PopupItem/Community settings/CommunitySetting.dart @@ -19,57 +19,64 @@ class _CommunitySettingState extends State { int communityid = Get.arguments['communityid']; @override Widget build(BuildContext context) { - return Scaffold( - // key: _scaffoldKey1, - backgroundColor: Color(0xFF222935), - extendBody: true, - resizeToAvoidBottomInset: false, - appBar: CommonAppbar( - titleTxt: "Community settings", - ), - body: Stack(children: [ - Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/png/Ellipse 1496.png"), - fit: BoxFit.fill)), + return WillPopScope( + onWillPop: () async{ + Get.back(result: true); + return true; + }, + child: Scaffold( + // key: _scaffoldKey1, + backgroundColor: Color(0xFF222935), + extendBody: true, + resizeToAvoidBottomInset: false, + appBar: CommonAppbar( + titleTxt: "Community settings", + customBack: true, ), - Column(children: [ - sizedBoxHeight(30.h), - GestureDetector( - onTap: () { - Get.toNamed(RouteName.editcommunity, arguments: { - 'communityid': communityid, - }); - }, - child: rowTile(text: 'Edit community info')), - commonDivider(), - GestureDetector( - onTap: () { - Get.toNamed(RouteName.managemembers); - }, - child: rowTile(text: 'Manage members')), - commonDivider(), - GestureDetector( - onTap: () { - Get.toNamed(RouteName.managegroups, - arguments: { - 'communityid' : communityid, - } - ); - }, - child: rowTile(text: 'Manage groups')), - commonDivider(), - GestureDetector( - onTap: () { - Get.toNamed(RouteName.managetags, arguments: { - 'communityid': communityid, - }); - }, - child: rowTile(text: 'Manage interest')), - sizedBoxHeight(20.h), - ]) - ])); + body: Stack(children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Column(children: [ + sizedBoxHeight(30.h), + GestureDetector( + onTap: () { + Get.toNamed(RouteName.editcommunity, arguments: { + 'communityid': communityid, + }); + }, + child: rowTile(text: 'Edit community info')), + commonDivider(), + GestureDetector( + onTap: () { + Get.toNamed(RouteName.managemembers); + }, + child: rowTile(text: 'Manage members')), + commonDivider(), + GestureDetector( + onTap: () { + Get.toNamed(RouteName.managegroups, + arguments: { + 'communityid' : communityid, + } + ); + }, + child: rowTile(text: 'Manage groups')), + commonDivider(), + GestureDetector( + onTap: () { + Get.toNamed(RouteName.managetags, arguments: { + 'communityid': communityid, + }); + }, + child: rowTile(text: 'Manage interest')), + sizedBoxHeight(20.h), + ]) + ])), + ); } Widget rowTile({ diff --git a/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart b/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart index 12fe0f3..5a7cb3a 100644 --- a/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart +++ b/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart @@ -42,6 +42,13 @@ class _CommunityDetailsState extends State { super.initState(); } + + void refreshData() { + setState(() { + myfuture = CommunityDetail().getCommunityDetail(CommunityId); + }); + } + leaveCommunity() async { utils.loader(); Map updata = {}; @@ -166,7 +173,7 @@ class _CommunityDetailsState extends State { const PopupMenuDivider(), PopupMenuItem( onTap: () { - Get.toNamed(RouteName.communitysetting, arguments: { + Get.toNamed(RouteName.communitysetting, arguments: { 'communityid': CommunityId, }); }, @@ -207,10 +214,19 @@ class _CommunityDetailsState extends State { ), PopupMenuDivider(), PopupMenuItem( - onTap: () { - Get.toNamed(RouteName.communitysetting, arguments: { - 'communityid': CommunityId, - }); + onTap: () async { + var result = await Get.toNamed( + RouteName.communitysetting, + arguments: { + 'communityid': CommunityId, + }); + if (result != null && result) { + refreshData(); + // CommunityDetail().getCommunityDetail(CommunityId); + print("Updating community details..."); + // setState(() {}); + + } }, child: Padding( padding: EdgeInsets.symmetric(horizontal: 8.w),