pin-unpin api completed in my community
This commit is contained in:
@@ -90,7 +90,7 @@ class ApiUrls {
|
||||
|
||||
static const getComPostdetail = "${baseUrl}fetch-community-all-posts";
|
||||
|
||||
|
||||
static const postleavecommunity = "${baseUrl}leave-community";
|
||||
|
||||
static const getrequestedcommunity =
|
||||
"${baseUrl}fetch-joining-request-for-community";
|
||||
@@ -103,7 +103,6 @@ class ApiUrls {
|
||||
|
||||
static const postrejectinvite = "${baseUrl}reject-invite-to-join-community";
|
||||
|
||||
|
||||
static const getusercertificates = "${baseUrl}my-certificates";
|
||||
|
||||
static const postnotification = "${baseUrl}update-notification-settings";
|
||||
@@ -165,9 +164,9 @@ class ApiUrls {
|
||||
static const getpostdetail = "${baseUrl}fetch-single-post";
|
||||
|
||||
static const getpopularTagsdetails = "${baseUrl}fetch-popular-post";
|
||||
|
||||
|
||||
static const postcreatecommunity = "${baseUrl}create-community";
|
||||
|
||||
|
||||
static const getcommunityaddgroups = "${baseUrl}fetch-groups-to-add";
|
||||
|
||||
static const getcommunitygroups = "${baseUrl}fetch-community-all-groups";
|
||||
@@ -176,7 +175,5 @@ class ApiUrls {
|
||||
|
||||
static const geteditcommunity = "${baseUrl}edit-community";
|
||||
|
||||
|
||||
|
||||
|
||||
static const posteditcommunity = "${baseUrl}update-community";
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:regroup/Common/controller/data/network/network_api.dart';
|
||||
|
||||
|
||||
class Communitygetmethod {
|
||||
getTagsdata(id) {}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,15 +1,13 @@
|
||||
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';
|
||||
import 'package:regroup/Common/CommonWidget.dart';
|
||||
import 'package:regroup/sidemenu/Community/MyCommunity/view_model/getmethod.dart';
|
||||
import 'package:regroup/sidemenu/view_model/getmethod.dart';
|
||||
import 'package:regroup/Utils/Common/CommonAppbar.dart';
|
||||
|
||||
import 'package:regroup/Utils/Common/sized_box.dart';
|
||||
import 'package:regroup/Utils/texts.dart';
|
||||
import 'package:regroup/sidemenu/Community/MyCommunity/view_model/getmethod.dart';
|
||||
import 'package:regroup/sidemenu/view_model/getmethod.dart';
|
||||
|
||||
class Group extends StatefulWidget {
|
||||
const Group({super.key});
|
||||
@@ -562,7 +560,7 @@ class _GroupState extends State<Group> {
|
||||
"Make primary"),
|
||||
const Spacer(),
|
||||
Image.asset(
|
||||
"assets/images/png/leave group.png",
|
||||
"assets/images/png/group.png",
|
||||
height: 20.h,
|
||||
width: 20.w,
|
||||
)
|
||||
|
||||
@@ -25,6 +25,7 @@ class ComDetailModel {
|
||||
class Data {
|
||||
Data({
|
||||
required this.id,
|
||||
required this.isCommunityPinned,
|
||||
required this.totalGroup,
|
||||
required this.totalAnnouncements,
|
||||
required this.communityProfilePhoto,
|
||||
@@ -33,10 +34,12 @@ class Data {
|
||||
required this.communityLocation,
|
||||
required this.communityDescription,
|
||||
required this.communityTypeXid,
|
||||
required this.userLinkInCommunity,
|
||||
required this.accessType,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final bool? isCommunityPinned;
|
||||
final int? totalGroup;
|
||||
final int? totalAnnouncements;
|
||||
final String? communityProfilePhoto;
|
||||
@@ -45,11 +48,13 @@ class Data {
|
||||
final String? communityLocation;
|
||||
final String? communityDescription;
|
||||
final int? communityTypeXid;
|
||||
final dynamic userLinkInCommunity;
|
||||
final AccessType? accessType;
|
||||
|
||||
factory Data.fromJson(Map<String, dynamic> json){
|
||||
return Data(
|
||||
id: json["id"],
|
||||
isCommunityPinned: json["is_community_pinned"],
|
||||
totalGroup: json["total_group"],
|
||||
totalAnnouncements: json["total_announcements"],
|
||||
communityProfilePhoto: json["community_profile_photo"],
|
||||
@@ -58,6 +63,7 @@ class Data {
|
||||
communityLocation: json["community_location"],
|
||||
communityDescription: json["community_description"],
|
||||
communityTypeXid: json["community_type_xid"],
|
||||
userLinkInCommunity: json["user_link_in_community"],
|
||||
accessType: json["access_type"] == null ? null : AccessType.fromJson(json["access_type"]),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
|
||||
|
||||
|
||||
class CommunityAllDetailsModel {
|
||||
CommunityAllDetailsModel({
|
||||
required this.status,
|
||||
required this.statusCode,
|
||||
required this.message,
|
||||
required this.data,
|
||||
});
|
||||
|
||||
final String? status;
|
||||
final int? statusCode;
|
||||
final String? message;
|
||||
final Data? data;
|
||||
|
||||
factory CommunityAllDetailsModel.fromJson(Map<String, dynamic> json) {
|
||||
return CommunityAllDetailsModel(
|
||||
status: json["status"],
|
||||
statusCode: json["status_code"],
|
||||
message: json["message"],
|
||||
data: json["data"] == null ? null : Data.fromJson(json["data"]),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Data {
|
||||
Data({
|
||||
required this.id,
|
||||
required this.isCommunityPinned,
|
||||
required this.totalGroup,
|
||||
required this.totalAnnouncements,
|
||||
required this.communityProfilePhoto,
|
||||
required this.communityBannerImage,
|
||||
required this.communityName,
|
||||
required this.communityLocation,
|
||||
required this.communityDescription,
|
||||
required this.communityTypeXid,
|
||||
required this.userLinkInCommunity,
|
||||
required this.accessType,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final bool? isCommunityPinned;
|
||||
final int? totalGroup;
|
||||
final int? totalAnnouncements;
|
||||
final String? communityProfilePhoto;
|
||||
final String? communityBannerImage;
|
||||
final String? communityName;
|
||||
final String? communityLocation;
|
||||
final String? communityDescription;
|
||||
final int? communityTypeXid;
|
||||
final dynamic userLinkInCommunity;
|
||||
final AccessType? accessType;
|
||||
|
||||
factory Data.fromJson(Map<String, dynamic> json) {
|
||||
return Data(
|
||||
id: json["id"],
|
||||
isCommunityPinned: json["is_community_pinned"],
|
||||
totalGroup: json["total_group"],
|
||||
totalAnnouncements: json["total_announcements"],
|
||||
communityProfilePhoto: json["community_profile_photo"],
|
||||
communityBannerImage: json["community_banner_image"],
|
||||
communityName: json["community_name"],
|
||||
communityLocation: json["community_location"],
|
||||
communityDescription: json["community_description"],
|
||||
communityTypeXid: json["community_type_xid"],
|
||||
userLinkInCommunity: json["user_link_in_community"],
|
||||
accessType: json["access_type"] == null
|
||||
? null
|
||||
: AccessType.fromJson(json["access_type"]),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AccessType {
|
||||
AccessType({
|
||||
required this.id,
|
||||
required this.name,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final String? name;
|
||||
|
||||
factory AccessType.fromJson(Map<String, dynamic> json) {
|
||||
return AccessType(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import 'package:regroup/Common/CommonGlassmorphism.dart';
|
||||
import 'package:regroup/Common/CommonTabBar.dart';
|
||||
import 'package:regroup/Common/CommonWidget.dart';
|
||||
import 'package:regroup/Common/ConvertServerDateToUserDate.dart';
|
||||
import 'package:regroup/Common/base_manager.dart';
|
||||
import 'package:regroup/Main_Screens/Community/Model/CommonDatumObjModel.dart';
|
||||
import 'package:regroup/Main_Screens/Community/Model/fetchicons.dart';
|
||||
import 'package:regroup/Main_Screens/Community/ViewModel/getmethod.dart';
|
||||
@@ -13,11 +14,14 @@ import 'package:regroup/Main_Screens/Community_HomePage/Community.dart';
|
||||
import 'package:regroup/Main_Screens/Community_HomePage/view_model/CountersHelper.dart';
|
||||
import 'package:regroup/Utils/Common/CommonAppbar.dart';
|
||||
import 'package:regroup/Utils/Common/sized_box.dart';
|
||||
import 'package:regroup/Utils/dialogs.dart';
|
||||
import 'package:regroup/Utils/texts.dart';
|
||||
import 'package:regroup/resources/routes/route_name.dart';
|
||||
import 'package:regroup/sidemenu/Community/MyCommunity/view_model/ComDetails.dart';
|
||||
import 'package:regroup/sidemenu/view_model/postmethod.dart';
|
||||
|
||||
var CommunityId;
|
||||
var communitypinid;
|
||||
|
||||
class CommunityDetails extends StatefulWidget {
|
||||
const CommunityDetails({super.key});
|
||||
@@ -28,6 +32,7 @@ class CommunityDetails extends StatefulWidget {
|
||||
|
||||
class _CommunityDetailsState extends State<CommunityDetails> {
|
||||
bool? additionalContent = false;
|
||||
bool? iscommunitypin = false;
|
||||
|
||||
late Future myfuture;
|
||||
|
||||
@@ -39,6 +44,42 @@ class _CommunityDetailsState extends State<CommunityDetails> {
|
||||
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(() {
|
||||
iscommunitypin = !iscommunitypin!;
|
||||
CommunityDetail().getCommunityDetail(CommunityId);
|
||||
});
|
||||
return utils.showToast(data.message);
|
||||
} else {
|
||||
// Get.back();
|
||||
return utils.showToast(data.message);
|
||||
}
|
||||
}
|
||||
|
||||
leaveCommunity() async {
|
||||
utils.loader();
|
||||
Map<String, dynamic> updata = {};
|
||||
final data =
|
||||
await CommunityDetail().postLeaveCommunity(updata, CommunityId);
|
||||
if (data.status == ResponseStatus.SUCCESS) {
|
||||
Get.back();
|
||||
Get.offNamed(RouteName.mycommunity);
|
||||
// toggleSelectedIndex(tagid);
|
||||
return utils.showToast(data.message);
|
||||
} else {
|
||||
Get.back();
|
||||
return utils.showToast(data.message);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -128,18 +169,45 @@ class _CommunityDetailsState extends State<CommunityDetails> {
|
||||
),
|
||||
const PopupMenuDivider(),
|
||||
PopupMenuItem(
|
||||
onTap: () {},
|
||||
onTap: () async {
|
||||
await pinunpinCommunity(
|
||||
comdetailobj!.data!.id.toString());
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.w),
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.w),
|
||||
child: Row(
|
||||
children: [
|
||||
text14w400white("Pin"),
|
||||
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(),
|
||||
Image.asset(
|
||||
"assets/images/png/f7_pin-fill (2).png",
|
||||
height: 25.h,
|
||||
width: 25.w,
|
||||
)
|
||||
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,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -166,6 +234,26 @@ class _CommunityDetailsState extends State<CommunityDetails> {
|
||||
),
|
||||
),
|
||||
),
|
||||
const PopupMenuDivider(),
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
leaveCommunity();
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.w),
|
||||
child: Row(
|
||||
children: [
|
||||
text14w400white("Leave community"),
|
||||
const Spacer(),
|
||||
Image.asset(
|
||||
"assets/images/png/logout 1 (traced).png",
|
||||
height: 18.h,
|
||||
width: 18.w,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
child: Image.asset(
|
||||
'assets/images/png/Group 1000004071.png',
|
||||
@@ -199,6 +287,8 @@ class _CommunityDetailsState extends State<CommunityDetails> {
|
||||
);
|
||||
}
|
||||
}
|
||||
iscommunitypin = comdetailobj!.data!.isCommunityPinned;
|
||||
|
||||
return Stack(children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
@@ -419,7 +509,11 @@ class _CommunityDetailsState extends State<CommunityDetails> {
|
||||
sizedBoxHeight(20.h),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.addgroup);
|
||||
// Get.toNamed(RouteName.addgroup);
|
||||
Get.toNamed(RouteName.group, arguments: {
|
||||
'id': CommunityId,
|
||||
'iscommunity': true,
|
||||
});
|
||||
},
|
||||
child: commonGlassUI(
|
||||
width: double.infinity,
|
||||
@@ -571,7 +665,7 @@ class _PostsTabState extends State<PostsTab> {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
_fetchIcons() {
|
||||
_fetchIcons() {
|
||||
_reactions = fetchlikeIconsModel!.data ?? [];
|
||||
for (var post in commonobjmodel!.data) {
|
||||
//Check if post as a like icon
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
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';
|
||||
import 'package:regroup/Common/CommonWidget.dart';
|
||||
import 'package:regroup/Common/base_manager.dart';
|
||||
import 'package:regroup/Utils/Common/CommonAppbar.dart';
|
||||
|
||||
import 'package:regroup/Utils/Common/sized_box.dart';
|
||||
import 'package:regroup/Utils/dialogs.dart';
|
||||
import 'package:regroup/Utils/texts.dart';
|
||||
import 'package:regroup/resources/routes/route_name.dart';
|
||||
import 'package:regroup/sidemenu/Community/MyCommunity/View/CommunityDetails.dart';
|
||||
import 'package:regroup/sidemenu/Community/MyCommunity/view_model/ComDetails.dart';
|
||||
import 'package:regroup/sidemenu/view_model/getMyCommunity.dart';
|
||||
import 'package:regroup/sidemenu/view_model/postmethod.dart';
|
||||
|
||||
// var CommunityId;
|
||||
var communitypinid;
|
||||
|
||||
class MyCommunity extends StatefulWidget {
|
||||
const MyCommunity({super.key});
|
||||
@@ -51,7 +56,7 @@ class _MyCommunityState extends State<MyCommunity> {
|
||||
];
|
||||
|
||||
var selectedContainerIndices = <int>{}.obs;
|
||||
|
||||
bool? iscommunitypin = false;
|
||||
void toggleSelectedIndex(int index) {
|
||||
if (selectedContainerIndices.contains(index)) {
|
||||
selectedContainerIndices.remove(index);
|
||||
@@ -60,6 +65,42 @@ class _MyCommunityState extends State<MyCommunity> {
|
||||
}
|
||||
}
|
||||
|
||||
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(() {
|
||||
iscommunitypin = !iscommunitypin!;
|
||||
MyCommunityAPI().getMyCommunity();
|
||||
});
|
||||
return utils.showToast(data.message);
|
||||
} else {
|
||||
// Get.back();
|
||||
return utils.showToast(data.message);
|
||||
}
|
||||
}
|
||||
|
||||
leaveCommunity() async {
|
||||
utils.loader();
|
||||
Map<String, dynamic> updata = {};
|
||||
final data =
|
||||
await CommunityDetail().postLeaveCommunity(updata, CommunityId);
|
||||
if (data.status == ResponseStatus.SUCCESS) {
|
||||
Get.back();
|
||||
// Get.offNamed(RouteName.mycommunity);
|
||||
// toggleSelectedIndex(tagid);
|
||||
return utils.showToast(data.message);
|
||||
} else {
|
||||
Get.back();
|
||||
return utils.showToast(data.message);
|
||||
}
|
||||
}
|
||||
|
||||
late Future myfuture;
|
||||
|
||||
@override
|
||||
@@ -71,78 +112,85 @@ class _MyCommunityState extends State<MyCommunity> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
// key: _scaffoldKey1,
|
||||
backgroundColor: const Color(0xFF222935),
|
||||
extendBody: true,
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: CommonAppbar(
|
||||
titleTxt: "My Communities",
|
||||
customActionWidget: Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.newcommunity);
|
||||
},
|
||||
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,
|
||||
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(
|
||||
titleTxt: "My Communities",
|
||||
customActionWidget: Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.newcommunity);
|
||||
},
|
||||
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,
|
||||
)
|
||||
],
|
||||
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,
|
||||
children: [
|
||||
Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Color(0xFFC18948),
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.hasError) {
|
||||
return Center(
|
||||
child: Text(
|
||||
'${snapshot.error} occured',
|
||||
style: TextStyle(fontSize: 18.spMin),
|
||||
),
|
||||
body: FutureBuilder(
|
||||
future: myfuture,
|
||||
builder: (ctx, snapshot) {
|
||||
if (snapshot.data == null) {
|
||||
return const Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Color(0xFFC18948),
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
return 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),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return myCommunityobj!.data.isEmpty
|
||||
? _buildNoDataBody(context)
|
||||
: _buildBody(context);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -180,7 +228,7 @@ class _MyCommunityState extends State<MyCommunity> {
|
||||
sizedBoxHeight(20.h),
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.requestscreen);
|
||||
@@ -195,12 +243,16 @@ class _MyCommunityState extends State<MyCommunity> {
|
||||
physics: const ScrollPhysics(),
|
||||
itemCount: myCommunityobj!.data.length,
|
||||
itemBuilder: (context, index) {
|
||||
iscommunitypin = myCommunityobj!.data[index]
|
||||
.joinedAndRequestedCommunity!.isCommunityPinned;
|
||||
var joinnedComData = myCommunityobj!.data[index];
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: 25.h),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.communityDetails, arguments: {"CommunityID" : joinnedComData.manageCommunityXid});
|
||||
Get.toNamed(RouteName.communityDetails, arguments: {
|
||||
"CommunityID": joinnedComData.manageCommunityXid
|
||||
});
|
||||
},
|
||||
child: commonGlassUI(
|
||||
borderwidth: 0.9,
|
||||
@@ -400,49 +452,72 @@ class _MyCommunityState extends State<MyCommunity> {
|
||||
),
|
||||
const PopupMenuDivider(),
|
||||
PopupMenuItem(
|
||||
onTap: () {},
|
||||
onTap: () async {
|
||||
await pinunpinCommunity(
|
||||
myCommunityobj!
|
||||
.data[index]
|
||||
.joinedAndRequestedCommunity!
|
||||
.id
|
||||
.toString());
|
||||
},
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(
|
||||
horizontal: 8.w),
|
||||
horizontal: 12.w),
|
||||
child: Row(
|
||||
children: [
|
||||
text14w400_FCFCFC(
|
||||
"Pin group"),
|
||||
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(),
|
||||
Image.asset(
|
||||
"assets/images/png/f7_pin-fill (2).png",
|
||||
height: 27.h,
|
||||
width: 27.w,
|
||||
)
|
||||
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: () {},
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(
|
||||
horizontal: 8.w),
|
||||
child: Row(
|
||||
children: [
|
||||
text14w400_FCFCFC(
|
||||
"Make primary"),
|
||||
const Spacer(),
|
||||
Image.asset(
|
||||
"assets/images/png/leave group.png",
|
||||
height: 20.h,
|
||||
width: 20.w,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const PopupMenuDivider(),
|
||||
PopupMenuItem(
|
||||
onTap: () {},
|
||||
onTap: () async {
|
||||
await leaveCommunity();
|
||||
},
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(
|
||||
@@ -451,7 +526,7 @@ class _MyCommunityState extends State<MyCommunity> {
|
||||
children: [
|
||||
// text14w400_FCFCFC("Leave group"),
|
||||
text14w400_D90B2E(
|
||||
"Leave group"),
|
||||
"Leave Community"),
|
||||
const Spacer(),
|
||||
Image.asset(
|
||||
"assets/images/png/LightGray22.png",
|
||||
@@ -479,7 +554,7 @@ class _MyCommunityState extends State<MyCommunity> {
|
||||
number:
|
||||
" +${joinnedComData.totalCommunityMember! - 3}",
|
||||
containerImages: joinnedComData
|
||||
.fourMemberImages!
|
||||
.fourMemberImages
|
||||
.map((photo) => photo
|
||||
.iamPrincipal!.profilePhoto!)
|
||||
.toList(),
|
||||
@@ -525,7 +600,7 @@ class _MyCommunityState extends State<MyCommunity> {
|
||||
borderwidth: 0.9,
|
||||
borderRadius: BorderRadius.circular(10.r),
|
||||
customWidget: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h),
|
||||
padding: EdgeInsets.all(16.h),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
@@ -552,41 +627,46 @@ class _MyCommunityState extends State<MyCommunity> {
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
text18w700_FCFCFC(title),
|
||||
Expanded(flex: 1, child: text16w700_FCFCFC(title)),
|
||||
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",
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: 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: 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("10 groups")
|
||||
],
|
||||
width: 12.w,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Color(0xFFD90B2E),
|
||||
),
|
||||
child:
|
||||
Center(child: text6400white("2")),
|
||||
))
|
||||
]),
|
||||
sizedBoxWidth(15.w),
|
||||
text14w400_FCFCFCblur("10 groups")
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,152 +1,165 @@
|
||||
class MyCommunityModel {
|
||||
MyCommunityModel({
|
||||
required this.status,
|
||||
required this.statusCode,
|
||||
required this.message,
|
||||
required this.data,
|
||||
});
|
||||
MyCommunityModel({
|
||||
required this.status,
|
||||
required this.statusCode,
|
||||
required this.message,
|
||||
required this.data,
|
||||
});
|
||||
|
||||
final String? status;
|
||||
final int? statusCode;
|
||||
final String? message;
|
||||
final List<Datum> data;
|
||||
|
||||
factory MyCommunityModel.fromJson(Map<String, dynamic> json){
|
||||
return MyCommunityModel(
|
||||
status: json["status"],
|
||||
statusCode: json["status_code"],
|
||||
message: json["message"],
|
||||
data: json["data"] == null ? [] : List<Datum>.from(json["data"]!.map((x) => Datum.fromJson(x))),
|
||||
);
|
||||
}
|
||||
final String? status;
|
||||
final int? statusCode;
|
||||
final String? message;
|
||||
final List<Datum> data;
|
||||
|
||||
factory MyCommunityModel.fromJson(Map<String, dynamic> json) {
|
||||
return MyCommunityModel(
|
||||
status: json["status"],
|
||||
statusCode: json["status_code"],
|
||||
message: json["message"],
|
||||
data: json["data"] == null
|
||||
? []
|
||||
: List<Datum>.from(json["data"]!.map((x) => Datum.fromJson(x))),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Datum {
|
||||
Datum({
|
||||
required this.totalCommunityMember,
|
||||
required this.fourMemberImages,
|
||||
required this.iamPrincipalXid,
|
||||
required this.manageCommunityXid,
|
||||
required this.joinedAt,
|
||||
required this.userTypeXid,
|
||||
required this.joinedAndRequestedCommunity,
|
||||
});
|
||||
Datum({
|
||||
required this.totalCommunityMember,
|
||||
required this.fourMemberImages,
|
||||
required this.iamPrincipalXid,
|
||||
required this.manageCommunityXid,
|
||||
required this.joinedAt,
|
||||
required this.userTypeXid,
|
||||
required this.joinedAndRequestedCommunity,
|
||||
});
|
||||
|
||||
final int? totalCommunityMember;
|
||||
final List<FourMemberImage> fourMemberImages;
|
||||
final int? iamPrincipalXid;
|
||||
final int? manageCommunityXid;
|
||||
final DateTime? joinedAt;
|
||||
final UserTypeXid? userTypeXid;
|
||||
final JoinedAndRequestedCommunity? joinedAndRequestedCommunity;
|
||||
|
||||
factory Datum.fromJson(Map<String, dynamic> json){
|
||||
return Datum(
|
||||
totalCommunityMember: json["total_community_member"],
|
||||
fourMemberImages: json["four_member_images"] == null ? [] : List<FourMemberImage>.from(json["four_member_images"]!.map((x) => FourMemberImage.fromJson(x))),
|
||||
iamPrincipalXid: json["iam_principal_xid"],
|
||||
manageCommunityXid: json["manage_community_xid"],
|
||||
joinedAt: DateTime.tryParse(json["joined_at"] ?? ""),
|
||||
userTypeXid: json["user_type_xid"] == null ? null : UserTypeXid.fromJson(json["user_type_xid"]),
|
||||
joinedAndRequestedCommunity: json["joined_and_requested_community"] == null ? null : JoinedAndRequestedCommunity.fromJson(json["joined_and_requested_community"]),
|
||||
);
|
||||
}
|
||||
final int? totalCommunityMember;
|
||||
final List<FourMemberImage> fourMemberImages;
|
||||
final int? iamPrincipalXid;
|
||||
final int? manageCommunityXid;
|
||||
final DateTime? joinedAt;
|
||||
final UserTypeXid? userTypeXid;
|
||||
final JoinedAndRequestedCommunity? joinedAndRequestedCommunity;
|
||||
|
||||
factory Datum.fromJson(Map<String, dynamic> json) {
|
||||
return Datum(
|
||||
totalCommunityMember: json["total_community_member"],
|
||||
fourMemberImages: json["four_member_images"] == null
|
||||
? []
|
||||
: List<FourMemberImage>.from(json["four_member_images"]!
|
||||
.map((x) => FourMemberImage.fromJson(x))),
|
||||
iamPrincipalXid: json["iam_principal_xid"],
|
||||
manageCommunityXid: json["manage_community_xid"],
|
||||
joinedAt: DateTime.tryParse(json["joined_at"] ?? ""),
|
||||
userTypeXid: json["user_type_xid"] == null
|
||||
? null
|
||||
: UserTypeXid.fromJson(json["user_type_xid"]),
|
||||
joinedAndRequestedCommunity:
|
||||
json["joined_and_requested_community"] == null
|
||||
? null
|
||||
: JoinedAndRequestedCommunity.fromJson(
|
||||
json["joined_and_requested_community"]),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class FourMemberImage {
|
||||
FourMemberImage({
|
||||
required this.iamPrincipalXid,
|
||||
required this.manageCommunityXid,
|
||||
required this.iamPrincipal,
|
||||
});
|
||||
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"]),
|
||||
);
|
||||
}
|
||||
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.profilePhoto,
|
||||
required this.isUserPinned,
|
||||
});
|
||||
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? 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"],
|
||||
profilePhoto: json["profile_photo"],
|
||||
isUserPinned: json["is_user_pinned"],
|
||||
);
|
||||
}
|
||||
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"],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class JoinedAndRequestedCommunity {
|
||||
JoinedAndRequestedCommunity({
|
||||
required this.id,
|
||||
required this.communityProfilePhoto,
|
||||
required this.communityBannerImage,
|
||||
required this.communityName,
|
||||
required this.totalGroup,
|
||||
required this.totalAnnouncements,
|
||||
});
|
||||
JoinedAndRequestedCommunity({
|
||||
required this.id,
|
||||
required this.communityProfilePhoto,
|
||||
required this.communityBannerImage,
|
||||
required this.communityName,
|
||||
required this.totalGroup,
|
||||
required this.totalAnnouncements,
|
||||
required this.isCommunityPinned,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final String? communityProfilePhoto;
|
||||
final String? communityBannerImage;
|
||||
final String? communityName;
|
||||
final int? totalGroup;
|
||||
final int? totalAnnouncements;
|
||||
|
||||
factory JoinedAndRequestedCommunity.fromJson(Map<String, dynamic> json){
|
||||
return JoinedAndRequestedCommunity(
|
||||
id: json["id"],
|
||||
communityProfilePhoto: json["community_profile_photo"],
|
||||
communityBannerImage: json["community_banner_image"],
|
||||
communityName: json["community_name"],
|
||||
totalGroup: json["total_group"],
|
||||
totalAnnouncements: json["total_announcements"],
|
||||
);
|
||||
}
|
||||
final int? id;
|
||||
final String? communityProfilePhoto;
|
||||
final String? communityBannerImage;
|
||||
final String? communityName;
|
||||
final int? totalGroup;
|
||||
final int? totalAnnouncements;
|
||||
final bool? isCommunityPinned;
|
||||
|
||||
factory JoinedAndRequestedCommunity.fromJson(Map<String, dynamic> json) {
|
||||
return JoinedAndRequestedCommunity(
|
||||
id: json["id"],
|
||||
communityProfilePhoto: json["community_profile_photo"],
|
||||
communityBannerImage: json["community_banner_image"],
|
||||
communityName: json["community_name"],
|
||||
totalGroup: json["total_group"],
|
||||
totalAnnouncements: json["total_announcements"],
|
||||
isCommunityPinned: json["is_community_pinned"],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class UserTypeXid {
|
||||
UserTypeXid({
|
||||
required this.id,
|
||||
required this.name,
|
||||
});
|
||||
UserTypeXid({
|
||||
required this.id,
|
||||
required this.name,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final String? name;
|
||||
|
||||
factory UserTypeXid.fromJson(Map<String, dynamic> json){
|
||||
return UserTypeXid(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
);
|
||||
}
|
||||
final int? id;
|
||||
final String? name;
|
||||
|
||||
factory UserTypeXid.fromJson(Map<String, dynamic> json) {
|
||||
return UserTypeXid(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user