conflict solved for page refresh in communkty details page if iser goes to edit cmmunity

This commit is contained in:
Shubhamshirva
2024-08-22 13:20:34 +05:30
parent ef0c761b95
commit 2d0ca49d1b
2 changed files with 78 additions and 55 deletions

View File

@@ -19,57 +19,64 @@ class _CommunitySettingState extends State<CommunitySetting> {
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({

View File

@@ -42,6 +42,13 @@ class _CommunityDetailsState extends State<CommunityDetails> {
super.initState();
}
void refreshData() {
setState(() {
myfuture = CommunityDetail().getCommunityDetail(CommunityId);
});
}
leaveCommunity() async {
utils.loader();
Map<String, dynamic> updata = {};
@@ -166,7 +173,7 @@ class _CommunityDetailsState extends State<CommunityDetails> {
const PopupMenuDivider(),
PopupMenuItem(
onTap: () {
Get.toNamed(RouteName.communitysetting, arguments: {
Get.toNamed(RouteName.communitysetting, arguments: {
'communityid': CommunityId,
});
},
@@ -207,10 +214,19 @@ class _CommunityDetailsState extends State<CommunityDetails> {
),
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),