diff --git a/assets/images/png/sidemenu/price-tag 1.png b/assets/images/png/sidemenu/price-tag 1.png new file mode 100644 index 0000000..3f094bc Binary files /dev/null and b/assets/images/png/sidemenu/price-tag 1.png differ diff --git a/assets/images/png/sidemenu/rightarrow.png b/assets/images/png/sidemenu/rightarrow.png new file mode 100644 index 0000000..1c703a3 Binary files /dev/null and b/assets/images/png/sidemenu/rightarrow.png differ diff --git a/lib/Common/api_urls.dart b/lib/Common/api_urls.dart index 2efe081..c07fb29 100644 --- a/lib/Common/api_urls.dart +++ b/lib/Common/api_urls.dart @@ -120,6 +120,10 @@ class ApiUrls { static const postnewtags = "${baseUrl}store-tags"; static const postupload = "${baseUrl}store-post"; + static const getuserpinlist = "${baseUrl}fetch-pinned-detail"; + + static const postusertag = "${baseUrl}pin-unpin"; + diff --git a/lib/Main_Screens/Community_HomePage/Community.dart b/lib/Main_Screens/Community_HomePage/Community.dart index 815381d..139d2f0 100644 --- a/lib/Main_Screens/Community_HomePage/Community.dart +++ b/lib/Main_Screens/Community_HomePage/Community.dart @@ -90,7 +90,8 @@ class _CommunityScreenState extends State { sizedBoxWidth(16.w), ], ), - body: Stack(clipBehavior: Clip.none, children: [ + body: + Stack(clipBehavior: Clip.none, children: [ Container( decoration: const BoxDecoration( image: DecorationImage( diff --git a/lib/Main_Screens/ProfileTab/My Network/MyNetwork.dart b/lib/Main_Screens/ProfileTab/My Network/MyNetwork.dart index b6041ab..95f96e0 100644 --- a/lib/Main_Screens/ProfileTab/My Network/MyNetwork.dart +++ b/lib/Main_Screens/ProfileTab/My Network/MyNetwork.dart @@ -495,7 +495,6 @@ class _FollowingTabState extends State { @override void initState() { - var updata = ""; Profilegetmethod().getFollowing(updata, streamController: searchcontroller); diff --git a/lib/resources/routes/route_name.dart b/lib/resources/routes/route_name.dart index ebb1e53..868c0c6 100644 --- a/lib/resources/routes/route_name.dart +++ b/lib/resources/routes/route_name.dart @@ -135,5 +135,14 @@ class RouteName { static const String addcertificate = '/addusercertificate'; + static const String viewalltags = '/viewalltags'; + + static const String viewallcommunitiespinned = '/viewallcommunitiespinned'; + + static const String viewalluserspinned = '/viewallusersspinned'; + + + + } diff --git a/lib/resources/routes/routes.dart b/lib/resources/routes/routes.dart index 6068313..38600c7 100644 --- a/lib/resources/routes/routes.dart +++ b/lib/resources/routes/routes.dart @@ -86,6 +86,7 @@ import 'package:regroup/sidemenu/Community/MyCommunity/Community_Info-Page/view/ import 'package:regroup/sidemenu/Community/MyCommunity/View/CommunityDetails.dart'; import 'package:regroup/sidemenu/Community/MyCommunity/View/MyCommunity.dart'; import 'package:regroup/sidemenu/SavedPosts/SavedPosts.dart'; +import 'package:regroup/sidemenu/communities.dart'; import 'package:regroup/sidemenu/sidemenu.dart'; import 'package:regroup/Login/View/verifygoogleapple.dart'; @@ -109,6 +110,8 @@ import 'package:regroup/onboarding/forgotPass/View/ForgotPass.dart'; import 'package:regroup/onboarding/onboarding1.dart'; import 'package:regroup/onboarding/splashscreen.dart'; import 'package:regroup/resources/routes/route_name.dart'; +import 'package:regroup/sidemenu/tags.dart'; +import 'package:regroup/sidemenu/users.dart'; class AppRoutes { static appRoutes() => [ @@ -519,5 +522,17 @@ class AppRoutes { name: RouteName.addcertificate, page: () => const AddCertificate(), ), + GetPage( + name: RouteName.viewalltags, + page: () => const Viewtags(), + ), + GetPage( + name: RouteName.viewallcommunitiespinned, + page: () => const Communitiespinned(), + ), + GetPage( + name: RouteName.viewalluserspinned, + page: () => const Viewtusertags(), + ), ]; } diff --git a/lib/sidemenu/Model/userpinnedlist.dart b/lib/sidemenu/Model/userpinnedlist.dart new file mode 100644 index 0000000..6d726a3 --- /dev/null +++ b/lib/sidemenu/Model/userpinnedlist.dart @@ -0,0 +1,219 @@ +class UserpinnedModelList { + String? status; + int? statusCode; + String? message; + Data? data; + + UserpinnedModelList({this.status, this.statusCode, this.message, this.data}); + + UserpinnedModelList.fromJson(Map json) { + status = json['status']; + statusCode = json['status_code']; + message = json['message']; + data = json['data'] != null ? new Data.fromJson(json['data']) : null; + } + + Map toJson() { + final Map data = new Map(); + data['status'] = this.status; + data['status_code'] = this.statusCode; + data['message'] = this.message; + if (this.data != null) { + data['data'] = this.data!.toJson(); + } + return data; + } +} + +class Data { + List? pinnedTag; + List? pinnedCommunity; + List? pinnedUser; + + Data({this.pinnedTag, this.pinnedCommunity, this.pinnedUser}); + + Data.fromJson(Map json) { + if (json['pinned_tag'] != null) { + pinnedTag = []; + json['pinned_tag'].forEach((v) { + pinnedTag!.add(new PinnedTag.fromJson(v)); + }); + } + if (json['pinned_community'] != null) { + pinnedCommunity = []; + json['pinned_community'].forEach((v) { + pinnedCommunity!.add(new PinnedCommunity.fromJson(v)); + }); + } + if (json['pinned_user'] != null) { + pinnedUser = []; + json['pinned_user'].forEach((v) { + pinnedUser!.add(new PinnedUser.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.pinnedTag != null) { + data['pinned_tag'] = this.pinnedTag!.map((v) => v.toJson()).toList(); + } + if (this.pinnedCommunity != null) { + data['pinned_community'] = + this.pinnedCommunity!.map((v) => v.toJson()).toList(); + } + if (this.pinnedUser != null) { + data['pinned_user'] = this.pinnedUser!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class PinnedTag { + int? id; + int? manageTagsXid; + Tag? tag; + + PinnedTag({this.id, this.manageTagsXid, this.tag}); + + PinnedTag.fromJson(Map json) { + id = json['id']; + manageTagsXid = json['manage_tags_xid']; + tag = json['tag'] != null ? new Tag.fromJson(json['tag']) : null; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['manage_tags_xid'] = this.manageTagsXid; + if (this.tag != null) { + data['tag'] = this.tag!.toJson(); + } + return data; + } +} + +class Tag { + int? id; + String? name; + + Tag({this.id, this.name}); + + Tag.fromJson(Map json) { + id = json['id']; + name = json['name']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + return data; + } +} + +class PinnedCommunity { + int? id; + int? manageCommunitiesXid; + Community? community; + + PinnedCommunity({this.id, this.manageCommunitiesXid, this.community}); + + PinnedCommunity.fromJson(Map json) { + id = json['id']; + manageCommunitiesXid = json['manage_communities_xid']; + community = json['community'] != null + ? new Community.fromJson(json['community']) + : null; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['manage_communities_xid'] = this.manageCommunitiesXid; + if (this.community != null) { + data['community'] = this.community!.toJson(); + } + return data; + } +} + +class Community { + int? id; + String? communityProfilePhoto; + String? communityBannerImage; + String? communityName; + + Community( + {this.id, + this.communityProfilePhoto, + this.communityBannerImage, + this.communityName}); + + Community.fromJson(Map json) { + id = json['id']; + communityProfilePhoto = json['community_profile_photo']; + communityBannerImage = json['community_banner_image']; + communityName = json['community_name']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['community_profile_photo'] = this.communityProfilePhoto; + data['community_banner_image'] = this.communityBannerImage; + data['community_name'] = this.communityName; + return data; + } +} + +class PinnedUser { + int? id; + int? pinIamPrincipalXid; + PinUser? pinUser; + + PinnedUser({this.id, this.pinIamPrincipalXid, this.pinUser}); + + PinnedUser.fromJson(Map json) { + id = json['id']; + pinIamPrincipalXid = json['pin_iam_principal_xid']; + pinUser = json['pin_user'] != null + ? new PinUser.fromJson(json['pin_user']) + : null; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['pin_iam_principal_xid'] = this.pinIamPrincipalXid; + if (this.pinUser != null) { + data['pin_user'] = this.pinUser!.toJson(); + } + return data; + } +} + +class PinUser { + int? id; + String? userName; + String? fullName; + String? profilePhoto; + + PinUser({this.id, this.userName, this.fullName, this.profilePhoto}); + + PinUser.fromJson(Map json) { + id = json['id']; + userName = json['user_name']; + fullName = json['full_name']; + profilePhoto = json['profile_photo']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['user_name'] = this.userName; + data['full_name'] = this.fullName; + data['profile_photo'] = this.profilePhoto; + return data; + } +} diff --git a/lib/sidemenu/communities.dart b/lib/sidemenu/communities.dart new file mode 100644 index 0000000..8ab2e8b --- /dev/null +++ b/lib/sidemenu/communities.dart @@ -0,0 +1,227 @@ +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/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/sidemenu/view_model/getmethod.dart'; +import 'package:regroup/sidemenu/view_model/postmethod.dart'; + +class Communitiespinned extends StatefulWidget { + const Communitiespinned({super.key}); + + @override + State createState() => _Communitiespinned(); +} + +class _Communitiespinned extends State { + late Future myfuture; + + @override + void initState() { + // TODO: implement initState + myfuture = Sidegetmethod().getUserpinnedList(); + + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: const Color(0xFF222935), + appBar: const CommonAppbar( + titleTxt: "Pinned interest", + ), + 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 userpinnedobj!.data!.pinnedCommunity!.isEmpty + ? _buildNoDataBody(context) + : _buildBody(context); + }, + ), + ); + } + + Widget _buildNoDataBody(context) { + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "No Data Found", + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ) + ], + ), + ); + } + + pinunpinCommunities(int communityid) async { + utils.loader(); + Map updata = { + "manage_communities_xid": communityid, + }; + final data = await SidebarTags().postUserpin(updata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + return utils.showToast(data.message); + } else { + Get.back(); + return utils.showToast(data.message); + } + } + + Widget _buildBody(context) { + return Stack( + children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + userpinnedobj!.data!.pinnedCommunity!.isEmpty + ? Center(child: text16400white("Pinned Communities")) + : ListView.builder( + shrinkWrap: true, + physics: const ScrollPhysics(), + itemCount: userpinnedobj!.data!.pinnedCommunity!.length, + itemBuilder: (context, index) { + final commnityid = userpinnedobj! + .data!.pinnedCommunity![index].manageCommunitiesXid!; + + return Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: commonGlassUI( + borderwidth: 0.9, + width: double.infinity, + height: 101.h, + borderRadius: BorderRadius.circular(10.r), + customWidget: Padding( + padding: EdgeInsets.symmetric( + horizontal: 16.w, vertical: 16.h), + child: Row( + // crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + height: 65.h, + width: 65.h, + decoration: BoxDecoration( + shape: BoxShape.circle, + // color: Colors.amber, + ), + child: + // Center( + // child: Image.asset(imagepath, fit: BoxFit.cover)), + userpinnedobj! + .data! + .pinnedCommunity![ + index] + .community! + .communityProfilePhoto == + null || + userpinnedobj! + .data! + .pinnedCommunity![index] + .community! + .communityProfilePhoto! + .isEmpty + ? CircleAvatar( + backgroundImage: AssetImage( + 'assets/images/png/sidemenu/rowing 1 (traced).png', + ), + ) + : CircleAvatar( + backgroundImage: NetworkImage( + userpinnedobj! + .data! + .pinnedCommunity![ + index] + .community! + .communityProfilePhoto!), + )), + sizedBoxWidth(13.w), + userpinnedobj!.data!.pinnedCommunity![index] + .community!.communityName == + null || + userpinnedobj! + .data! + .pinnedCommunity![index] + .community! + .communityName! + .isEmpty + ? text18w700_FCFCFC('Regroup') + : SizedBox( + width: 200.w, + child: text18w700_FCFCFC( + userpinnedobj! + .data! + .pinnedCommunity![index] + .community! + .communityName!), + ), + // ), + Spacer(), + InkWell( + onTap: () async { + setState(() { + pinunpinCommunities(commnityid); + userpinnedobj!.data!.pinnedCommunity! + .removeWhere((item) => + item.manageCommunitiesXid == + commnityid); + }); + }, + child: Image.asset( + "assets/images/png/sidemenu/f7_pin-fill.png", + width: 19, + height: 19, + ), + ), + ], + ), + )), + ); + }, + ), + ], + ) + ], + ); + } +} diff --git a/lib/sidemenu/sidemenu.dart b/lib/sidemenu/sidemenu.dart index 25bb7aa..9a83ac2 100644 --- a/lib/sidemenu/sidemenu.dart +++ b/lib/sidemenu/sidemenu.dart @@ -1,10 +1,15 @@ 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/base_manager.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/view_model/getmethod.dart'; +import 'package:regroup/sidemenu/view_model/postmethod.dart'; class SideMenu extends StatefulWidget { const SideMenu({super.key}); @@ -14,9 +19,13 @@ class SideMenu extends StatefulWidget { } class _SideMenuState extends State { + late Future myfuture; + @override void initState() { // TODO: implement initState + myfuture = Sidegetmethod().getUserpinnedList(); + super.initState(); } @@ -54,7 +63,17 @@ class _SideMenuState extends State { Color sideBarBackgroundColor = const Color(0xFF222935); Color whitecolor = Colors.white; - var selectedIndices = {}.obs; + // var selectedIndices = {}.obs; + + // void toggleSelectedIndex(int index) { + // if (selectedIndices.contains(index)) { + // selectedIndices.remove(index); + // } else { + // selectedIndices.add(index); + // } + // } + + final RxSet selectedIndices = {}.obs; void toggleSelectedIndex(int index) { if (selectedIndices.contains(index)) { @@ -64,179 +83,542 @@ class _SideMenuState extends State { } } + final RxSet selectedIndicescommunity = {}.obs; + + void toggleSelectedIndexComunity(int index) { + if (selectedIndicescommunity.contains(index)) { + selectedIndicescommunity.remove(index); + } else { + selectedIndicescommunity.add(index); + } + } + + final RxSet selectedIndicesuser = {}.obs; + + void toggleSelectedIndexUser(int index) { + if (selectedIndicesuser.contains(index)) { + selectedIndicesuser.remove(index); + } else { + selectedIndicesuser.add(index); + } + } + + pinunpinTag(int tagid) async { + utils.loader(); + Map updata = { + "manage_tags_xid": tagid, + }; + final data = await SidebarTags().postUserpin(updata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + toggleSelectedIndex(tagid); + return utils.showToast(data.message); + } else { + Get.back(); + return utils.showToast(data.message); + } + } + + pinunpinCommunities(int communityid) async { + utils.loader(); + Map updata = { + "manage_communities_xid": communityid, + }; + final data = await SidebarTags().postUserpin(updata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + toggleSelectedIndexComunity(communityid); + return utils.showToast(data.message); + } else { + Get.back(); + return utils.showToast(data.message); + } + } + + pinunpinUser(int userid) async { + utils.loader(); + Map updata = { + "pin_iam_principal_xid": userid, + }; + final data = await SidebarTags().postUserpin(updata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + toggleSelectedIndexUser(userid); + return utils.showToast(data.message); + } else { + Get.back(); + return utils.showToast(data.message); + } + } + @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: const Color(0xFF222935), - body: Column( - children: [ - sizedBoxHeight(50.h), - Expanded( - child: ListView(children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: text16w400_FCFCFC("My pinned content"), - ), - const Spacer(), - sizedBoxHeight(18.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Container( - height: 1, - margin: EdgeInsets.symmetric(vertical: 10.h), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: const Color.fromRGBO(255, 255, 255, 0.3), - width: 1.w, - ), - ), - ), + backgroundColor: const Color(0xFF222935), + 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), ), - sizedBoxHeight(18.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Row( - children: [ - text16w400_FCFCFC("Tags"), - const Spacer(), - GestureDetector( - onTap: () { - Get.toNamed(RouteName.mycommunity); - }, - child: text14w400_FCFCFC("View all")), - ], - ), + ); + } + } + return userpinnedobj!.data!.isBlank! + ? _buildNoDataBody(context) + : _buildBody(context); + }, + ), + ); + } + + Widget _buildNoDataBody(context) { + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "No Data Found", + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ) + ], + ), + ); + } + + Widget _buildBody(context) { + return Column( + children: [ + sizedBoxHeight(50.h), + Expanded( + child: ListView(physics: ScrollPhysics(), children: [ + GestureDetector( + onTap: () { + Get.toNamed(RouteName.mycommunity); + }, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Row( + children: [ + text16w400_FCFCFC("My communities"), + sizedBoxWidth(4.w), + Image.asset('assets/images/png/sidemenu/rightarrow.png') + ], ), - sizedBoxHeight(20.h), - firstRowTile( - text: "Row bridge", - leadingimage: - "assets/images/png/sidemenu/rowing 1 (traced).png", - index: 4), - firstRowTile( - text: "Advice", - leadingimage: - "assets/images/png/sidemenu/solar_cloud-outline.png", - index: 5), - firstRowTile( - text: "Crush", - leadingimage: "assets/images/png/sidemenu/Vector (4).png", - index: 6), - firstRowTile( - text: "Row bridge", - leadingimage: - "assets/images/png/sidemenu/rowing 1 (traced).png", - index: 7), - sizedBoxHeight(18.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Container( - height: 1, - margin: EdgeInsets.symmetric(vertical: 10.h), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: const Color.fromRGBO(255, 255, 255, 0.3), - width: 1.w, - ), - ), - ), - ), - ), - sizedBoxHeight(18.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Row( - children: [ - text16w400_FCFCFC("Communities"), - const Spacer(), - GestureDetector( - onTap: () { - Get.toNamed(RouteName.mycommunity); - }, - child: text14w400_FCFCFC("View all")), - ], - ), - ), - sizedBoxHeight(20.h), - firstRowTile( - text: "Row bridge", - leadingimage: - "assets/images/png/sidemenu/rowing 1 (traced).png", - index: 4), - firstRowTile( - text: "Advice", - leadingimage: - "assets/images/png/sidemenu/solar_cloud-outline.png", - index: 5), - firstRowTile( - text: "Crush", - leadingimage: "assets/images/png/sidemenu/Vector (4).png", - index: 6), - firstRowTile( - text: "Row bridge", - leadingimage: - "assets/images/png/sidemenu/rowing 1 (traced).png", - index: 7), - sizedBoxHeight(18.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Container( - height: 1, - margin: EdgeInsets.symmetric(vertical: 10.h), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: const Color.fromRGBO(255, 255, 255, 0.3), - width: 1.w, - ), - ), - ), - ), - ), - sizedBoxHeight(18.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Row( - children: [ - text16w400_FCFCFC("Users"), - const Spacer(), - GestureDetector( - onTap: () { - Get.toNamed(RouteName.mycommunity); - }, - child: text14w400_FCFCFC("View all")), - ], - ), - ), - sizedBoxHeight(20.h), - firstRowTile( - text: "Row bridge", - leadingimage: - "assets/images/png/sidemenu/rowing 1 (traced).png", - index: 8), - firstRowTile( - text: "Advice", - leadingimage: - "assets/images/png/sidemenu/solar_cloud-outline.png", - index: 9), - firstRowTile( - text: "Crush", - leadingimage: "assets/images/png/sidemenu/Vector (4).png", - index: 10), - firstRowTile( - text: "Row bridge", - leadingimage: - "assets/images/png/sidemenu/rowing 1 (traced).png", - index: 11), - sizedBoxHeight(18.h), - sizedBoxHeight(80.h), - ]), + ), ), - ], - )); + const Spacer(), + sizedBoxHeight(18.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Container( + height: 1, + margin: EdgeInsets.symmetric(vertical: 10.h), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: const Color.fromRGBO(255, 255, 255, 0.3), + width: 1.w, + ), + ), + ), + ), + ), + sizedBoxHeight(18.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: text16w400_FCFCFC("My pinned content"), + ), + const Spacer(), + sizedBoxHeight(18.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Container( + height: 1, + margin: EdgeInsets.symmetric(vertical: 10.h), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: const Color.fromRGBO(255, 255, 255, 0.3), + width: 1.w, + ), + ), + ), + ), + ), + sizedBoxHeight(18.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Row( + children: [ + text16w400_FCFCFC("interest"), + const Spacer(), + GestureDetector( + onTap: () { + Get.toNamed(RouteName.viewalltags); + }, + child: text14w400_FCFCFC("View all")), + ], + ), + ), + sizedBoxHeight(20.h), + userpinnedobj!.data!.pinnedTag!.isEmpty + ? Center(child: text16400white("Pin tags")) + : SizedBox( + height: 200.h, + child: + // Obx( () { + // return + ListView.builder( + shrinkWrap: true, + itemCount: userpinnedobj!.data!.pinnedTag!.take(5).length, + itemBuilder: (context, index) { + final tagid = userpinnedobj! + .data!.pinnedTag![index].manageTagsXid!; + + return ListTile( + leading: commonContainer( + width: 29.w, + height: 29.h, + borderwidth: 0.9, + boxShape: BoxShape.circle, + customWidget: Center( + child: Image.asset( + 'assets/images/png/sidemenu/rowing 1 (traced).png', + width: 13.w, + height: 13.h, + ), + )), + title: userpinnedobj!.data!.pinnedTag![index].tag == + null || + userpinnedobj!.data!.pinnedTag![index].tag! + .name!.isEmpty + ? text14w400_FCFCFC('') + : text14w400_FCFCFC(userpinnedobj! + .data!.pinnedTag![index].tag!.name!), + trailing: InkWell( + onTap: () async { + setState(() { + pinunpinTag(tagid); + userpinnedobj!.data!.pinnedTag!.removeWhere( + (item) => item.manageTagsXid == tagid); + }); + + // toggleSelectedIndex(tagid); + }, + child: + // Obx( + // () { + // return selectedIndices.contains(tagid) + // ? + // Image.asset( + // "assets/images/png/sidemenu/f7_pin-fill (1).png", + // width: 19, + // height: 19, + // ) + // : + Image.asset( + "assets/images/png/sidemenu/f7_pin-fill.png", + width: 19, + height: 19, + ), + // }, + // ), + ), + // onTap: () {}, + ); + }, + ), + // } + + // ) + ), + sizedBoxHeight(18.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Container( + height: 1, + margin: EdgeInsets.symmetric(vertical: 10.h), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: const Color.fromRGBO(255, 255, 255, 0.3), + width: 1.w, + ), + ), + ), + ), + ), + sizedBoxHeight(18.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Row( + children: [ + text16w400_FCFCFC("Communities"), + const Spacer(), + GestureDetector( + onTap: () { + Get.toNamed(RouteName.viewallcommunitiespinned); + }, + child: text14w400_FCFCFC("View all")), + ], + ), + ), + sizedBoxHeight(20.h), + userpinnedobj!.data!.pinnedCommunity!.isEmpty + ? Center(child: text16400white("Pin communities")) + : SizedBox( + height: 200.h, + child: ListView.builder( + shrinkWrap: true, + itemCount: + userpinnedobj!.data!.pinnedCommunity!.take(5).length, + itemBuilder: (context, index) { + final commnityid = userpinnedobj!.data! + .pinnedCommunity![index].manageCommunitiesXid!; + + return ListTile( + leading: Container( + width: 29.w, + height: 29.h, + decoration: BoxDecoration( + shape: BoxShape.circle, + // color: Colors.amber, + ), + child: + userpinnedobj! + .data! + .pinnedCommunity![index] + .community! + .communityProfilePhoto == + null || + userpinnedobj! + .data! + .pinnedCommunity![index] + .community! + .communityProfilePhoto! + .isEmpty + ? CircleAvatar( + backgroundImage: AssetImage( + 'assets/images/png/sidemenu/rowing 1 (traced).png', + ), + ) + : CircleAvatar( + backgroundImage: NetworkImage( + userpinnedobj! + .data! + .pinnedCommunity![index] + .community! + .communityProfilePhoto!), + ) + + ), + title: userpinnedobj!.data!.pinnedCommunity![index] + .community == + null || + userpinnedobj!.data!.pinnedCommunity![index] + .community!.communityName!.isEmpty + ? text14w400_FCFCFC('') + : text14w400_FCFCFC(userpinnedobj! + .data! + .pinnedCommunity![index] + .community! + .communityName!), + trailing: InkWell( + onTap: () async { + setState(() { + pinunpinCommunities(commnityid); + userpinnedobj!.data!.pinnedCommunity! + .removeWhere((item) => + item.manageCommunitiesXid == + commnityid); + }); + + // toggleSelectedIndex(tagid); + }, + // () { + // pinunpinTag(tagid); + // // toggleSelectedIndex(tagid); + // }, + child: Image.asset( + "assets/images/png/sidemenu/f7_pin-fill.png", + width: 19, + height: 19, + ), + // Obx( + // () { + // return selectedIndicescommunity.contains(tagid) + // ? Image.asset( + // "assets/images/png/sidemenu/f7_pin-fill (1).png", + // width: 19, + // height: 19, + // ) + // : Image.asset( + // "assets/images/png/sidemenu/f7_pin-fill.png", + // width: 19, + // height: 19, + // ); + // }, + // ), + ), + ); + }, + ), + ), + sizedBoxHeight(18.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Container( + height: 1, + margin: EdgeInsets.symmetric(vertical: 10.h), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: const Color.fromRGBO(255, 255, 255, 0.3), + width: 1.w, + ), + ), + ), + ), + ), + sizedBoxHeight(18.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Row( + children: [ + text16w400_FCFCFC("Users"), + const Spacer(), + GestureDetector( + onTap: () { + Get.toNamed(RouteName.viewalluserspinned); + }, + child: text14w400_FCFCFC("View all")), + ], + ), + ), + sizedBoxHeight(20.h), + userpinnedobj!.data!.pinnedUser!.isEmpty + ? Center(child: text16400white("Pin users")) + : SizedBox( + height: 200.h, + child: ListView.builder( + shrinkWrap: true, + itemCount: + userpinnedobj!.data!.pinnedUser!.take(5).length, + itemBuilder: (context, index) { + final userid = userpinnedobj! + .data!.pinnedUser![index].pinIamPrincipalXid!; + + return ListTile( + leading: commonContainer( + width: 29.w, + height: 29.h, + borderwidth: 0.9, + boxShape: BoxShape.circle, + customWidget: Center( + child: userpinnedobj!.data!.pinnedUser![index] + .pinUser!.profilePhoto == + null || + userpinnedobj! + .data! + .pinnedUser![index] + .pinUser! + .profilePhoto! + .isEmpty + ? Image.asset( + 'assets/images/png/sidemenu/rowing 1 (traced).png', + width: 13.w, + height: 13.h, + ) + : Image.network( + userpinnedobj! + .data! + .pinnedUser![index] + .pinUser! + .profilePhoto!, + width: 13.w, + height: 13.h, + errorBuilder: + (context, error, stackTrace) { + // Error handling when image fails to load + return Image.asset( + 'assets/images/png/sidemenu/rowing 1 (traced).png', + width: 13.w, + height: 13.h, + ); + }, + ))), + title: userpinnedobj!.data!.pinnedUser![index] + .pinUser!.fullName == + null || + userpinnedobj!.data!.pinnedUser![index] + .pinUser!.fullName!.isEmpty + ? text14w400_FCFCFC('') + : text14w400_FCFCFC(userpinnedobj! + .data!.pinnedUser![index].pinUser!.fullName!), + trailing: InkWell( + onTap: () async { + setState(() { + pinunpinUser(userid); + userpinnedobj!.data!.pinnedUser!.removeWhere( + (item) => + item.pinIamPrincipalXid == userid); + }); + + // toggleSelectedIndex(tagid); + }, + child: Image.asset( + "assets/images/png/sidemenu/f7_pin-fill.png", + width: 19, + height: 19, + ), + // Obx( + // () { + // return selectedIndicesuser.contains(userid) + // ? Image.asset( + // "assets/images/png/sidemenu/f7_pin-fill (1).png", + // width: 19, + // height: 19, + // ) + // : Image.asset( + // "assets/images/png/sidemenu/f7_pin-fill.png", + // width: 19, + // height: 19, + // ); + // }, + // ), + ), + ); + }, + ), + ), + sizedBoxHeight(18.h), + sizedBoxHeight(80.h), + ]), + ), + ], + ); } Widget firstRowTile({ diff --git a/lib/sidemenu/tags.dart b/lib/sidemenu/tags.dart new file mode 100644 index 0000000..a6a11fa --- /dev/null +++ b/lib/sidemenu/tags.dart @@ -0,0 +1,178 @@ +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/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/sidemenu/view_model/getmethod.dart'; +import 'package:regroup/sidemenu/view_model/postmethod.dart'; + +class Viewtags extends StatefulWidget { + const Viewtags({super.key}); + + @override + State createState() => _ViewtagsState(); +} + +class _ViewtagsState extends State { + late Future myfuture; + + @override + void initState() { + // TODO: implement initState + myfuture = Sidegetmethod().getUserpinnedList(); + + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: const Color(0xFF222935), + appBar: const CommonAppbar( + titleTxt: "Pinned interest", + ), + 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 userpinnedobj!.data!.pinnedTag!.isEmpty + ? _buildNoDataBody(context) + : _buildBody(context); + }, + ), + ); + } + + Widget _buildNoDataBody(context) { + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "No Data Found", + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ) + ], + ), + ); + } + + pinunpinTag(int tagid) async { + utils.loader(); + Map updata = { + "manage_tags_xid": tagid, + }; + final data = await SidebarTags().postUserpin(updata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + return utils.showToast(data.message); + } else { + Get.back(); + return utils.showToast(data.message); + } + } + + Widget _buildBody(context) { + return Stack( + children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + userpinnedobj!.data!.pinnedTag!.isEmpty + ? Center(child: text16400white("Pin tags")) + : ListView.separated( + separatorBuilder: (context, index) { + return Divider( + thickness: 1, + color: const Color.fromRGBO(255, 255, 255, 0.3), + ); + }, + shrinkWrap: true, + physics: const ScrollPhysics(), + itemCount: userpinnedobj!.data!.pinnedTag!.length, + itemBuilder: (context, index) { + final tagid = + userpinnedobj!.data!.pinnedTag![index].manageTagsXid!; + return ListTile( + leading: commonContainer( + width: 29.w, + height: 29.h, + borderwidth: 0.9, + boxShape: BoxShape.circle, + customWidget: Center( + child: Image.asset( + 'assets/images/png/sidemenu/price-tag 1.png', + width: 13.w, + height: 13.h, + ), + )), + title: userpinnedobj!.data!.pinnedTag![index].tag == + null || + userpinnedobj! + .data!.pinnedTag![index].tag!.name!.isEmpty + ? text14w400_FCFCFC('') + : text14w400_FCFCFC(userpinnedobj! + .data!.pinnedTag![index].tag!.name!), + trailing: InkWell( + onTap: () async { + setState(() { + pinunpinTag(tagid); + userpinnedobj!.data!.pinnedTag!.removeWhere( + (item) => item.manageTagsXid == tagid); + }); + }, + child: Image.asset( + "assets/images/png/sidemenu/f7_pin-fill.png", + width: 19, + height: 19, + ), + ), + ); + }, + ), + Divider( + thickness: 1, + color: const Color.fromRGBO(255, 255, 255, 0.3), + ), + ], + ) + ], + ); + } +} diff --git a/lib/sidemenu/users.dart b/lib/sidemenu/users.dart new file mode 100644 index 0000000..c091dc9 --- /dev/null +++ b/lib/sidemenu/users.dart @@ -0,0 +1,203 @@ +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/base_manager.dart'; +import 'package:regroup/Utils/Common/CommonAppbar.dart'; +import 'package:regroup/Utils/dialogs.dart'; +import 'package:regroup/Utils/texts.dart'; +import 'package:regroup/sidemenu/view_model/getmethod.dart'; +import 'package:regroup/sidemenu/view_model/postmethod.dart'; + +class Viewtusertags extends StatefulWidget { + const Viewtusertags({super.key}); + + @override + State createState() => _ViewtusertagsState(); +} + +class _ViewtusertagsState extends State { + late Future myfuture; + + @override + void initState() { + // TODO: implement initState + myfuture = Sidegetmethod().getUserpinnedList(); + + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: const Color(0xFF222935), + appBar: const CommonAppbar( + titleTxt: "Pinned users", + ), + 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 userpinnedobj!.data!.pinnedUser!.isEmpty + ? _buildNoDataBody(context) + : _buildBody(context); + }, + ), + ); + } + + Widget _buildNoDataBody(context) { + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "No Data Found", + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ) + ], + ), + ); + } + + pinunpinUser(int userid) async { + utils.loader(); + Map updata = { + "pin_iam_principal_xid": userid, + }; + final data = await SidebarTags().postUserpin(updata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + return utils.showToast(data.message); + } else { + Get.back(); + return utils.showToast(data.message); + } + } + + Widget _buildBody(context) { + return Stack( + children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + userpinnedobj!.data!.pinnedUser!.isEmpty + ? Center(child: text16400white("Pin tags")) + : ListView.separated( + separatorBuilder: (context, index) { + return Divider( + thickness: 1, + color: const Color.fromRGBO(255, 255, 255, 0.3), + ); + }, + shrinkWrap: true, + physics: const ScrollPhysics(), + itemCount: userpinnedobj!.data!.pinnedUser!.length, + itemBuilder: (context, index) { + final tagid = + userpinnedobj!.data!.pinnedUser![index].pinIamPrincipalXid!; + return ListTile( + leading: + Container( + height: 65.h, + width: 65.h, + decoration: BoxDecoration( + shape: BoxShape.circle, + // color: Colors.amber, + ), + child: + // Center( + // child: Image.asset(imagepath, fit: BoxFit.cover)), + userpinnedobj! + .data! + .pinnedUser![ + index] + .pinUser! + .profilePhoto == + null || + userpinnedobj! + .data! + .pinnedUser![index] + .pinUser! + .profilePhoto! + .isEmpty + ? CircleAvatar( + backgroundImage: AssetImage( + 'assets/images/png/sidemenu/rowing 1 (traced).png', + ), + ) + : CircleAvatar( + backgroundImage: NetworkImage( + userpinnedobj! + .data! + .pinnedUser![ + index] + .pinUser! + .profilePhoto!), + )), + title: userpinnedobj!.data!.pinnedUser![index].pinUser == + null || + userpinnedobj! + .data!.pinnedUser![index].pinUser!.fullName!.isEmpty + ? text14w400_FCFCFC('') + : text14w400_FCFCFC(userpinnedobj! + .data!.pinnedUser![index].pinUser!.fullName!), + trailing: InkWell( + onTap: () async { + setState(() { + pinunpinUser(tagid); + userpinnedobj!.data!.pinnedUser!.removeWhere( + (item) => item.pinIamPrincipalXid == tagid); + }); + }, + child: Image.asset( + "assets/images/png/sidemenu/f7_pin-fill.png", + width: 19, + height: 19, + ), + ), + ); + }, + ), + Divider( + thickness: 1, + color: const Color.fromRGBO(255, 255, 255, 0.3), + ), + ], + ) + ], + ); + } +} diff --git a/lib/sidemenu/view_model/getmethod.dart b/lib/sidemenu/view_model/getmethod.dart index dc0f42b..ae5dbfd 100644 --- a/lib/sidemenu/view_model/getmethod.dart +++ b/lib/sidemenu/view_model/getmethod.dart @@ -4,9 +4,10 @@ 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/sidemenu/Model/joineGroupsModel.dart'; +import 'package:regroup/sidemenu/Model/userpinnedlist.dart'; GetmyJoinedGroupsModel? joinedgroupsobj; - +UserpinnedModelList? userpinnedobj; class Sidegetmethod { @@ -22,5 +23,17 @@ class Sidegetmethod { return response; } + Future> getUserpinnedList() async { + final response = await NetworkApiServices().getApi( + ApiUrls.getuserpinlist, + // optionalpar: false + ); + if (response.status == ResponseStatus.SUCCESS) { + userpinnedobj = UserpinnedModelList.fromJson(response.data); + log(userpinnedobj!.data.toString()); + } + return response; + } + } \ No newline at end of file diff --git a/lib/sidemenu/view_model/postmethod.dart b/lib/sidemenu/view_model/postmethod.dart index e69de29..7de1519 100644 --- a/lib/sidemenu/view_model/postmethod.dart +++ b/lib/sidemenu/view_model/postmethod.dart @@ -0,0 +1,18 @@ +import 'package:regroup/Common/api_urls.dart'; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Common/controller/data/network/network_api.dart'; + +class SidebarTags { + SidebarTags(); + + + Future> postUserpin(updata) async { + final response = await NetworkApiServices().postApi( + updata, + ApiUrls.postusertag, + ); + return response; + } + + +} \ No newline at end of file