diff --git a/assets/images/png/downarrow.png b/assets/images/png/downarrow.png new file mode 100644 index 0000000..3c2e011 Binary files /dev/null and b/assets/images/png/downarrow.png differ diff --git a/assets/images/png/uparrow.png b/assets/images/png/uparrow.png new file mode 100644 index 0000000..adec464 Binary files /dev/null and b/assets/images/png/uparrow.png differ diff --git a/lib/Common/api_urls.dart b/lib/Common/api_urls.dart index 0cbc08f..eaeb7ec 100644 --- a/lib/Common/api_urls.dart +++ b/lib/Common/api_urls.dart @@ -92,6 +92,9 @@ class ApiUrls { static const postleavecommunity = "${baseUrl}leave-community"; + static const postmutenotification = "${baseUrl}mute-unmute-community"; + + static const getrequestedcommunity = @@ -101,6 +104,12 @@ class ApiUrls { static const postnewinterest = "${baseUrl}store-tags"; + static const postacceptreject = "${baseUrl}accept-reject-tag"; + + + static const getinterests = "${baseUrl}list-of-tags-and-requested-tags"; + + static const postcancelrequest = "${baseUrl}cancel-request-of-community"; static const postacceptinvite = "${baseUrl}accept-invite-to-join-community"; diff --git a/lib/Main_Screens/Community_HomePage/Community.dart b/lib/Main_Screens/Community_HomePage/Community.dart index 1501ed7..5da33ef 100644 --- a/lib/Main_Screens/Community_HomePage/Community.dart +++ b/lib/Main_Screens/Community_HomePage/Community.dart @@ -2,7 +2,6 @@ import 'dart:developer'; -import 'package:async/src/future_group.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; diff --git a/lib/Utils/Common/CommonAppbar.dart b/lib/Utils/Common/CommonAppbar.dart index 10c5475..2bb1bb9 100644 --- a/lib/Utils/Common/CommonAppbar.dart +++ b/lib/Utils/Common/CommonAppbar.dart @@ -29,9 +29,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:regroup/Common/CommonGlassmorphism.dart'; -import 'package:regroup/Common/controller/MainScreen.dart'; import 'package:regroup/Utils/Common/sized_box.dart'; -import 'package:regroup/resources/routes/route_name.dart'; class CommonAppbar extends StatelessWidget implements PreferredSizeWidget { @override diff --git a/lib/Utils/texts.dart b/lib/Utils/texts.dart index 6836195..147da88 100644 --- a/lib/Utils/texts.dart +++ b/lib/Utils/texts.dart @@ -346,9 +346,6 @@ Widget text18w400white(String text, {TextAlign? textAlign}) { ); } - - - Widget text14w400white(String text, {TextAlign? textAlign}) { return Text( text, @@ -410,6 +407,20 @@ Widget text16w400_FCFCFC(String text, {TextAlign? textAlign}) { ); } +Widget text16w700_FCFCFCItalic(String text, {TextAlign? textAlign}) { + return Text( + text, + textAlign: textAlign, + style: TextStyle( + fontSize: 16.sp, + color: const Color(0xFFFCFCFC), + fontFamily: 'Helvetica', + fontWeight: FontWeight.w700, + fontStyle: FontStyle.italic, + ), + ); +} + Widget text16w400_FF0000(String text) { return Text( text, diff --git a/lib/sidemenu/Community/Admin/PopupItem/Community settings/ManageTags.dart/ManageInterest.dart b/lib/sidemenu/Community/Admin/PopupItem/Community settings/ManageTags.dart/ManageInterest.dart index 2a23ba5..166bda7 100644 --- a/lib/sidemenu/Community/Admin/PopupItem/Community settings/ManageTags.dart/ManageInterest.dart +++ b/lib/sidemenu/Community/Admin/PopupItem/Community settings/ManageTags.dart/ManageInterest.dart @@ -1,15 +1,23 @@ +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:glassmorphism/glassmorphism.dart'; import 'package:regroup/Common/CommonGlassmorphism.dart'; import 'package:regroup/Common/CommonTabBar.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/ShimmerCommon.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/Admin/PopupItem/Community%20settings/ManageTags.dart/ViewModel/maanageInterestApi.dart'; + +var communityid; class ManageTags extends StatefulWidget { const ManageTags({super.key}); @@ -19,15 +27,14 @@ class ManageTags extends StatefulWidget { } class _ManageTagsState extends State { - int communityid = Get.arguments['communityid']; - @override Widget build(BuildContext context) { + communityid = Get.arguments['communityid']; return Scaffold( // key: _scaffoldKey1, - backgroundColor: Color(0xFF222935), + backgroundColor: const Color(0xFF222935), extendBody: true, - appBar: CommonAppbar( + appBar: const CommonAppbar( titleTxt: "Manage interest", ), resizeToAvoidBottomInset: false, @@ -45,7 +52,7 @@ class _ManageTagsState extends State { length: 2, // initialIndex: selectedIndex.value, child: Column(children: [ - CommonTabBar(tabs: const [ + const CommonTabBar(tabs: [ Tab( text: 'Interest', ), @@ -55,10 +62,10 @@ class _ManageTagsState extends State { ]), SizedBox( height: 600.h, - child: TabBarView( + child: const TabBarView( children: [ - tagsTab(), - tagrequestsrTab(), + InterestTab(), + TagRequestTab(), ], ), ), @@ -69,7 +76,7 @@ class _ManageTagsState extends State { floatingActionButton: Container( height: 55.h, width: 55.w, - decoration: BoxDecoration( + decoration: const BoxDecoration( shape: BoxShape.circle, boxShadow: [ BoxShadow( @@ -85,9 +92,9 @@ class _ManageTagsState extends State { 'communityid': communityid, }); }, - backgroundColor: Color(0xFFD90B2E), + backgroundColor: const Color(0xFFD90B2E), autofocus: true, - shape: CircleBorder(), + shape: const CircleBorder(), child: Image.asset( "assets/images/png/iconamoon_edit-thin.png", height: 30.h, @@ -98,31 +105,149 @@ class _ManageTagsState extends State { } } -Widget tagsTab() { +class InterestTab extends StatefulWidget { + const InterestTab({super.key}); + + @override + State createState() => _InterestTabState(); +} + +class _InterestTabState extends State { List tags = ['Cycle', 'Sports', 'Fitness', 'Kayaking', 'Sports club']; - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - sizedBoxHeight(25.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: text16400white("Special Announcement Interest"), - ), - sizedBoxHeight(15.h), - ListView.builder( - shrinkWrap: true, - itemCount: tags.length, - itemBuilder: (context, index) { - return Column( - children: [ - rowTagsTile(text: tags[index]), - if (index != tags.length - 1) commonDivider() - ], - ); - }, - ) - ], - ); + late Future interestfuture; + @override + void initState() { + communityid = Get.arguments['communityid']; + interestfuture = ManageInterestApi().getInterests(communityid); + + // TODO: implement initState + super.initState(); + } + + @override + Widget build(BuildContext context) { + return FutureBuilder( + future: interestfuture, + builder: (ctx, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return const Center(child: CircularProgressIndicator()); + } + + if (snapshot.hasError) { + return Center( + child: Text( + '${snapshot.error} occurred', + style: TextStyle(fontSize: 18.spMin), + ), + ); + } + + if (snapshot.connectionState == ConnectionState.done && + snapshot.hasData) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + sizedBoxHeight(25.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: text16400white("Special Announcement Interest"), + ), + sizedBoxHeight(15.h), + Expanded( + child: fetchinterestobj!.data!.acceptedTags.isEmpty || + fetchinterestobj!.data!.acceptedTags + .every((tag) => tag.isSpecial != 0) + ? Center( + child: Text( + "No announcement interest found", // Updated message + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ), + ) + : ListView.builder( + shrinkWrap: true, + itemCount: + fetchinterestobj!.data!.acceptedTags.length, + itemBuilder: (context, index) { + if (fetchinterestobj! + .data!.acceptedTags[index].isSpecial == + 0) { + return Column( + children: [ + rowTagsTile( + text: fetchinterestobj! + .data!.acceptedTags[index].name ?? + ''), + if (index != + fetchinterestobj!.data!.acceptedTags + .where( + (tag) => tag.isSpecial == 0) + .toList() + .length - + 1) + commonDivider(), + ], + ); + } + return const SizedBox + .shrink(); // Skip rendering if isSpecial is not 0 + }, + ), + ), + sizedBoxHeight(40.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: text16400white("Standard interest"), + ), + sizedBoxHeight(15.h), + Expanded( + child: fetchinterestobj!.data!.acceptedTags.isEmpty || + fetchinterestobj!.data!.acceptedTags + .every((tag) => tag.isSpecial != 1 && tag != 1) + ? Center( + child: Text( + "No standard interest found", + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ), + ) + : ListView.builder( + shrinkWrap: true, + itemCount: + fetchinterestobj!.data!.acceptedTags.length, + itemBuilder: (context, index) { + if (fetchinterestobj! + .data!.acceptedTags[index].isSpecial == + 1) { + return Column( + children: [ + rowTagsTile( + text: fetchinterestobj! + .data!.acceptedTags[index].name ?? + ''), + if (index != + fetchinterestobj! + .data!.acceptedTags.length - + 1) + commonDivider(), + ], + ); + } + return const SizedBox + .shrink(); // Return an empty widget if the condition is not met + }, + ), + ) + ], + ); + } + return Container(); + }); + } } Widget rowTagsTile({ @@ -131,8 +256,8 @@ Widget rowTagsTile({ return Padding( padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 18.h), child: Row(children: [ - text16w400_FCFCFC(text), - Spacer(), + text16w700_FCFCFCItalic(text), + const Spacer(), Image.asset( "assets/images/png/Group 1000004071.png", width: 5.w, @@ -142,29 +267,205 @@ Widget rowTagsTile({ ); } -Widget tagrequestsrTab() { +class TagRequestTab extends StatefulWidget { + const TagRequestTab({super.key}); + + @override + State createState() => _TagRequestTabState(); +} + +class _TagRequestTabState extends State { + late Future taginterestfuture; + List tagrequest = [ 'Running', 'Fit fam friday', ]; - return Column( - children: [ - sizedBoxHeight(30.h), - ListView.builder( - shrinkWrap: true, - itemCount: tagrequest.length, - itemBuilder: (context, index) { - return Column( - children: [ - rowTagRequestTile(title: tagrequest[index]), - sizedBoxHeight(20.h) - ], - ); - }, - ) - ], - ); + @override + void initState() { + // TODO: implement initState + + communityid = Get.arguments['communityid']; + taginterestfuture = ManageInterestApi().getInterests(communityid); + + super.initState(); + } + + @override + Widget build(BuildContext context) { + return FutureBuilder( + future: taginterestfuture, + builder: (ctx, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return const Center(child: CircularProgressIndicator()); + } + + if (snapshot.hasError) { + return Center( + child: Text( + '${snapshot.error} occurred', + style: TextStyle(fontSize: 18.spMin), + ), + ); + } + + if (snapshot.connectionState == ConnectionState.done && + snapshot.hasData) { + return fetchinterestobj!.data!.requestedTags.isEmpty + ? Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Center( + child: Column( + children: [ + Text( + "No Posts Available", + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ) + ], + ), + ), + ]) + : Column( + children: [ + sizedBoxHeight(30.h), + Expanded( + child: ListView.builder( + shrinkWrap: true, + itemCount: + fetchinterestobj!.data!.requestedTags.length, + itemBuilder: (context, index) { + return Column( + children: [ + Padding( + padding: + EdgeInsets.symmetric(horizontal: 16.w), + child: commonGlassUI( + width: double.infinity, + height: 60.h, + borderRadius: BorderRadius.circular(10.r), + customWidget: Center( + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 16.w), + child: Row(children: [ + text16w700_FCFCFC(fetchinterestobj! + .data! + .requestedTags[index] + .name ?? + ""), + const Spacer(), + GestureDetector( + onTap: () async { + Map updata = { + "tag_xid": fetchinterestobj! + .data! + .requestedTags[index] + .id, + "is_accepted": "0", + }; + final data = + await ManageInterestApi() + .postAcceptReject(updata); + if (data.status == + ResponseStatus.SUCCESS) { + print("success"); + setState(() { + fetchinterestobj! + .data!.requestedTags + .removeAt(index); + }); + return utils + .showToast(data.message); + } else { + Get.back(); + print("Failed"); + return utils + .showToast(data.message); + } + }, + child: commonGlassUI( + width: 35.w, + height: 35.h, + opacity1: 0.24, + opacity2: 0.24, + borderRadius: + BorderRadius.circular(100), + customWidget: const Center( + child: Icon( + Icons.clear, + size: 20, + color: Colors.white, + weight: 1, + )), + borderwidth: 0.5), + ), + sizedBoxWidth(16.w), + GestureDetector( + onTap: () async { + Map updata = { + "tag_xid": fetchinterestobj! + .data! + .requestedTags[index] + .id, + "is_accepted": "1", + }; + final data = + await ManageInterestApi() + .postAcceptReject(updata); + if (data.status == + ResponseStatus.SUCCESS) { + print("success"); + setState(() { + fetchinterestobj! + .data!.requestedTags + .removeAt(index); + }); + return utils + .showToast(data.message); + } else { + Get.back(); + print("Failed"); + return utils + .showToast(data.message); + } + }, + child: Container( + height: 35.h, + width: 35.w, + decoration: const BoxDecoration( + color: Color(0xFFD90B2E), + shape: BoxShape.circle, + ), + child: const Icon( + Icons.check, + size: 20, + color: Colors.white, + weight: 1, + ), + ), + ) + ]), + ), + ), + ), + ), + sizedBoxHeight(20.h) + ], + ); + }, + ), + ) + ], + ); + } + return Container(); + }); + } } Widget rowTagRequestTile({ @@ -181,14 +482,14 @@ Widget rowTagRequestTile({ padding: EdgeInsets.symmetric(horizontal: 16.w), child: Row(children: [ text16w700_FCFCFC(title), - Spacer(), + const Spacer(), commonGlassUI( width: 35.w, height: 35.h, opacity1: 0.24, opacity2: 0.24, borderRadius: BorderRadius.circular(100), - customWidget: Center( + customWidget: const Center( child: Icon( Icons.clear, size: 20, @@ -200,11 +501,11 @@ Widget rowTagRequestTile({ Container( height: 35.h, width: 35.w, - decoration: BoxDecoration( + decoration: const BoxDecoration( color: Color(0xFFD90B2E), shape: BoxShape.circle, ), - child: Icon( + child: const Icon( Icons.check, size: 20, color: Colors.white, diff --git a/lib/sidemenu/Community/Admin/PopupItem/Community settings/ManageTags.dart/Model/FetchInterestModel.dart b/lib/sidemenu/Community/Admin/PopupItem/Community settings/ManageTags.dart/Model/FetchInterestModel.dart new file mode 100644 index 0000000..696c88c --- /dev/null +++ b/lib/sidemenu/Community/Admin/PopupItem/Community settings/ManageTags.dart/Model/FetchInterestModel.dart @@ -0,0 +1,74 @@ +class FetchInterestModel { + FetchInterestModel({ + 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 FetchInterestModel.fromJson(Map json){ + return FetchInterestModel( + status: json["status"], + statusCode: json["status_code"], + message: json["message"], + data: json["data"] == null ? null : Data.fromJson(json["data"]), + ); + } + +} + +class Data { + Data({ + required this.acceptedTags, + required this.requestedTags, + }); + + final List acceptedTags; + final List requestedTags; + + factory Data.fromJson(Map json){ + return Data( + acceptedTags: json["accepted_tags"] == null ? [] : List.from(json["accepted_tags"]!.map((x) => TedTag.fromJson(x))), + requestedTags: json["requested_tags"] == null ? [] : List.from(json["requested_tags"]!.map((x) => TedTag.fromJson(x))), + ); + } + +} + +class TedTag { + TedTag({ + required this.id, + required this.name, + required this.isSpecial, + required this.isRequested, + required this.isAccepted, + required this.isActive, + required this.isPinned, + }); + + final int? id; + final String? name; + final int? isSpecial; + final int? isRequested; + final int? isAccepted; + final int? isActive; + final bool? isPinned; + + factory TedTag.fromJson(Map json){ + return TedTag( + id: json["id"], + name: json["name"], + isSpecial: json["is_special"], + isRequested: json["is_requested"], + isAccepted: json["is_accepted"], + isActive: json["is_active"], + isPinned: json["is_pinned"], + ); + } + +} diff --git a/lib/sidemenu/Community/Admin/PopupItem/Community settings/ManageTags.dart/ViewModel/maanageInterestApi.dart b/lib/sidemenu/Community/Admin/PopupItem/Community settings/ManageTags.dart/ViewModel/maanageInterestApi.dart index 54ac6d2..8ebf8d5 100644 --- a/lib/sidemenu/Community/Admin/PopupItem/Community settings/ManageTags.dart/ViewModel/maanageInterestApi.dart +++ b/lib/sidemenu/Community/Admin/PopupItem/Community settings/ManageTags.dart/ViewModel/maanageInterestApi.dart @@ -1,9 +1,14 @@ // InviteComModel ? inviteComobj; +import 'dart:developer'; + import 'package:regroup/Common/api_urls.dart'; import 'package:regroup/Common/base_manager.dart'; import 'package:regroup/Common/controller/data/network/network_api.dart'; import 'package:regroup/Utils/dialogs.dart'; +import 'package:regroup/sidemenu/Community/Admin/PopupItem/Community%20settings/ManageTags.dart/Model/FetchInterestModel.dart'; + +FetchInterestModel? fetchinterestobj; class ManageInterestApi { Future> postNewInterest(updata) async { @@ -33,4 +38,41 @@ class ManageInterestApi { response.data['message'], ResponseStatus.FAILED); } } + + + Future> getInterests(updata) async { + final response = await NetworkApiServices().getApi( + "${ApiUrls.getinterests}?manage_community_xid=$updata" + + + ); + if (response.status == ResponseStatus.SUCCESS) { + fetchinterestobj = FetchInterestModel.fromJson(response.data); + log(fetchinterestobj!.data.toString()); + } + return response; + } + + + Future> postAcceptReject(updata) async { + print("updata is $updata"); + final response = await NetworkApiServices().postApi( + updata, + ApiUrls.postacceptreject, + ); + if (response.status == ResponseStatus.SUCCESS) { + // if (response.data["status"] == "success") { + // // likepostobj = LikepostModel.fromJson(response.data); + // } + + return ResponseData( + response.data['message'], ResponseStatus.SUCCESS, + data: response.data); + + } else { + return ResponseData( + response.data['message'], ResponseStatus.FAILED); + } + } + } diff --git a/lib/sidemenu/Community/MyCommunity/Community_Info-Page/view/communityInfo.dart b/lib/sidemenu/Community/MyCommunity/Community_Info-Page/view/communityInfo.dart index b00f1d2..f6ca4a6 100644 --- a/lib/sidemenu/Community/MyCommunity/Community_Info-Page/view/communityInfo.dart +++ b/lib/sidemenu/Community/MyCommunity/Community_Info-Page/view/communityInfo.dart @@ -16,7 +16,27 @@ class CommunityInfo extends StatefulWidget { State createState() => _CommunityInfoState(); } +String? bannerImg; +String? comPhoto; +String? comName; +String? comDes; +String? comLocation; +String? comType; + class _CommunityInfoState extends State { + @override + void initState() { + // TODO: implement initState + bannerImg = Get.arguments["bannerimage"]; + comPhoto = Get.arguments["communityphoto"]; + comName = Get.arguments["communityname"]; + comDes = Get.arguments["communitydescription"]; + comLocation = Get.arguments["communitylocation"]; + comType = Get.arguments["communitytype"]; + + super.initState(); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -41,14 +61,23 @@ class _CommunityInfoState extends State { onTap: () { Get.toNamed(RouteName.communityInfo); }, - child: SizedBox( - height: 130.h, - width: double.infinity, - child: Image.asset( - "assets/images/png/img1.png", - fit: BoxFit.cover, - ), - ), + child: bannerImg != null + ? SizedBox( + height: 130.h, + width: double.infinity, + child: Image.network( + bannerImg ?? '', // Replace with your API image URL + fit: BoxFit.cover, + ), + ) + : SizedBox( + height: 130.h, + width: double.infinity, + child: Image.asset( + "assets/images/png/img1.png", + fit: BoxFit.cover, + ), + ), ), Positioned( bottom: -35.h, @@ -70,10 +99,19 @@ class _CommunityInfoState extends State { ), ], ), - child: CircleAvatar( - radius: 42.5.r, - foregroundImage: AssetImage("assets/images/png/img2.png"), - ), + child: comPhoto != null + ? CircleAvatar( + radius: 42.5.r, + foregroundImage: NetworkImage( + comPhoto!), // Replace with your API image URL + backgroundColor: Colors + .transparent, // Optional: If the image fails to load, a transparent background is shown + ) + : CircleAvatar( + radius: 42.5.r, + foregroundImage: + const AssetImage("assets/images/png/img2.png"), + ), )) ]), sizedBoxHeight(50.h), @@ -82,21 +120,20 @@ class _CommunityInfoState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - text20w700_FCFCFC("Active alliance network"), + text20w700_FCFCFC(comName ?? ""), sizedBoxHeight(20.h), commonDivider(), sizedBoxHeight(20.h), text16w400_FCFCFC("About community"), sizedBoxHeight(20.h), - text14w400_FCFCFCblur( - "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book."), + text14w400_FCFCFCblur(comDes ?? ""), sizedBoxHeight(30.h), Row( children: [ commonGlassUI( width: 35.w, height: 35.h, - borderRadius: BorderRadius.circular( 100.r), + borderRadius: BorderRadius.circular(100.r), customWidget: Center( child: Image.asset( "assets/images/png/Group 58645.png", @@ -106,7 +143,7 @@ class _CommunityInfoState extends State { ), borderwidth: 0.5), sizedBoxWidth(8.w), - text16w400_white("Elm street london, United Kingdom") + text16w400_white(comLocation ?? "") ], ), sizedBoxHeight(15.h), @@ -115,7 +152,7 @@ class _CommunityInfoState extends State { commonGlassUI( width: 35.w, height: 35.h, - borderRadius: BorderRadius.circular( 100.r), + borderRadius: BorderRadius.circular(100.r), customWidget: Center( child: Image.asset( "assets/images/png/puzzle-pieces 1 (traced).png", @@ -125,7 +162,7 @@ class _CommunityInfoState extends State { ), borderwidth: 0.5), sizedBoxWidth(8.w), - text16w400_white("Sports") + text16w400_white(comType ?? "") ], ) ]), diff --git a/lib/sidemenu/Community/MyCommunity/Model/ComDetailModel.dart b/lib/sidemenu/Community/MyCommunity/Model/ComDetailModel.dart index 1c24e70..da37dc3 100644 --- a/lib/sidemenu/Community/MyCommunity/Model/ComDetailModel.dart +++ b/lib/sidemenu/Community/MyCommunity/Model/ComDetailModel.dart @@ -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,14 @@ class Data { required this.communityLocation, required this.communityDescription, required this.communityTypeXid, + required this.activityXid, + required this.userLinkInCommunity, required this.accessType, + required this.activityData, }); final int? id; + final bool? isCommunityPinned; final int? totalGroup; final int? totalAnnouncements; final String? communityProfilePhoto; @@ -45,11 +50,15 @@ class Data { final String? communityLocation; final String? communityDescription; final int? communityTypeXid; + final int? activityXid; + final UserLinkInCommunity? userLinkInCommunity; final AccessType? accessType; + final ActivityData? activityData; factory Data.fromJson(Map 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,7 +67,10 @@ class Data { communityLocation: json["community_location"], communityDescription: json["community_description"], communityTypeXid: json["community_type_xid"], + activityXid: json["activity_xid"], + userLinkInCommunity: json["user_link_in_community"] == null ? null : UserLinkInCommunity.fromJson(json["user_link_in_community"]), accessType: json["access_type"] == null ? null : AccessType.fromJson(json["access_type"]), + activityData: json["activity_data"] == null ? null : ActivityData.fromJson(json["activity_data"]), ); } @@ -81,3 +93,60 @@ class AccessType { } } + +class ActivityData { + ActivityData({ + required this.id, + required this.title, + required this.description, + required this.image, + }); + + final int? id; + final String? title; + final String? description; + final String? image; + + factory ActivityData.fromJson(Map json){ + return ActivityData( + id: json["id"], + title: json["title"], + description: json["description"], + image: json["image"], + ); + } + +} + +class UserLinkInCommunity { + UserLinkInCommunity({ + required this.id, + required this.iamPrincipalXid, + required this.manageCommunityXid, + required this.joinedAt, + required this.userTypeXid, + required this.isRequested, + required this.isMute, + }); + + final int? id; + final int? iamPrincipalXid; + final int? manageCommunityXid; + final DateTime? joinedAt; + final AccessType? userTypeXid; + final int? isRequested; + final int? isMute; + + factory UserLinkInCommunity.fromJson(Map json){ + return UserLinkInCommunity( + id: json["id"], + iamPrincipalXid: json["iam_principal_xid"], + manageCommunityXid: json["manage_community_xid"], + joinedAt: DateTime.tryParse(json["joined_at"] ?? ""), + userTypeXid: json["user_type_xid"] == null ? null : AccessType.fromJson(json["user_type_xid"]), + isRequested: json["is_requested"], + isMute: json["is_mute"], + ); + } + +} diff --git a/lib/sidemenu/Community/MyCommunity/NewCommunity.dart b/lib/sidemenu/Community/MyCommunity/NewCommunity.dart index 59b7d66..f9e6531 100644 --- a/lib/sidemenu/Community/MyCommunity/NewCommunity.dart +++ b/lib/sidemenu/Community/MyCommunity/NewCommunity.dart @@ -18,7 +18,8 @@ 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/Model/activitiesListModel.dart' as primaryactlist; +import 'package:regroup/sidemenu/Community/MyCommunity/Model/activitiesListModel.dart' + as primaryactlist; import 'package:regroup/sidemenu/Community/MyCommunity/view_model/primaryactivity.dart'; import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart'; import 'package:path/path.dart' as path; @@ -64,7 +65,8 @@ class _NewCommunityState extends State { ResponseData response = await abilityLsitAPI.getActivitylistApi(); if (response.status == ResponseStatus.SUCCESS) { - abilityModel = primaryactlist.ActivitiesListsModel.fromJson(response.data!); + abilityModel = + primaryactlist.ActivitiesListsModel.fromJson(response.data!); setState(() { activity = abilityModel?.data ?? []; // Store the fetched cities _activitydrop = @@ -425,32 +427,38 @@ class _NewCommunityState extends State { text: "Create community", onPressed: () { // Get.toNamed(RouteName.addgroup); - if (bannerPath.isEmpty || - communitycontroller.text.isEmpty || - communitydescrcontroller.text.isEmpty || - _selectedtypecommunity.isEmpty || - locationcontroller.text.isEmpty || - selectedactivityid.isBlank!) { - utils.showToast('Please fill all fields'); - } else if (filePath.isEmpty) { + if (filePath.isEmpty) { utils.showToast( 'Please add community profile picture'); + } else if (bannerPath.isEmpty) { + utils.showToast('Please add banner image'); + } else if (communitycontroller.text.isEmpty) { + utils.showToast('Please enter community name'); + } else if (communitydescrcontroller.text.isEmpty) { + utils.showToast('Please enter community description'); + } else if (_selectedtypecommunity.isEmpty) { + utils.showToast('Please select type of community'); + } else if (locationcontroller.text.isEmpty) { + utils.showToast('Please enter location'); + } else if (selectedactivityid == null) { + utils.showToast('Please select primary activity'); } else { print('done'); // indiUploadata(); // Uploadata(); - int communityTypeValue = _TypecommunityMap[_selectedtypecommunity] ?? 0; - - Get.toNamed(RouteName.addgroup,arguments: { - 'communityname' : communitycontroller.text, - 'communitylocation' : locationcontroller.text, - 'communitydescription' : communitydescrcontroller.text, - 'communitytype' : communityTypeValue, - 'activityid' : selectedactivityid, - 'communityprofilephoto' : filePath, - 'communitybannerimage' : bannerPath, - }); + int communityTypeValue = + _TypecommunityMap[_selectedtypecommunity] ?? 0; + Get.toNamed(RouteName.addgroup, arguments: { + 'communityname': communitycontroller.text, + 'communitylocation': locationcontroller.text, + 'communitydescription': + communitydescrcontroller.text, + 'communitytype': communityTypeValue, + 'activityid': selectedactivityid, + 'communityprofilephoto': filePath, + 'communitybannerimage': bannerPath, + }); } }, ), diff --git a/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart b/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart index 12fe0f3..fd069f7 100644 --- a/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart +++ b/lib/sidemenu/Community/MyCommunity/View/CommunityDetails.dart @@ -21,6 +21,7 @@ import 'package:regroup/resources/routes/route_name.dart'; import 'package:regroup/sidemenu/Community/MyCommunity/view_model/ComDetails.dart'; var CommunityId; +int? ismute; class CommunityDetails extends StatefulWidget { const CommunityDetails({super.key}); @@ -30,7 +31,7 @@ class CommunityDetails extends StatefulWidget { } class _CommunityDetailsState extends State { - bool? additionalContent = false; + var additionalContent = false.obs; late Future myfuture; @@ -38,7 +39,7 @@ class _CommunityDetailsState extends State { void initState() { CommunityId = Get.arguments["CommunityID"]; myfuture = CommunityDetail().getCommunityDetail(CommunityId); - + ismute = comdetailobj?.data?.userLinkInCommunity?.isMute; super.initState(); } @@ -60,557 +61,609 @@ class _CommunityDetailsState extends State { @override Widget build(BuildContext context) { - return Scaffold( - // key: _scaffoldKey1, - backgroundColor: const Color(0xFF222935), - extendBody: true, - resizeToAvoidBottomInset: false, - appBar: CommonAppbar( - titleTxt: "", - customActionWidget: PopupMenuButton( - surfaceTintColor: const Color(0xFF222935), - constraints: BoxConstraints.tightFor(width: 190.w), - offset: const Offset(0, 40), - color: const Color(0xFF222935), - tooltip: "", - itemBuilder: (BuildContext context) => [ - PopupMenuItem( - onTap: () {}, - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 8.w), - child: Row( - children: [ - text14w400white("Invite"), - const Spacer(), - Image.asset( - "assets/images/png/uiw_user-add.png", - height: 15.h, - width: 15.w, - ) - ], - ), - ), - ), - const PopupMenuDivider(), - PopupMenuItem( - onTap: () {}, - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 8.w), - child: Row( - children: [ - text14w400white("Share"), - const Spacer(), - Image.asset( - "assets/images/png/share.png", - height: 20.h, - width: 20.w, - ) - ], - ), - ), - ), - const PopupMenuDivider(), - PopupMenuItem( - onTap: () {}, - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 8.w), - child: Row( - children: [ - text14w400white("Search"), - const Spacer(), - Image.asset( - "assets/images/png/Frame 58575.png", - height: 18.h, - width: 18.w, - ) - ], - ), - ), - ), - const PopupMenuDivider(), - PopupMenuItem( - onTap: () {}, - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 8.w), - child: Row( - children: [ - text14w400white("Mute notification"), - const Spacer(), - Image.asset( - "assets/images/png/Black1233.png", - height: 16.h, - width: 16.w, - ) - ], - ), - ), - ), - const PopupMenuDivider(), - PopupMenuItem( - onTap: () {}, - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 8.w), - child: Row( - children: [ - text14w400white("Pin"), - const Spacer(), - Image.asset( - "assets/images/png/f7_pin-fill (2).png", - height: 25.h, - width: 25.w, - ) - ], - ), - ), - ), - const PopupMenuDivider(), - PopupMenuItem( - onTap: () { - Get.toNamed(RouteName.communitysetting, arguments: { - 'communityid': CommunityId, - }); - }, - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 8.w), - child: Row( - children: [ - text14w400white("Edit community"), - const Spacer(), - Image.asset( - "assets/images/png/setting2.png", - height: 18.h, - width: 18.w, - ) - ], - ), - ), - ), - 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, - ) - ], - ), - ), - ), - PopupMenuDivider(), - PopupMenuItem( - onTap: () { - Get.toNamed(RouteName.communitysetting, arguments: { - 'communityid': CommunityId, - }); - }, - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 8.w), - child: Row( - children: [ - text14w400white("Edit community"), - Spacer(), - Image.asset( - "assets/images/png/setting2.png", - height: 18.h, - width: 18.w, - ) - ], - ), - ), - ), - ], - child: Image.asset( - 'assets/images/png/Group 1000004071.png', - height: 20.h, - width: 20.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), - ), - ); - } - } - return Stack(children: [ - Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: - AssetImage("assets/images/png/Ellipse 1496.png"), - fit: BoxFit.fill)), - ), - Positioned.fill( - child: SingleChildScrollView( - child: Column(children: [ - Stack(clipBehavior: Clip.none, children: [ - GestureDetector( - onTap: () { - Get.toNamed(RouteName.communityInfo); - }, - child: comdetailobj!.data!.communityBannerImage != null - ? SizedBox( - height: 130.h, - width: double.infinity, - child: Image.network( - comdetailobj!.data! - .communityBannerImage!, // Replace with your API image URL - fit: BoxFit.cover, - ), - ) - : SizedBox( - height: 130.h, - width: double.infinity, - child: Image.asset( - "assets/images/png/img1.png", - fit: BoxFit.cover, - ), - ), - ), - Positioned( - bottom: -35.h, - left: 20.w, - child: Container( - width: 85.r, - height: 85.r, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: const Color.fromRGBO(255, 255, 255, 0.5), - width: 1, - ), - boxShadow: const [ - BoxShadow( - color: Color.fromRGBO(0, 0, 0, 0.25), - blurRadius: 12, - offset: Offset(0, 6), - ), + 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: "", + customActionWidget: PopupMenuButton( + surfaceTintColor: const Color(0xFF222935), + constraints: BoxConstraints.tightFor(width: 190.w), + offset: const Offset(0, 40), + color: const Color(0xFF222935), + tooltip: "", + itemBuilder: (BuildContext context) => [ + PopupMenuItem( + onTap: () {}, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 8.w), + child: Row( + children: [ + text14w400white("Invite"), + const Spacer(), + Image.asset( + "assets/images/png/uiw_user-add.png", + height: 15.h, + width: 15.w, + ) ], ), - child: - comdetailobj!.data!.communityProfilePhoto != null - ? CircleAvatar( - radius: 42.5.r, - foregroundImage: NetworkImage(comdetailobj! - .data! - .communityProfilePhoto!), // Replace with your API image URL - backgroundColor: Colors - .transparent, // Optional: If the image fails to load, a transparent background is shown - ) - : CircleAvatar( - radius: 42.5.r, - foregroundImage: const AssetImage( - "assets/images/png/img2.png"), - ), - )) - ]), - sizedBoxHeight(40.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Column(children: [ - Row( - children: [ - text20w700_FCFCFC( - comdetailobj!.data!.communityName ?? ""), - const Spacer(), - commonGlassUI( - width: 35.w, - height: 35.h, - borderRadius: BorderRadius.circular(100), - opacity1: 0.24, - opacity2: 0.24, - customWidget: Center( - child: Image.asset( - "assets/images/png/img12.png", - height: 18.w, - width: 18.w, - )), - borderwidth: 0.5), - sizedBoxWidth(8.w), - text16w400_FCFCFCblur( - comdetailobj!.data!.accessType!.name ?? ""), - ], ), - sizedBoxHeight(30.h), - InkWell( - onTap: () { - additionalContent = !additionalContent!; - setState(() {}); - }, + ), + const PopupMenuDivider(), + PopupMenuItem( + onTap: () {}, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 8.w), child: Row( - mainAxisAlignment: MainAxisAlignment.center, children: [ - text13w400_FCFCFC("Show Details"), - sizedBoxWidth(4.w), + text14w400white("Share"), + const Spacer(), Image.asset( - "assets/images/png/Vector 8.png", - height: 8.h, + "assets/images/png/share.png", + height: 20.h, width: 20.w, ) ], ), ), - if (additionalContent == true) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - sizedBoxHeight(30.h), - text16w400_FCFCFC("About community"), - sizedBoxHeight(16.h), - text14w400_FCFCFCblur( - comdetailobj!.data!.communityDescription ?? - ""), - sizedBoxHeight(20.h), - Row( - children: [ - commonGlassUI( - width: 35.w, - height: 35.h, - opacity1: 0.24, - opacity2: 0.24, - borderRadius: - BorderRadius.circular(100), - customWidget: Center( - child: Image.asset( - "assets/images/png/Group 58645.png", - height: 17.h, - width: 13.w, - ), - ), - borderwidth: 0.5), - sizedBoxWidth(12.w), - text16400white( - comdetailobj!.data!.communityLocation ?? - "") - ], - ), - sizedBoxHeight(16.h), - Row( - children: [ - commonGlassUI( - width: 35.w, - height: 35.h, - opacity1: 0.24, - opacity2: 0.24, - borderRadius: - BorderRadius.circular(100), - customWidget: Center( - child: Image.asset( - "assets/images/png/puzzle-pieces 1 (traced).png", - height: 20.h, - width: 16.w, - ), - ), - borderwidth: 0.5), - sizedBoxWidth(12.w), - text16400white("Sports") - ], - ), - sizedBoxHeight(20.h), - commonGlassUI( - width: double.infinity, - height: 51.h, - borderRadius: BorderRadius.circular(10.r), - customWidget: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - GestureDetector( - onTap: () { - Get.toNamed( - RouteName.communitymembers, - arguments: { - 'communityid': CommunityId, - }); - }, - 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", - ], - ), - sizedBoxWidth(90.w), - text16w400_white('7 members'), - const Spacer(), - Icon( - Icons.arrow_forward, - size: 20.sp, - color: Colors.white, - ), - sizedBoxWidth(16.w), - ], - ), - ), - ], - ), - ), - sizedBoxHeight(20.h), - GestureDetector( - onTap: () { - // Get.toNamed(RouteName.addgroup); - Get.toNamed(RouteName.group, arguments: { - 'id': CommunityId, - 'iscommunity': true, - }); - }, - child: commonGlassUI( - width: double.infinity, - height: 51.h, - borderRadius: BorderRadius.circular(10.r), - customWidget: Padding( - padding: EdgeInsets.symmetric( - horizontal: 16.w), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Row(children: [ - Image.asset( - "assets/images/png/Black.png", - height: 23.h, - width: 31.w, - ), - sizedBoxWidth(15.w), - text16w400white( - '${comdetailobj!.data!.totalGroup} groups'), - const Spacer(), - Icon( - Icons.arrow_forward, - size: 20.sp, - color: Colors.white, - ), - ]), - ], - ), - ), - borderwidth: 1), - ), - ]), - sizedBoxHeight(25.h), - GestureDetector( - onTap: () { - // Get.toNamed(RouteName.addgroup); - Get.toNamed(RouteName.group, arguments: { - 'id': CommunityId, - 'iscommunity': true, - }); - }, - child: commonGlassUI( - width: double.infinity, - height: 51.h, - borderRadius: BorderRadius.circular(10.r), - customWidget: Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row(children: [ - Image.asset( - "assets/images/png/marketing 1 (traced).png", - height: 23.h, - width: 31.w, - ), - sizedBoxWidth(15.w), - Column( - children: [ - text16w400white('Announcements'), - text11w400_F91D42( - "${comdetailobj!.data!.totalAnnouncements.toString()} New Announcements Request") - ], - ), - const Spacer(), - Container( - height: 21.h, - width: 43.w, - decoration: BoxDecoration( - color: const Color(0xFFD90B2E), - borderRadius: - BorderRadius.circular(30.r)), - child: Center( - child: text12w400_FCFCFC( - comdetailobj! - .data!.totalAnnouncements - .toString())), - ) - ]), - ], - ), - ), - borderwidth: 1), - ), - sizedBoxHeight(40.h), - // Container( - // height: 40.h, - // width: 200.w, - // decoration: BoxDecoration( - // color: const Color(0xFFD90B2E), - // borderRadius: BorderRadius.circular(30.r)), - // child: Center( - // child: text14w400white("Leave the community")), - // ), - sizedBoxHeight(50.h), - ])), - DefaultTabController( - length: 2, - // initialIndex: selectedIndex.value, - child: Column( - children: [ - const CommonTabBar(tabs: [ - Tab( - text: 'Posts', - ), - Tab( - text: 'Events', - ), - ]), - SizedBox( - height: 600.h, - child: TabBarView( + ), + const PopupMenuDivider(), + PopupMenuItem( + onTap: () {}, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 8.w), + child: Row( children: [ - const PostsTab(), - eventstab(), + text14w400white("Search"), + const Spacer(), + Image.asset( + "assets/images/png/Frame 58575.png", + height: 18.h, + width: 18.w, + ) ], ), ), - ], - ), + ), + const PopupMenuDivider(), + PopupMenuItem( + onTap: () async { + Map updata = { + "manage_community_xid": CommunityId, + }; + final data = await CommunityDetail() + .postMuteNotification(updata); + if (data.status == ResponseStatus.SUCCESS) { + print("success"); + setState(() {}); + await CommunityDetail() + .getCommunityDetail(CommunityId); + // Convert int to bool, toggle, and then convert back to int + 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 notification") + : text14w400white("Mute notification"), + 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: () {}, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 8.w), + child: Row( + children: [ + text14w400white("Pin"), + const Spacer(), + Image.asset( + "assets/images/png/f7_pin-fill (2).png", + height: 25.h, + width: 25.w, + ) + ], + ), + ), + ), + if (comdetailobj!.data!.accessType!.name == "Member") + const PopupMenuDivider(), + if (comdetailobj!.data!.accessType!.name == "Member") + PopupMenuItem( + onTap: () { + Get.toNamed(RouteName.communitysetting, arguments: { + 'communityid': CommunityId, + }); + }, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 8.w), + child: Row( + children: [ + text14w400white("Edit community"), + const Spacer(), + Image.asset( + "assets/images/png/setting2.png", + height: 18.h, + width: 18.w, + ) + ], + ), + ), + ), + 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', + height: 20.h, + width: 20.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), + ), + ); + } + } + ismute = comdetailobj?.data?.userLinkInCommunity?.isMute; + return Stack(children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage( + "assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), ), - ]))) - ]); - })); + Positioned.fill( + child: SingleChildScrollView( + child: Column(children: [ + Stack(clipBehavior: Clip.none, children: [ + GestureDetector( + onTap: () { + Get.toNamed(RouteName.communityInfo, arguments: { + 'bannerimage': + comdetailobj!.data!.communityBannerImage, + 'communityphoto': + comdetailobj!.data!.communityProfilePhoto, + 'communityname': comdetailobj!.data!.communityName, + 'communitydescription': + comdetailobj!.data!.communityDescription, + 'communitylocation': + comdetailobj!.data!.communityLocation, + 'communitytype': + comdetailobj!.data!.activityData!.title, + }); + }, + child: comdetailobj!.data!.communityBannerImage != null + ? SizedBox( + height: 130.h, + width: double.infinity, + child: Image.network( + comdetailobj!.data! + .communityBannerImage!, // Replace with your API image URL + fit: BoxFit.cover, + ), + ) + : SizedBox( + height: 130.h, + width: double.infinity, + child: Image.asset( + "assets/images/png/img1.png", + fit: BoxFit.cover, + ), + ), + ), + Positioned( + bottom: -35.h, + left: 20.w, + child: Container( + width: 85.r, + height: 85.r, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all( + color: const Color.fromRGBO(255, 255, 255, 0.5), + width: 1, + ), + boxShadow: const [ + BoxShadow( + color: Color.fromRGBO(0, 0, 0, 0.25), + blurRadius: 12, + offset: Offset(0, 6), + ), + ], + ), + child: comdetailobj!.data!.communityProfilePhoto != + null + ? CircleAvatar( + radius: 42.5.r, + foregroundImage: NetworkImage(comdetailobj! + .data! + .communityProfilePhoto!), // Replace with your API image URL + backgroundColor: Colors + .transparent, // Optional: If the image fails to load, a transparent background is shown + ) + : CircleAvatar( + radius: 42.5.r, + foregroundImage: const AssetImage( + "assets/images/png/img2.png"), + ), + )) + ]), + sizedBoxHeight(40.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Column(children: [ + Row( + children: [ + text20w700_FCFCFC( + comdetailobj!.data!.communityName ?? ""), + const Spacer(), + commonGlassUI( + width: 35.w, + height: 35.h, + borderRadius: BorderRadius.circular(100), + opacity1: 0.24, + opacity2: 0.24, + customWidget: Center( + child: Image.asset( + "assets/images/png/img12.png", + height: 18.w, + width: 18.w, + )), + borderwidth: 0.5), + sizedBoxWidth(8.w), + text16w400_FCFCFCblur( + comdetailobj!.data!.accessType!.name ?? ""), + ], + ), + sizedBoxHeight(30.h), + InkWell( + onTap: () { + additionalContent.value = + !additionalContent.value; + setState(() {}); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + text13w400_FCFCFC("Show Details"), + sizedBoxWidth(8.w), + additionalContent.value == true + ? Image.asset( + "assets/images/png/uparrow.png", + height: 15.h, + width: 15.w, + ) + : Image.asset( + "assets/images/png/downarrow.png", + height: 15.h, + width: 15.w, + ) + ], + ), + ), + Obx(() { + return additionalContent.value == true + ? Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + sizedBoxHeight(30.h), + text16w400_FCFCFC("About community"), + sizedBoxHeight(16.h), + text14w400_FCFCFCblur(comdetailobj! + .data!.communityDescription ?? + ""), + sizedBoxHeight(20.h), + Row( + children: [ + commonGlassUI( + width: 35.w, + height: 35.h, + opacity1: 0.24, + opacity2: 0.24, + borderRadius: + BorderRadius.circular(100), + customWidget: Center( + child: Image.asset( + "assets/images/png/Group 58645.png", + height: 17.h, + width: 13.w, + ), + ), + borderwidth: 0.5), + sizedBoxWidth(12.w), + text16400white(comdetailobj! + .data!.communityLocation ?? + "") + ], + ), + sizedBoxHeight(16.h), + Row( + children: [ + commonGlassUI( + width: 35.w, + height: 35.h, + opacity1: 0.24, + opacity2: 0.24, + borderRadius: + BorderRadius.circular(100), + customWidget: Center( + child: Image.asset( + "assets/images/png/puzzle-pieces 1 (traced).png", + height: 20.h, + width: 16.w, + ), + ), + borderwidth: 0.5), + sizedBoxWidth(12.w), + text16400white(comdetailobj!.data! + .activityData!.title ?? + "Sports") + ], + ), + sizedBoxHeight(20.h), + commonGlassUI( + width: double.infinity, + height: 51.h, + borderRadius: + BorderRadius.circular(10.r), + customWidget: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + GestureDetector( + onTap: () { + Get.toNamed( + RouteName + .communitymembers, + arguments: { + 'communityid': + CommunityId, + }); + }, + 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", + ], + ), + sizedBoxWidth(90.w), + text16w400_white( + '7 members'), + const Spacer(), + Icon( + Icons.arrow_forward, + size: 20.sp, + color: Colors.white, + ), + sizedBoxWidth(16.w), + ], + ), + ), + ], + ), + ), + sizedBoxHeight(20.h), + GestureDetector( + onTap: () { + // Get.toNamed(RouteName.addgroup); + Get.toNamed(RouteName.group, + arguments: { + 'id': CommunityId, + 'iscommunity': true, + }); + }, + child: commonGlassUI( + width: double.infinity, + height: 51.h, + borderRadius: + BorderRadius.circular(10.r), + customWidget: Padding( + padding: EdgeInsets.symmetric( + horizontal: 16.w), + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Row(children: [ + Image.asset( + "assets/images/png/Black.png", + height: 23.h, + width: 31.w, + ), + sizedBoxWidth(15.w), + text16w400white( + '${comdetailobj!.data!.totalGroup} groups'), + const Spacer(), + Icon( + Icons.arrow_forward, + size: 20.sp, + color: Colors.white, + ), + ]), + ], + ), + ), + borderwidth: 1), + ), + ]) + : SizedBox(); + }), + + sizedBoxHeight(25.h), + GestureDetector( + onTap: () { + // Get.toNamed(RouteName.addgroup); + Get.toNamed(RouteName.group, arguments: { + 'id': CommunityId, + 'iscommunity': true, + }); + }, + child: commonGlassUI( + width: double.infinity, + height: 51.h, + borderRadius: BorderRadius.circular(10.r), + customWidget: Padding( + padding: + EdgeInsets.symmetric(horizontal: 16.w), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row(children: [ + Image.asset( + "assets/images/png/marketing 1 (traced).png", + height: 23.h, + width: 31.w, + ), + sizedBoxWidth(15.w), + Column( + children: [ + text16w400white('Announcements'), + text11w400_F91D42( + "${comdetailobj!.data!.totalAnnouncements.toString()} New Announcements Request") + ], + ), + const Spacer(), + Container( + height: 21.h, + width: 43.w, + decoration: BoxDecoration( + color: const Color(0xFFD90B2E), + borderRadius: + BorderRadius.circular(30.r)), + child: Center( + child: text12w400_FCFCFC( + comdetailobj! + .data!.totalAnnouncements + .toString())), + ) + ]), + ], + ), + ), + borderwidth: 1), + ), + sizedBoxHeight(40.h), + // Container( + // height: 40.h, + // width: 200.w, + // decoration: BoxDecoration( + // color: const Color(0xFFD90B2E), + // borderRadius: BorderRadius.circular(30.r)), + // child: Center( + // child: text14w400white("Leave the community")), + // ), + sizedBoxHeight(50.h), + ])), + DefaultTabController( + length: 2, + // initialIndex: selectedIndex.value, + child: Column( + children: [ + const CommonTabBar(tabs: [ + Tab( + text: 'Posts', + ), + Tab( + text: 'Events', + ), + ]), + SizedBox( + height: 600.h, + child: TabBarView( + children: [ + const PostsTab(), + eventstab(), + ], + ), + ), + ], + ), + ), + ]))) + ]); + })), + ); } } diff --git a/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart b/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart index b5f5549..28d481c 100644 --- a/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart +++ b/lib/sidemenu/Community/MyCommunity/View/MyCommunity.dart @@ -5,11 +5,14 @@ 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_model/ComDetails.dart'; import 'package:regroup/sidemenu/view_model/getMyCommunity.dart'; class MyCommunity extends StatefulWidget { @@ -20,6 +23,7 @@ class MyCommunity extends StatefulWidget { } class _MyCommunityState extends State { + int? ismute; List JoinedcommunityData = [ { "imagePath": "assets/images/png/img2.png", @@ -66,6 +70,7 @@ class _MyCommunityState extends State { void initState() { // TODO: implement initState myfuture = MyCommunityAPI().getMyCommunity(); + super.initState(); } @@ -144,6 +149,10 @@ class _MyCommunityState extends State { ); } } + for (int i = 0; i < myCommunityobj!.data.length; i++) { + ismute = myCommunityobj!.data[i].isMute; + } + return myCommunityobj!.data!.isEmpty ? _buildNoDataBody(context) : _buildBody(context); @@ -191,7 +200,7 @@ class _MyCommunityState extends State { onTap: () { Get.toNamed(RouteName.requestscreen); }, - child: text16w700_FCFCFC_line("Requests")) + child: text16w700_FCFCFC_line("Request and Invites")) ], ), sizedBoxHeight(20.h), @@ -234,24 +243,27 @@ class _MyCommunityState extends State { child: // Center( // child: Image.asset(imagepath, fit: BoxFit.cover)), - joinnedComData.joinedAndRequestedCommunity! - .communityProfilePhoto == - null || + + joinnedComData + .joinedAndRequestedCommunity != + null && + joinnedComData + .joinedAndRequestedCommunity! + .communityProfilePhoto != + null && joinnedComData .joinedAndRequestedCommunity! .communityProfilePhoto! - .isEmpty - ? const CircleAvatar( - backgroundImage: - AssetImage( - 'assets/images/png/img45.png', - ), - ) - : CircleAvatar( + .isNotEmpty + ? CircleAvatar( backgroundImage: NetworkImage( joinnedComData .joinedAndRequestedCommunity! .communityProfilePhoto!), + ) + : const CircleAvatar( + backgroundImage: AssetImage( + 'assets/images/png/img45.png'), )), sizedBoxWidth(13.w), Column( @@ -263,21 +275,23 @@ class _MyCommunityState extends State { // // color: Colors.red, // width: double.infinity, // child: - joinnedComData.joinedAndRequestedCommunity! - .communityName == - null || - joinnedComData + + SizedBox( + width: 200.w, + child: text18w700_FCFCFC( + joinnedComData.joinedAndRequestedCommunity != + null && + joinnedComData + .joinedAndRequestedCommunity! + .communityName != + null + ? joinnedComData .joinedAndRequestedCommunity! .communityName! - .isEmpty - ? text18w700_FCFCFC('Regroup') - : SizedBox( - width: 200.w, - child: text18w700_FCFCFC( - joinnedComData - .joinedAndRequestedCommunity! - .communityName!), - ), + : "", + ), + ), + // ), sizedBoxHeight(10.h), joinnedComData.totalCommunityMember == @@ -332,7 +346,8 @@ class _MyCommunityState extends State { ]), sizedBoxWidth(15.w), text14w400_FCFCFCblur( - "${joinnedComData.joinedAndRequestedCommunity!.totalGroup ?? ''} groups"), + "${joinnedComData.joinedAndRequestedCommunity != null && joinnedComData.joinedAndRequestedCommunity!.totalGroup != null ? joinnedComData.joinedAndRequestedCommunity!.totalGroup : ''} groups", + ), sizedBoxWidth(50.w), GestureDetector( onTap: () { @@ -387,21 +402,61 @@ class _MyCommunityState extends State { itemBuilder: (BuildContext context) => [ PopupMenuItem( - onTap: () {}, + onTap: () async { + Map + 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: [ - text14w400_FCFCFC( - "Mute group"), + ismute == 1 + ? text14w400white( + "Unmute community") + : text14w400white( + "Mute community"), const Spacer(), - Image.asset( - "assets/images/png/Black (1).png", - height: 18.h, - width: 18.w, - ) + 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, + ) ], ), ), @@ -429,28 +484,32 @@ class _MyCommunityState extends State { ), 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 { + utils.loader(); + Map + 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( @@ -459,7 +518,7 @@ class _MyCommunityState extends State { children: [ // text14w400_FCFCFC("Leave group"), text14w400_D90B2E( - "Leave group"), + "Leave Community"), const Spacer(), Image.asset( "assets/images/png/LightGray22.png", @@ -501,6 +560,12 @@ class _MyCommunityState extends State { : text16w400_FCFCFC_blur( '${joinnedComData.totalCommunityMember} members', ), + Spacer(), + Image.asset( + "assets/images/png/arrow.png", + height: 21.h, + width: 18.w, + ), ], ) ], diff --git a/lib/sidemenu/Community/MyCommunity/View/RequestsScreen.dart b/lib/sidemenu/Community/MyCommunity/View/RequestsScreen.dart index caded4a..b106e9a 100644 --- a/lib/sidemenu/Community/MyCommunity/View/RequestsScreen.dart +++ b/lib/sidemenu/Community/MyCommunity/View/RequestsScreen.dart @@ -38,7 +38,7 @@ class _RequestsScreenState extends State { extendBody: true, resizeToAvoidBottomInset: false, appBar: CommonAppbar( - titleTxt: "My Communities", + titleTxt: "Request and Invites", customActionWidget: Row( children: [ sizedBoxWidth(12.w), @@ -233,104 +233,75 @@ class _RequestedTabState extends State { : 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( - "${requestedComData.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")), - ), + stackContainersGroups( + number: + " +${requestedComData.totalCommunityMember! - 3}", + containerImages: requestedComData + .fourMemberImages! + .map((photo) => photo + .iamPrincipal! + .profilePhoto!) + .toList(), ), + sizedBoxWidth(75.w), + requestedComData.totalCommunityMember == + null || + requestedComData + .totalCommunityMember! + .isBlank! + ? const SizedBox() + : text16w400_FCFCFC_blur( + '${requestedComData.totalCommunityMember} members', + ), + // 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( + // "${requestedComData.joinedAndRequestedCommunity!.totalGroup ?? ''} groups"), + // sizedBoxWidth(50.w), ], ), ], @@ -450,31 +421,9 @@ class _RequestedTabState extends State { sizedBoxHeight(10.h), Expanded( child: Row( - crossAxisAlignment: - CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, children: [ - stackContainersGroups( - number: - " +${requestedComData.totalCommunityMember! - 3}", - containerImages: - requestedComData - .fourMemberImages! - .map((photo) => photo - .iamPrincipal! - .profilePhoto!) - .toList(), - ), - sizedBoxWidth(75.w), - requestedComData.totalCommunityMember == - null || - requestedComData - .totalCommunityMember! - .isBlank! - ? const SizedBox() - : text16w400_FCFCFC_blur( - '${requestedComData.totalCommunityMember} members', - ), - Spacer(), GestureDetector( onTap: () async { Map @@ -506,7 +455,7 @@ class _RequestedTabState extends State { }, child: Container( height: 30.h, - width: 120.w, + width: 180.w, decoration: BoxDecoration( borderRadius: BorderRadius @@ -517,7 +466,7 @@ class _RequestedTabState extends State { child: text12w400_FCFCFC( "Cancel request")), ), - ) + ), ], ), ) @@ -699,76 +648,28 @@ class _InvitedTabState extends State { // : sizedBoxHeight(10.h), Row( 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, - ), - )), - sizedBoxWidth(15.w), - // text14w400_FCFCFCblur( - // "${invitedComData.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")), - ), + stackContainersGroups( + number: invitedComData + .community != + null + ? " +${invitedComData.community!.totalCommunityMember! - 3}" + : "", + containerImages: invitedComData + .community + ?.fourMemberImages + .map((photo) => photo + .iamPrincipal! + .profilePhoto!) + .toList() ?? + [], ), + sizedBoxWidth(75.w), + if (invitedComData + .community != + null) + text16w400_FCFCFC_blur( + '${invitedComData.community!.totalCommunityMember} members', + ), ], ), ], @@ -890,6 +791,8 @@ class _InvitedTabState extends State { child: Row( crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.spaceAround, children: [ // stackContainersGroups( // number: @@ -910,7 +813,7 @@ class _InvitedTabState extends State { // : text16w400_FCFCFC_blur( // '${joinnedComData.totalCommunityMember} members', // ), - Spacer(), + GestureDetector( onTap: () async { Map @@ -942,7 +845,7 @@ class _InvitedTabState extends State { }, child: Container( height: 30.h, - width: 70.w, + width: 160.w, decoration: BoxDecoration( borderRadius: BorderRadius.circular( @@ -1008,7 +911,7 @@ class _InvitedTabState extends State { }, child: Container( height: 30.h, - width: 70.w, + width: 160.w, decoration: BoxDecoration( borderRadius: BorderRadius diff --git a/lib/sidemenu/Community/MyCommunity/view_model/ComDetails.dart b/lib/sidemenu/Community/MyCommunity/view_model/ComDetails.dart index 4c7a265..c024154 100644 --- a/lib/sidemenu/Community/MyCommunity/view_model/ComDetails.dart +++ b/lib/sidemenu/Community/MyCommunity/view_model/ComDetails.dart @@ -52,4 +52,15 @@ class CommunityDetail { } return response; } + + Future> postMuteNotification(updata) async { + final response = await NetworkApiServices().postApi( + updata, + ApiUrls.postmutenotification, + ); + if (response.status == ResponseStatus.SUCCESS) { + + } + return response; + } } \ No newline at end of file diff --git a/lib/sidemenu/Model/InviteComModel.dart b/lib/sidemenu/Model/InviteComModel.dart index f945183..ef012a1 100644 --- a/lib/sidemenu/Model/InviteComModel.dart +++ b/lib/sidemenu/Model/InviteComModel.dart @@ -1,92 +1,152 @@ class InviteComModel { - InviteComModel({ - required this.status, - required this.statusCode, - required this.message, - required this.data, - }); + InviteComModel({ + required this.status, + required this.statusCode, + required this.message, + required this.data, + }); - final String? status; - final int? statusCode; - final String? message; - final List data; - - factory InviteComModel.fromJson(Map json){ - return InviteComModel( - status: json["status"], - statusCode: json["status_code"], - message: json["message"], - data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => Datum.fromJson(x))), - ); - } + final String? status; + final int? statusCode; + final String? message; + final List data; + factory InviteComModel.fromJson(Map json) { + return InviteComModel( + status: json["status"], + statusCode: json["status_code"], + message: json["message"], + data: json["data"] == null + ? [] + : List.from(json["data"]!.map((x) => Datum.fromJson(x))), + ); + } } class Datum { - Datum({ - required this.id, - required this.senderIamXid, - required this.communityXid, - required this.receiverIamXid, - required this.isAccepted, - required this.createdAt, - required this.updatedAt, - required this.deletedAt, - required this.community, - required this.senderDetail, - }); + Datum({ + required this.id, + required this.senderIamXid, + required this.communityXid, + required this.isAccepted, + required this.community, + required this.senderDetail, + }); - final int? id; - final int? senderIamXid; - final int? communityXid; - final int? receiverIamXid; - final int? isAccepted; - final DateTime? createdAt; - final DateTime? updatedAt; - final dynamic deletedAt; - final dynamic community; - final SenderDetail? senderDetail; + final int? id; + final int? senderIamXid; + final int? communityXid; + final int? isAccepted; + final Community? community; + final SenderDetail? senderDetail; - factory Datum.fromJson(Map json){ - return Datum( - id: json["id"], - senderIamXid: json["sender_iam_xid"], - communityXid: json["community_xid"], - receiverIamXid: json["receiver_iam_xid"], - isAccepted: json["is_accepted"], - createdAt: DateTime.tryParse(json["created_at"] ?? ""), - updatedAt: DateTime.tryParse(json["updated_at"] ?? ""), - deletedAt: json["deleted_at"], - community: json["community"], - senderDetail: json["sender_detail"] == null ? null : SenderDetail.fromJson(json["sender_detail"]), - ); - } + factory Datum.fromJson(Map json) { + return Datum( + id: json["id"], + senderIamXid: json["sender_iam_xid"], + communityXid: json["community_xid"], + isAccepted: json["is_accepted"], + community: json["community"] == null + ? null + : Community.fromJson(json["community"]), + senderDetail: json["sender_detail"] == null + ? null + : SenderDetail.fromJson(json["sender_detail"]), + ); + } +} +class Community { + Community({ + required this.id, + required this.fourMemberImages, + required this.totalGroup, + required this.totalCommunityMember, + required this.communityProfilePhoto, + required this.communityBannerImage, + required this.communityName, + required this.totalAnnouncements, + required this.isCommunityPinned, + }); + + final int? id; + final List fourMemberImages; + final int? totalGroup; + final int? totalCommunityMember; + final String? communityProfilePhoto; + final String? communityBannerImage; + final String? communityName; + final int? totalAnnouncements; + final bool? isCommunityPinned; + + factory Community.fromJson(Map json) { + return Community( + id: json["id"], + fourMemberImages: json["four_member_images"] == null + ? [] + : List.from(json["four_member_images"]! + .map((x) => FourMemberImage.fromJson(x))), + totalGroup: json["total_group"], + totalCommunityMember: json["total_community_member"], + communityProfilePhoto: json["community_profile_photo"], + communityBannerImage: json["community_banner_image"], + communityName: json["community_name"], + totalAnnouncements: json["total_announcements"], + isCommunityPinned: json["is_community_pinned"], + ); + } +} + +class FourMemberImage { + FourMemberImage({ + required this.id, + required this.iamPrincipalXid, + required this.manageCommunityXid, + required this.iamPrincipal, + }); + + final int? id; + final int? iamPrincipalXid; + final int? manageCommunityXid; + final SenderDetail? iamPrincipal; + + factory FourMemberImage.fromJson(Map json) { + return FourMemberImage( + id: json["id"], + iamPrincipalXid: json["iam_principal_xid"], + manageCommunityXid: json["manage_community_xid"], + iamPrincipal: json["iam_principal"] == null + ? null + : SenderDetail.fromJson(json["iam_principal"]), + ); + } } class SenderDetail { - SenderDetail({ - required this.id, - required this.userName, - required this.fullName, - required this.profilePhoto, - required this.isUserPinned, - }); + SenderDetail({ + required this.id, + required this.principalTypeXid, + required this.userName, + required this.fullName, + required this.profilePhoto, + required this.isUserPinned, + }); - final int? id; - final String? userName; - final String? fullName; - final String? profilePhoto; - final bool? isUserPinned; - - factory SenderDetail.fromJson(Map json){ - return SenderDetail( - id: json["id"], - userName: json["user_name"], - fullName: json["full_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 SenderDetail.fromJson(Map json) { + return SenderDetail( + 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"], + ); + } } diff --git a/lib/sidemenu/Model/MyCommunityModel.dart b/lib/sidemenu/Model/MyCommunityModel.dart index 46f7d6b..a24279c 100644 --- a/lib/sidemenu/Model/MyCommunityModel.dart +++ b/lib/sidemenu/Model/MyCommunityModel.dart @@ -1,152 +1,168 @@ 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 data; - - factory MyCommunityModel.fromJson(Map json){ - return MyCommunityModel( - status: json["status"], - statusCode: json["status_code"], - message: json["message"], - data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => Datum.fromJson(x))), - ); - } + final String? status; + final int? statusCode; + final String? message; + final List data; + factory MyCommunityModel.fromJson(Map json) { + return MyCommunityModel( + status: json["status"], + statusCode: json["status_code"], + message: json["message"], + data: json["data"] == null + ? [] + : List.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.isMute, + required this.joinedAndRequestedCommunity, + }); - final int? totalCommunityMember; - final List fourMemberImages; - final int? iamPrincipalXid; - final int? manageCommunityXid; - final DateTime? joinedAt; - final UserTypeXid? userTypeXid; - final JoinedAndRequestedCommunity? joinedAndRequestedCommunity; - - factory Datum.fromJson(Map json){ - return Datum( - totalCommunityMember: json["total_community_member"], - fourMemberImages: json["four_member_images"] == null ? [] : List.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 fourMemberImages; + final int? iamPrincipalXid; + final int? manageCommunityXid; + final DateTime? joinedAt; + final UserTypeXid? userTypeXid; + final int? isMute; + final JoinedAndRequestedCommunity? joinedAndRequestedCommunity; + factory Datum.fromJson(Map json) { + return Datum( + totalCommunityMember: json["total_community_member"], + fourMemberImages: json["four_member_images"] == null + ? [] + : List.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"]), + isMute: json["is_mute"], + 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 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 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 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 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 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 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 json){ - return UserTypeXid( - id: json["id"], - name: json["name"], - ); - } + final int? id; + final String? name; + factory UserTypeXid.fromJson(Map json) { + return UserTypeXid( + id: json["id"], + name: json["name"], + ); + } }