Merge pull request #162 from WDI-Ideas/RegroupPriyanka

pin unpin problem solved in mycommunity screen
This commit is contained in:
priyankahadpad
2024-08-26 17:13:08 +05:30
committed by GitHub
4 changed files with 201 additions and 182 deletions

View File

@@ -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(

View File

@@ -228,24 +228,8 @@ class _CommunityDetailsState extends State<CommunityDetails> {
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<CommunityDetails> {
.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<CommunityDetails> {
GestureDetector(
onTap: () {
// Get.toNamed(RouteName.addgroup);
Get.toNamed(RouteName.group, arguments: {
Get.toNamed(RouteName.announcement, arguments: {
'id': CommunityId,
'iscommunity': true,
});

View File

@@ -50,149 +50,149 @@ class _MyCommunityState extends State<MyCommunity> {
void refreshData() {
setState(() {
myfuture = MyCommunityAPI().getMyCommunity();
// await MyCommunityAPI().getMyCommunity();
});
}
Future<void> 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<MyCommunity> {
if (result != null && result) {
refreshData();
print("Updating community details...");
print("Updating community details...$result");
}
},
child: commonGlassUI(
@@ -484,6 +484,7 @@ class _MyCommunityState extends State<MyCommunity> {
// .joinedAndRequestedCommunity!
// .id
// .toString());
Map<String, dynamic> updata = {
"manage_communities_xid":
myCommunityobj!
@@ -523,28 +524,8 @@ class _MyCommunityState extends State<MyCommunity> {
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<MyCommunity> {
.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!

View File

@@ -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<RequestedTab> {
.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<RequestedTab> {
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<InvitedTab> {
borderRadius:
BorderRadius
.circular(30.r),
color:
Color(0xFFD90B2E)),
color: const Color(
0xFFD90B2E)),
child: Center(
child:
text12w400_FCFCFC(