pin mute problem solved
This commit is contained in:
@@ -24,38 +24,10 @@ class MyCommunity extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MyCommunityState extends State<MyCommunity> {
|
||||
int? ismute;
|
||||
List<int> isMuteList = [];
|
||||
List<bool> isPinList = [];
|
||||
|
||||
bool? iscommunitypin = false;
|
||||
List JoinedcommunityData = [
|
||||
{
|
||||
"imagePath": "assets/images/png/img2.png",
|
||||
"text": "Active alliance network",
|
||||
"members": "7 members",
|
||||
"index": 1,
|
||||
},
|
||||
{
|
||||
"imagePath": "assets/images/png/img34.png",
|
||||
"text": "FitFam federation",
|
||||
"members": "7 members",
|
||||
"index": 2,
|
||||
},
|
||||
];
|
||||
|
||||
List RequestcommunityData = [
|
||||
{
|
||||
"imagePath": "assets/images/png/img45.png",
|
||||
"text": "The athletic town",
|
||||
"members": "7 members",
|
||||
"index": 3,
|
||||
},
|
||||
{
|
||||
"imagePath": "assets/images/png/img2.png",
|
||||
"text": "Football fever",
|
||||
"members": "7 members",
|
||||
"index": 4,
|
||||
},
|
||||
];
|
||||
|
||||
var selectedContainerIndices = <int>{}.obs;
|
||||
|
||||
void toggleSelectedIndex(int index) {
|
||||
@@ -76,26 +48,6 @@ class _MyCommunityState extends State<MyCommunity> {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
pinunpinCommunity(String communitypinid) async {
|
||||
// utils.loader();
|
||||
Map<String, dynamic> updata = {
|
||||
"manage_communities_xid": communitypinid,
|
||||
};
|
||||
final data = await SidebarTags().postUserpin(updata);
|
||||
if (data.status == ResponseStatus.SUCCESS) {
|
||||
print("success");
|
||||
// Get.back();
|
||||
setState(() {});
|
||||
await MyCommunityAPI().getMyCommunity();
|
||||
iscommunitypin = !iscommunitypin!;
|
||||
|
||||
return utils.showToast(data.message);
|
||||
} else {
|
||||
// Get.back();
|
||||
return utils.showToast(data.message);
|
||||
}
|
||||
}
|
||||
|
||||
void refreshData() {
|
||||
setState(() {
|
||||
myfuture = MyCommunityAPI().getMyCommunity();
|
||||
@@ -192,13 +144,13 @@ class _MyCommunityState extends State<MyCommunity> {
|
||||
for (int i = 0; i < myCommunityobj!.data.length; i++) {
|
||||
// Check if the current data item and its joinedAndRequestedCommunity property are not null
|
||||
|
||||
ismute = myCommunityobj!
|
||||
.data[i].isMute; // Handle null with a default value if needed
|
||||
isMuteList.add(myCommunityobj!.data[i].isMute!);
|
||||
|
||||
if (myCommunityobj!.data[i].joinedAndRequestedCommunity != null) {
|
||||
iscommunitypin = myCommunityobj!.data[i]
|
||||
.joinedAndRequestedCommunity!.isCommunityPinned ??
|
||||
false; // Handle null with a default value if needed
|
||||
isPinList.add(myCommunityobj!
|
||||
.data[i]
|
||||
.joinedAndRequestedCommunity!
|
||||
.isCommunityPinned!); // Handle null with a default value if needed
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,8 +169,15 @@ class _MyCommunityState extends State<MyCommunity> {
|
||||
children: [
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.requestscreen);
|
||||
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"))
|
||||
@@ -472,13 +431,14 @@ class _MyCommunityState extends State<MyCommunity> {
|
||||
updata);
|
||||
if (data.status ==
|
||||
ResponseStatus.SUCCESS) {
|
||||
print("success");
|
||||
setState(() {});
|
||||
if (isMuteList[index] == 1) {
|
||||
isMuteList[index] = 0;
|
||||
} else {
|
||||
isMuteList[index] = 1;
|
||||
}
|
||||
await MyCommunityAPI()
|
||||
.getMyCommunity();
|
||||
bool isMuted = ismute == 1;
|
||||
isMuted = !isMuted;
|
||||
ismute = isMuted ? 1 : 0;
|
||||
setState(() {});
|
||||
|
||||
return utils
|
||||
.showToast(data.message);
|
||||
@@ -494,13 +454,13 @@ class _MyCommunityState extends State<MyCommunity> {
|
||||
horizontal: 8.w),
|
||||
child: Row(
|
||||
children: [
|
||||
ismute == 1
|
||||
isMuteList[index] == 1
|
||||
? text14w400white(
|
||||
"Unmute community")
|
||||
: text14w400white(
|
||||
"Mute community"),
|
||||
const Spacer(),
|
||||
ismute == 1
|
||||
isMuteList[index] == 1
|
||||
? Image.asset(
|
||||
"assets/images/png/Black1233.png",
|
||||
height: 16.h,
|
||||
@@ -518,19 +478,51 @@ class _MyCommunityState extends State<MyCommunity> {
|
||||
const PopupMenuDivider(),
|
||||
PopupMenuItem(
|
||||
onTap: () async {
|
||||
await pinunpinCommunity(
|
||||
myCommunityobj!
|
||||
.data[index]
|
||||
.joinedAndRequestedCommunity!
|
||||
.id
|
||||
.toString());
|
||||
// await pinunpinCommunity(
|
||||
// myCommunityobj!
|
||||
// .data[index]
|
||||
// .joinedAndRequestedCommunity!
|
||||
// .id
|
||||
// .toString());
|
||||
Map<String, dynamic> updata = {
|
||||
"manage_communities_xid":
|
||||
myCommunityobj!
|
||||
.data[index]
|
||||
.joinedAndRequestedCommunity!
|
||||
.id
|
||||
.toString(),
|
||||
};
|
||||
final data = await SidebarTags()
|
||||
.postUserpin(updata);
|
||||
if (data.status ==
|
||||
ResponseStatus.SUCCESS) {
|
||||
isPinList[index] =
|
||||
!isPinList[index];
|
||||
|
||||
await MyCommunityAPI()
|
||||
.getMyCommunity();
|
||||
setState(() {});
|
||||
print("success");
|
||||
|
||||
// // Get.back();
|
||||
// setState(() {});
|
||||
// await MyCommunityAPI().getMyCommunity();
|
||||
// iscommunitypin = !iscommunitypin!;
|
||||
|
||||
return utils
|
||||
.showToast(data.message);
|
||||
} else {
|
||||
// Get.back();
|
||||
return utils
|
||||
.showToast(data.message);
|
||||
}
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 12.w),
|
||||
child: Row(
|
||||
children: [
|
||||
iscommunitypin == true
|
||||
isPinList[index] == true
|
||||
? Text(
|
||||
'Unpin ',
|
||||
style: TextStyle(
|
||||
@@ -554,7 +546,7 @@ class _MyCommunityState extends State<MyCommunity> {
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
iscommunitypin == true
|
||||
isPinList[index] == true
|
||||
? Image.asset(
|
||||
"assets/images/png/PinnedIcon.png",
|
||||
height: 25.h,
|
||||
|
||||
@@ -32,59 +32,66 @@ class _RequestsScreenState extends State<RequestsScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
// key: _scaffoldKey1,
|
||||
backgroundColor: const Color(0xFF222935),
|
||||
extendBody: true,
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: CommonAppbar(
|
||||
titleTxt: "Request and Invites",
|
||||
customActionWidget: Row(
|
||||
children: [
|
||||
sizedBoxWidth(12.w),
|
||||
Image.asset(
|
||||
"assets/images/png/Frame 9.png",
|
||||
height: 22.h,
|
||||
width: 22.w,
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
Get.back(result: true);
|
||||
return true;
|
||||
},
|
||||
child: Scaffold(
|
||||
// key: _scaffoldKey1,
|
||||
backgroundColor: const Color(0xFF222935),
|
||||
extendBody: true,
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: CommonAppbar(
|
||||
customBack: true,
|
||||
titleTxt: "Request and Invites",
|
||||
customActionWidget: Row(
|
||||
children: [
|
||||
sizedBoxWidth(12.w),
|
||||
Image.asset(
|
||||
"assets/images/png/Frame 9.png",
|
||||
height: 22.h,
|
||||
width: 22.w,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
body: Stack(children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage("assets/images/png/Ellipse 1496.png"),
|
||||
fit: BoxFit.fill)),
|
||||
),
|
||||
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
sizedBoxHeight(20.h),
|
||||
const Expanded(
|
||||
child: DefaultTabController(
|
||||
length: 2,
|
||||
child: Column(
|
||||
children: [
|
||||
CommonTabBar(tabs: [
|
||||
Tab(
|
||||
text: 'Requested',
|
||||
),
|
||||
Tab(
|
||||
text: 'Invited',
|
||||
),
|
||||
]),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
children: [
|
||||
RequestedTab(),
|
||||
InvitedTab(),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
body: Stack(children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage("assets/images/png/Ellipse 1496.png"),
|
||||
fit: BoxFit.fill)),
|
||||
),
|
||||
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
sizedBoxHeight(20.h),
|
||||
const Expanded(
|
||||
child: DefaultTabController(
|
||||
length: 2,
|
||||
child: Column(
|
||||
children: [
|
||||
CommonTabBar(tabs: [
|
||||
Tab(
|
||||
text: 'Requested',
|
||||
),
|
||||
Tab(
|
||||
text: 'Invited',
|
||||
),
|
||||
]),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
children: [
|
||||
RequestedTab(),
|
||||
InvitedTab(),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
)
|
||||
])
|
||||
]));
|
||||
])
|
||||
])),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user