Merge pull request #155 from WDI-Ideas/RegroupPriyanka

minor bug fixing of null check
This commit is contained in:
priyankahadpad
2024-08-23 17:41:14 +05:30
committed by GitHub
8 changed files with 703 additions and 580 deletions

View File

@@ -123,6 +123,8 @@ class _SelectIndividualActivityState extends State<SelectIndividualActivity> {
final data = await Onboard().PostIndividualActivity(updata);
if (data.status == ResponseStatus.SUCCESS) {
Get.back();
controller.selectedIndices.clear();
otheractivitycontroller.clear();
print("Activities selected");
// Get.toNamed(RouteName.individualgroupstep3);
Get.toNamed(RouteName.findcommunitypage);
@@ -147,7 +149,7 @@ class _SelectIndividualActivityState extends State<SelectIndividualActivity> {
onPressed: () {
if (controller.selectedIndices.isEmpty &&
otheractivitycontroller.text.isEmpty) {
utils.showToast('Please select activity');
utils.showToast('Please select interests');
} else {
print(controller.selectedIndices.toString());
// String selectedIndicesString =
@@ -292,11 +294,12 @@ class _SelectIndividualActivityState extends State<SelectIndividualActivity> {
text20400white(
'What are your interests?'),
// sizedBoxHeight(5.w),
controller.isFirstSelectionActive.value
? text13400A7A7A7(
'Select your secondary interests')
: text13400A7A7A7(
'Select your primary interest'),
Obx(() {
return text13400A7A7A7(controller
.isFirstSelectionActive.value
? 'Select your secondary interests'
: 'Select your primary interest');
}),
// Container(
// width: 154.w,

View File

@@ -301,7 +301,7 @@ class _SelectIndividualGroupState extends State<SelectIndividualGroup> {
onPressed: () {
// Get.toNamed(RouteName.individualcommunitystep4);
if (_selectedIndices.isEmpty) {
utils.showToast('Please select activity');
utils.showToast('Please select group');
} else {
print(_selectedIndices.toString());
// String selectedIndicesString =

View File

@@ -65,13 +65,14 @@ class _SelectIndividualCommunityState extends State<SelectIndividualCommunity> {
print('Payload: $updata');
final data = await Onboard().postCommunities(updata);
if (data.status == ResponseStatus.SUCCESS) {
// Get.back();
print("groups selected");
Get.back();
// Get.toNamed(RouteName.communitycommitscreen);
Get.toNamed(RouteName.individualgroupstep3);
return utils.showToast(data.message);
} else {
Get.back();
@@ -305,7 +306,7 @@ class _SelectIndividualCommunityState extends State<SelectIndividualCommunity> {
onPressed: () {
// Get.toNamed(RouteName.individualcommunitystep4);
if (_selectedIndices.isEmpty) {
utils.showToast('Please select activity');
utils.showToast('Please select community');
} else {
print(_selectedIndices.toString());
// String selectedIndicesString =
@@ -389,8 +390,6 @@ a collection of groups, individuals and businesses that share common interests.
// sizedBoxHeight(40.h)
]))));
}
}
class CommunitySelect extends StatelessWidget {

View File

@@ -152,6 +152,7 @@ class _TellusaboutIndividualState extends State<TellusaboutIndividual> {
Get.back();
mainWelcomeName = fullNameController.text;
Get.toNamed(RouteName.individualactivitystep2);
editProfileImage.profilePicPath.value = '';
} else {
Get.back();
utils.showToast(data.message);
@@ -424,15 +425,19 @@ class _TellusaboutIndividualState extends State<TellusaboutIndividual> {
CustomButton(
text: "Continue",
onPressed: () {
if (fullNameController.text.isBlank! ||
userNameController.text.isBlank! ||
datecontroller.text.isBlank! ||
_selectedgendertype.isEmpty ||
locationcontroller.text.isBlank! ||
// imageFile.text.isBlank! ||
editProfileImage.profilePicPath.value == '') {
if (editProfileImage.profilePicPath.value == '') {
utils
.showToast('Please Upload Profile Picture');
} else if (fullNameController.text.isBlank!) {
utils.showToast('Please enter full name');
} else if (userNameController.text.isBlank!) {
utils.showToast('Please enter user name');
} else if (datecontroller.text.isBlank!) {
utils.showToast('Please select date of birth');
} else if (_selectedgendertype.isEmpty) {
utils.showToast('Please select gender');
} else if (locationcontroller.text.isBlank!) {
utils.showToast('Please enter location');
} else {
TellusUploadData();
}

View File

@@ -122,6 +122,8 @@ class UserLinkInCommunity {
UserLinkInCommunity({
required this.id,
required this.iamPrincipalXid,
required this.totalCommunityMember,
required this.fourMemberImages,
required this.manageCommunityXid,
required this.joinedAt,
required this.userTypeXid,
@@ -131,6 +133,8 @@ class UserLinkInCommunity {
final int? id;
final int? iamPrincipalXid;
final int? totalCommunityMember;
final List<FourMemberImage> fourMemberImages;
final int? manageCommunityXid;
final DateTime? joinedAt;
final AccessType? userTypeXid;
@@ -141,6 +145,8 @@ class UserLinkInCommunity {
return UserLinkInCommunity(
id: json["id"],
iamPrincipalXid: json["iam_principal_xid"],
totalCommunityMember: json["total_community_member"],
fourMemberImages: json["four_member_images"] == null ? [] : List<FourMemberImage>.from(json["four_member_images"]!.map((x) => FourMemberImage.fromJson(x))),
manageCommunityXid: json["manage_community_xid"],
joinedAt: DateTime.tryParse(json["joined_at"] ?? ""),
userTypeXid: json["user_type_xid"] == null ? null : AccessType.fromJson(json["user_type_xid"]),
@@ -150,3 +156,54 @@ class UserLinkInCommunity {
}
}
class FourMemberImage {
FourMemberImage({
required this.iamPrincipalXid,
required this.manageCommunityXid,
required this.iamPrincipal,
});
final int? iamPrincipalXid;
final int? manageCommunityXid;
final IamPrincipal? iamPrincipal;
factory FourMemberImage.fromJson(Map<String, dynamic> json){
return FourMemberImage(
iamPrincipalXid: json["iam_principal_xid"],
manageCommunityXid: json["manage_community_xid"],
iamPrincipal: json["iam_principal"] == null ? null : IamPrincipal.fromJson(json["iam_principal"]),
);
}
}
class IamPrincipal {
IamPrincipal({
required this.id,
required this.principalTypeXid,
required this.userName,
required this.fullName,
required this.profilePhoto,
required this.isUserPinned,
});
final int? id;
final int? principalTypeXid;
final String? userName;
final String? fullName;
final String? profilePhoto;
final bool? isUserPinned;
factory IamPrincipal.fromJson(Map<String, dynamic> json){
return IamPrincipal(
id: json["id"],
principalTypeXid: json["principal_type_xid"],
userName: json["user_name"],
fullName: json["full_name"],
profilePhoto: json["profile_photo"],
isUserPinned: json["is_user_pinned"],
);
}
}

View File

@@ -572,18 +572,58 @@ class _CommunityDetailsState extends State<CommunityDetails> {
child: Row(
children: [
sizedBoxWidth(16.w),
stackContainers(
number: "+2",
containerImages: [
"assets/images/png/cimg3.png",
"assets/images/png/cimg2.png",
"assets/images/png/cimg3.png",
"assets/images/png/cimg2.png",
],
stackContainersGroups(
number:
" +${comdetailobj!.data!.userLinkInCommunity!.totalCommunityMember! - 3}",
// containerImages: joinnedComData
// .fourMemberImages!
// .map((photo) => photo
// .iamPrincipal!.profilePhoto!)
// .toList(),
containerImages: comdetailobj!
.data!
.userLinkInCommunity!
.fourMemberImages
?.map((photo) => photo
.iamPrincipal
?.profilePhoto)
.where((profilePhoto) =>
profilePhoto !=
null)
.map((profilePhoto) =>
profilePhoto!) // Cast from String? to String
.toList() ??
[],
),
sizedBoxWidth(90.w),
text16w400_white(
'7 members'),
sizedBoxWidth(75.w),
comdetailobj!
.data!
.userLinkInCommunity!
.totalCommunityMember ==
null ||
comdetailobj!
.data!
.userLinkInCommunity!
.totalCommunityMember
.isBlank!
? const SizedBox()
: text16w400_FCFCFC_blur(
'${comdetailobj!.data!.userLinkInCommunity!.totalCommunityMember} members',
),
// stackContainers(
// number: "+2",
// containerImages: [
// "assets/images/png/cimg3.png",
// "assets/images/png/cimg2.png",
// "assets/images/png/cimg3.png",
// "assets/images/png/cimg2.png",
// ],
// ),
// sizedBoxWidth(95.w),
// text16w400_white(
// '${comdetailobj!.data!.userLinkInCommunity!.totalCommunityMember} members'
// ''),
const Spacer(),
Icon(
Icons.arrow_forward,

View File

@@ -96,10 +96,11 @@ class _MyCommunityState extends State<MyCommunity> {
}
}
void refreshData() {
void refreshData() {
setState(() {
myfuture = MyCommunityAPI().getMyCommunity();
});}
});
}
@override
Widget build(BuildContext context) {
@@ -114,19 +115,19 @@ class _MyCommunityState extends State<MyCommunity> {
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(() {});
}
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,
@@ -201,9 +202,34 @@ class _MyCommunityState extends State<MyCommunity> {
}
}
return myCommunityobj!.data!.isEmpty
? _buildNoDataBody(context)
: _buildBody(context);
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: () {
Get.toNamed(RouteName.requestscreen);
},
child:
text16w700_FCFCFC_line("Request and Invites"))
],
),
sizedBoxHeight(20.h),
myCommunityobj!.data!.isEmpty
? _buildNoDataBody(context)
: _buildBody(context),
]))
]);
},
),
),
@@ -229,461 +255,423 @@ class _MyCommunityState extends State<MyCommunity> {
}
Widget _buildBody(context) {
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: () {
Get.toNamed(RouteName.requestscreen);
},
child: text16w700_FCFCFC_line("Request and Invites"))
],
),
sizedBoxHeight(20.h),
Expanded(
child: ListView.builder(
shrinkWrap: true,
physics: const ScrollPhysics(),
itemCount: myCommunityobj!.data.length,
itemBuilder: (context, index) {
var joinnedComData = myCommunityobj!.data[index];
return Padding(
padding: EdgeInsets.only(bottom: 25.h),
child: GestureDetector(
onTap: () async {
var result = await Get.toNamed(RouteName.communityDetails, arguments: {
"CommunityID": joinnedComData.manageCommunityXid
});
return Expanded(
child: Column(children: [
sizedBoxHeight(20.h),
Expanded(
child: ListView.builder(
shrinkWrap: true,
physics: const ScrollPhysics(),
itemCount: myCommunityobj!.data.length,
itemBuilder: (context, index) {
var joinnedComData = myCommunityobj!.data[index];
return Padding(
padding: EdgeInsets.only(bottom: 25.h),
child: GestureDetector(
onTap: () async {
var result = await Get.toNamed(RouteName.communityDetails,
arguments: {
"CommunityID": joinnedComData.manageCommunityXid
});
if (result != null && result) {
refreshData();
print("Updating community details...");
if (result != null && result) {
refreshData();
print("Updating community details...");
}
},
child: commonGlassUI(
borderwidth: 0.9,
width: double.infinity,
height: 172.h,
borderRadius: BorderRadius.circular(10.r),
customWidget: Padding(
padding: EdgeInsets.symmetric(
horizontal: 16.w, vertical: 16.h),
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: 65.h,
width: 65.h,
decoration: const BoxDecoration(
shape: BoxShape.circle,
// color: Colors.amber,
),
child:
// Center(
// child: Image.asset(imagepath, fit: BoxFit.cover)),
}
},
child: commonGlassUI(
borderwidth: 0.9,
width: double.infinity,
height: 172.h,
borderRadius: BorderRadius.circular(10.r),
customWidget: Padding(
padding: EdgeInsets.symmetric(
horizontal: 16.w, vertical: 16.h),
child: Column(
children: [
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Container(
height: 65.h,
width: 65.h,
decoration: const BoxDecoration(
shape: BoxShape.circle,
// color: Colors.amber,
),
child:
// Center(
// child: Image.asset(imagepath, fit: BoxFit.cover)),
joinnedComData
.joinedAndRequestedCommunity !=
null &&
joinnedComData
.joinedAndRequestedCommunity!
.communityProfilePhoto !=
null &&
joinnedComData
.joinedAndRequestedCommunity!
.communityProfilePhoto!
.isNotEmpty
? CircleAvatar(
backgroundImage: NetworkImage(
joinnedComData
.joinedAndRequestedCommunity!
.communityProfilePhoto!),
)
: const CircleAvatar(
backgroundImage: AssetImage(
'assets/images/png/img45.png'),
)),
sizedBoxWidth(13.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Container(
// // width: 250.w,
// // color: Colors.red,
// width: double.infinity,
// child:
joinnedComData
.joinedAndRequestedCommunity !=
null &&
joinnedComData
.joinedAndRequestedCommunity!
.communityProfilePhoto !=
null &&
joinnedComData
.joinedAndRequestedCommunity!
.communityProfilePhoto!
.isNotEmpty
? CircleAvatar(
backgroundImage: NetworkImage(
joinnedComData
.joinedAndRequestedCommunity!
.communityProfilePhoto!),
)
: const CircleAvatar(
backgroundImage: AssetImage(
'assets/images/png/img45.png'),
)),
sizedBoxWidth(13.w),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
// Container(
// // width: 250.w,
// // color: Colors.red,
// width: double.infinity,
// child:
SizedBox(
width: 200.w,
child: Text(
joinnedComData.joinedAndRequestedCommunity !=
null &&
joinnedComData
.joinedAndRequestedCommunity!
.communityName !=
null
? joinnedComData
.joinedAndRequestedCommunity!
.communityName!
: "",
style: TextStyle(
fontSize: 16.sp,
color: Colors.white,
fontFamily: "Nunito Sans",
),
maxLines:
2, // Set the maximum number of lines
overflow: TextOverflow
.ellipsis, // Truncate the text with an ellipsis
),
),
SizedBox(
width: 200.w,
child: Text(
joinnedComData.joinedAndRequestedCommunity !=
null &&
joinnedComData
.joinedAndRequestedCommunity!
.communityName !=
null
? joinnedComData
.joinedAndRequestedCommunity!
.communityName!
: "",
style: TextStyle(
fontSize: 16.sp,
color: Colors.white,
fontFamily: "Nunito Sans",
// ),
sizedBoxHeight(10.h),
joinnedComData.totalCommunityMember ==
null ||
joinnedComData.totalCommunityMember!
.toString()
.isEmpty
? const SizedBox()
: sizedBoxHeight(10.h),
Row(
children: [
Stack(
clipBehavior: Clip.none,
children: [
commonGlassUI(
borderwidth: 0.9,
width: 30.w,
height: 30.h,
borderRadius:
BorderRadius.circular(
100.r),
opacity1: 0.24,
opacity2: 0.24,
customWidget: Center(
child: Image.asset(
"assets/images/png/Black.png",
height: 12.h,
width: 16.w,
),
)),
// Positioned(
// top: 0,
// right: -4,
// child: Container(
// height: 12.h,
// width: 12.w,
// decoration:
// const BoxDecoration(
// shape:
// BoxShape.circle,
// color: Color(
// 0xFFD90B2E),
// ),
// child: Center(
// child:
// text6400white(
// "2")
// ),))
]),
sizedBoxWidth(15.w),
text14w400_FCFCFCblur(
"${joinnedComData.joinedAndRequestedCommunity != null && joinnedComData.joinedAndRequestedCommunity!.totalGroup != null ? joinnedComData.joinedAndRequestedCommunity!.totalGroup : ''} groups",
),
sizedBoxWidth(50.w),
GestureDetector(
onTap: () {
toggleSelectedIndex(index);
},
child: Container(
height: 21.h,
width: 57.w,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(50.r),
gradient: const LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
Color.fromRGBO(
255, 255, 255, 0.06),
Color.fromRGBO(
255, 255, 255, 0.08),
],
stops: [-0.0497, 1.0238],
// converting degrees to radians
),
border: Border.all(
color: const Color(0xFF434A53),
width: 1.0,
),
),
child: Center(
child: text10400white("Owner")),
),
),
],
),
],
),
const Spacer(),
PopupMenuButton(
surfaceTintColor: const Color(0xFF222935),
constraints:
BoxConstraints.tightFor(width: 200.w),
offset: const Offset(0, 30),
color: const Color(0xFF222935),
tooltip: "",
itemBuilder: (BuildContext context) =>
<PopupMenuEntry>[
PopupMenuItem(
onTap: () async {
Map<String, dynamic> updata = {
"manage_community_xid":
joinnedComData
.manageCommunityXid,
};
final data =
await CommunityDetail()
.postMuteNotification(
updata);
if (data.status ==
ResponseStatus.SUCCESS) {
print("success");
setState(() {});
await MyCommunityAPI()
.getMyCommunity();
bool isMuted = ismute == 1;
isMuted = !isMuted;
ismute = isMuted ? 1 : 0;
return utils
.showToast(data.message);
} else {
Get.back();
print("Failed");
return utils
.showToast(data.message);
}
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 8.w),
child: Row(
children: [
ismute == 1
? text14w400white(
"Unmute community")
: text14w400white(
"Mute community"),
const Spacer(),
ismute == 1
? Image.asset(
"assets/images/png/Black1233.png",
height: 16.h,
width: 16.w,
)
: Image.asset(
"assets/images/png/Black1233.png",
height: 16.h,
width: 16.w,
)
],
),
maxLines:
2, // Set the maximum number of lines
overflow: TextOverflow
.ellipsis, // Truncate the text with an ellipsis
),
),
// ),
sizedBoxHeight(10.h),
joinnedComData.totalCommunityMember ==
null ||
joinnedComData
.totalCommunityMember!
.toString()
.isEmpty
? const SizedBox()
: sizedBoxHeight(10.h),
Row(
children: [
Stack(
clipBehavior: Clip.none,
children: [
commonGlassUI(
borderwidth: 0.9,
width: 30.w,
height: 30.h,
borderRadius:
BorderRadius
.circular(
100.r),
opacity1: 0.24,
opacity2: 0.24,
customWidget: Center(
child: Image.asset(
"assets/images/png/Black.png",
height: 12.h,
width: 16.w,
const PopupMenuDivider(),
PopupMenuItem(
onTap: () async {
await pinunpinCommunity(
myCommunityobj!
.data[index]
.joinedAndRequestedCommunity!
.id
.toString());
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 12.w),
child: Row(
children: [
iscommunitypin == true
? Text(
'Unpin ',
style: TextStyle(
fontSize: 16.sp,
color: Colors.white,
fontWeight:
FontWeight.w800,
fontFamily:
"Nunito Sans",
),
)),
// Positioned(
// top: 0,
// right: -4,
// child: Container(
// height: 12.h,
// width: 12.w,
// decoration:
// const BoxDecoration(
// shape:
// BoxShape.circle,
// color: Color(
// 0xFFD90B2E),
// ),
// child: Center(
// child:
// text6400white(
// "2")
// ),))
]),
sizedBoxWidth(15.w),
text14w400_FCFCFCblur(
"${joinnedComData.joinedAndRequestedCommunity != null && joinnedComData.joinedAndRequestedCommunity!.totalGroup != null ? joinnedComData.joinedAndRequestedCommunity!.totalGroup : ''} groups",
)
: Text(
'Pin ',
style: TextStyle(
fontSize: 16.sp,
color: Colors.white,
fontWeight:
FontWeight.w800,
fontFamily:
"Nunito Sans",
),
),
const Spacer(),
iscommunitypin == true
? Image.asset(
"assets/images/png/PinnedIcon.png",
height: 25.h,
width: 25.w,
)
: Image.asset(
"assets/images/png/f7_pin-fill (2).png",
height: 25.h,
width: 25.w,
)
],
),
sizedBoxWidth(50.w),
GestureDetector(
onTap: () {
toggleSelectedIndex(index);
},
child: Container(
height: 21.h,
width: 57.w,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(
50.r),
gradient:
const LinearGradient(
begin:
Alignment.centerLeft,
end:
Alignment.centerRight,
colors: [
Color.fromRGBO(255, 255,
255, 0.06),
Color.fromRGBO(255, 255,
255, 0.08),
],
stops: [-0.0497, 1.0238],
// converting degrees to radians
),
border: Border.all(
color: const Color(
0xFF434A53),
width: 1.0,
),
),
child: Center(
child: text10400white(
"Owner")),
),
),
),
const PopupMenuDivider(),
PopupMenuItem(
onTap: () async {
utils.loader();
Map<String, dynamic> updata = {};
final data =
await CommunityDetail()
.postLeaveCommunity(
updata,
joinnedComData
.manageCommunityXid,
);
if (data.status ==
ResponseStatus.SUCCESS) {
Get.back();
setState(() {
myCommunityobj!.data
.removeAt(index);
});
return utils
.showToast(data.message);
} else {
Get.back();
return utils
.showToast(data.message);
}
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 8.w),
child: Row(
children: [
// text14w400_FCFCFC("Leave group"),
text14w400_D90B2E(
"Leave Community"),
const Spacer(),
Image.asset(
"assets/images/png/LightGray22.png",
height: 18.h,
width: 18.w,
)
],
),
],
),
),
],
child: Image.asset(
"assets/images/png/Group 1000004071.png",
height: 18.h,
width: 20.w,
)),
],
),
sizedBoxHeight(16.h),
commonDivider(),
sizedBoxHeight(10.h),
Row(
children: [
stackContainersGroups(
number:
" +${joinnedComData.totalCommunityMember! - 3}",
// containerImages: joinnedComData
// .fourMemberImages!
// .map((photo) => photo
// .iamPrincipal!.profilePhoto!)
// .toList(),
containerImages: joinnedComData
.fourMemberImages
?.map((photo) =>
photo.iamPrincipal?.profilePhoto)
.where((profilePhoto) =>
profilePhoto != null)
.map((profilePhoto) =>
profilePhoto!) // Cast from String? to String
.toList() ??
[],
),
sizedBoxWidth(75.w),
joinnedComData.totalCommunityMember == null ||
joinnedComData
.totalCommunityMember.isBlank!
? const SizedBox()
: text16w400_FCFCFC_blur(
'${joinnedComData.totalCommunityMember} members',
),
const Spacer(),
PopupMenuButton(
surfaceTintColor:
const Color(0xFF222935),
constraints: BoxConstraints.tightFor(
width: 200.w),
offset: const Offset(0, 30),
color: const Color(0xFF222935),
tooltip: "",
itemBuilder: (BuildContext context) =>
<PopupMenuEntry>[
PopupMenuItem(
onTap: () async {
Map<String, dynamic>
updata = {
"manage_community_xid":
joinnedComData
.manageCommunityXid,
};
final data =
await CommunityDetail()
.postMuteNotification(
updata);
if (data.status ==
ResponseStatus
.SUCCESS) {
print("success");
setState(() {});
await MyCommunityAPI()
.getMyCommunity();
bool isMuted =
ismute == 1;
isMuted = !isMuted;
ismute = isMuted ? 1 : 0;
return utils.showToast(
data.message);
} else {
Get.back();
print("Failed");
return utils.showToast(
data.message);
}
},
child: Padding(
padding:
EdgeInsets.symmetric(
horizontal: 8.w),
child: Row(
children: [
ismute == 1
? text14w400white(
"Unmute community")
: text14w400white(
"Mute community"),
const Spacer(),
ismute == 1
? Image.asset(
"assets/images/png/Black1233.png",
height: 16.h,
width: 16.w,
)
: Image.asset(
"assets/images/png/Black1233.png",
height: 16.h,
width: 16.w,
)
],
),
),
),
const PopupMenuDivider(),
PopupMenuItem(
onTap: () async {
await pinunpinCommunity(
myCommunityobj!
.data[index]
.joinedAndRequestedCommunity!
.id
.toString());
},
child: Padding(
padding:
EdgeInsets.symmetric(
horizontal: 12.w),
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",
),
),
const Spacer(),
iscommunitypin == true
? Image.asset(
"assets/images/png/PinnedIcon.png",
height: 25.h,
width: 25.w,
)
: Image.asset(
"assets/images/png/f7_pin-fill (2).png",
height: 25.h,
width: 25.w,
)
],
),
),
),
const PopupMenuDivider(),
PopupMenuItem(
onTap: () async {
utils.loader();
Map<String, dynamic>
updata = {};
final data =
await CommunityDetail()
.postLeaveCommunity(
updata,
joinnedComData
.manageCommunityXid,
);
if (data.status ==
ResponseStatus
.SUCCESS) {
setState(() {
myCommunityobj!.data
.removeAt(index);
});
return utils.showToast(
data.message);
} else {
Get.back();
return utils.showToast(
data.message);
}
},
child: Padding(
padding:
EdgeInsets.symmetric(
horizontal: 8.w),
child: Row(
children: [
// text14w400_FCFCFC("Leave group"),
text14w400_D90B2E(
"Leave Community"),
const Spacer(),
Image.asset(
"assets/images/png/LightGray22.png",
height: 18.h,
width: 18.w,
)
],
),
),
),
],
child: Image.asset(
"assets/images/png/Group 1000004071.png",
height: 18.h,
width: 20.w,
)),
],
),
sizedBoxHeight(16.h),
commonDivider(),
sizedBoxHeight(10.h),
Row(
children: [
stackContainersGroups(
number:
" +${joinnedComData.totalCommunityMember! - 3}",
containerImages: joinnedComData
.fourMemberImages!
.map((photo) => photo
.iamPrincipal!.profilePhoto!)
.toList(),
),
sizedBoxWidth(75.w),
joinnedComData.totalCommunityMember ==
null ||
joinnedComData
.totalCommunityMember.isBlank!
? const SizedBox()
: text16w400_FCFCFC_blur(
'${joinnedComData.totalCommunityMember} members',
),
Spacer(),
Image.asset(
"assets/images/png/arrow.png",
height: 21.h,
width: 18.w,
),
],
)
],
),
)),
),
);
},
Spacer(),
Image.asset(
"assets/images/png/arrow.png",
height: 21.h,
width: 18.w,
),
],
)
],
),
)),
),
),
],
))
]);
);
},
),
)
]),
);
}
Widget communityCard({

View File

@@ -166,35 +166,41 @@ class _RequestedTabState extends State<RequestedTab> {
CrossAxisAlignment.start,
children: [
Container(
height: 65.h,
width: 65.h,
decoration:
const BoxDecoration(
shape: BoxShape.circle,
// color: Colors.amber,
),
child:
// Center(
// child: Image.asset(imagepath, fit: BoxFit.cover)),
requestedComData.joinedAndRequestedCommunity!
.communityProfilePhoto ==
null ||
height: 65.h,
width: 65.h,
decoration: const BoxDecoration(
shape: BoxShape.circle,
// color: Colors.amber,
),
child:
// Center(
// child: Image.asset(imagepath, fit: BoxFit.cover)),
requestedComData
.joinedAndRequestedCommunity !=
null &&
requestedComData
.joinedAndRequestedCommunity!
.communityProfilePhoto !=
null &&
requestedComData
.joinedAndRequestedCommunity!
.communityProfilePhoto!
.isNotEmpty
? CircleAvatar(
backgroundImage:
NetworkImage(
requestedComData
.joinedAndRequestedCommunity!
.communityProfilePhoto!
.isEmpty
? const CircleAvatar(
backgroundImage:
AssetImage(
'assets/images/png/img45.png',
),
)
: CircleAvatar(
backgroundImage: NetworkImage(
requestedComData
.joinedAndRequestedCommunity!
.communityProfilePhoto!),
)),
.communityProfilePhoto!,
),
)
: const CircleAvatar(
backgroundImage:
AssetImage(
'assets/images/png/img45.png',
),
),
),
sizedBoxWidth(13.w),
Column(
crossAxisAlignment:
@@ -205,22 +211,28 @@ class _RequestedTabState extends State<RequestedTab> {
// // color: Colors.red,
// width: double.infinity,
// child:
requestedComData.joinedAndRequestedCommunity!
.communityName ==
null ||
requestedComData
.joinedAndRequestedCommunity!
.communityName!
.isEmpty
? text18w700_FCFCFC(
'Regroup')
: SizedBox(
width: 200.w,
child: text18w700_FCFCFC(
SizedBox(
width: 200.w,
child: text18w700_FCFCFC(
requestedComData
.joinedAndRequestedCommunity !=
null &&
requestedComData
.joinedAndRequestedCommunity!
.communityName !=
null &&
requestedComData
.joinedAndRequestedCommunity!
.communityName!),
),
.communityName!
.isNotEmpty
? requestedComData
.joinedAndRequestedCommunity!
.communityName!
: '',
),
),
// ),
sizedBoxHeight(10.h),
requestedComData.totalCommunityMember ==
@@ -237,11 +249,17 @@ class _RequestedTabState extends State<RequestedTab> {
number:
" +${requestedComData.totalCommunityMember! - 3}",
containerImages: requestedComData
.fourMemberImages!
.map((photo) => photo
.iamPrincipal!
.profilePhoto!)
.toList(),
.fourMemberImages
?.map((photo) => photo
.iamPrincipal
?.profilePhoto)
.where((profilePhoto) =>
profilePhoto !=
null)
.map((profilePhoto) =>
profilePhoto!) // Cast from String? to String
.toList() ??
[],
),
sizedBoxWidth(75.w),
requestedComData.totalCommunityMember ==
@@ -581,62 +599,70 @@ class _InvitedTabState extends State<InvitedTab> {
CrossAxisAlignment.start,
children: [
Container(
height: 65.h,
width: 65.h,
decoration:
const BoxDecoration(
shape: BoxShape.circle,
// color: Colors.amber,
),
child:
// Center(
// child: Image.asset(imagepath, fit: BoxFit.cover)),
invitedComData.senderDetail!
.profilePhoto ==
null ||
height: 65.h,
width: 65.h,
decoration: const BoxDecoration(
shape: BoxShape.circle,
// color: Colors.amber,
),
child:
// Center(
// child: Image.asset(imagepath, fit: BoxFit.cover)),
invitedComData
.senderDetail !=
null &&
invitedComData
.senderDetail!
.profilePhoto !=
null &&
invitedComData
.senderDetail!
.profilePhoto!
.isNotEmpty
? CircleAvatar(
backgroundImage:
NetworkImage(
invitedComData
.senderDetail!
.profilePhoto!
.isEmpty
? const CircleAvatar(
backgroundImage:
AssetImage(
'assets/images/png/img45.png',
),
)
: CircleAvatar(
backgroundImage: NetworkImage(
invitedComData
.senderDetail!
.profilePhoto!),
)),
.profilePhoto!,
),
)
: const CircleAvatar(
backgroundImage:
AssetImage(
'assets/images/png/img45.png',
),
),
),
sizedBoxWidth(13.w),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Container(
// width: 250.w,
// color: Colors.red,
// width: double.infinity,
child: invitedComData
.senderDetail!
.fullName ==
null ||
invitedComData
.senderDetail!
.fullName!
.isEmpty
? text18w700_FCFCFC(
'Regroup')
: SizedBox(
width: 200.w,
child: text18w700_FCFCFC(
invitedComData
.senderDetail!
.fullName!),
),
),
// width: 250.w,
// color: Colors.red,
// width: double.infinity,
child: SizedBox(
width: 200.w,
child: text18w700_FCFCFC(
invitedComData
.senderDetail !=
null &&
invitedComData
.senderDetail!
.fullName !=
null &&
invitedComData
.senderDetail!
.fullName!
.isNotEmpty
? invitedComData
.senderDetail!
.fullName!
: '',
),
)),
sizedBoxHeight(10.h),
// invitedComData.totalCommunityMember ==
// null ||
@@ -658,8 +684,13 @@ class _InvitedTabState extends State<InvitedTab> {
.community
?.fourMemberImages
.map((photo) => photo
.iamPrincipal!
.profilePhoto!)
.iamPrincipal
?.profilePhoto)
.where((profilePhoto) =>
profilePhoto !=
null)
.map((profilePhoto) =>
profilePhoto!) // Cast from String? to String
.toList() ??
[],
),