pin for sidebar and unpin done

This commit is contained in:
Shubhamshirva
2024-08-02 17:30:58 +05:30
parent b2b2b1d6eb
commit 2a7c866639
14 changed files with 1438 additions and 170 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

View File

@@ -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";

View File

@@ -90,7 +90,8 @@ class _CommunityScreenState extends State<CommunityScreen> {
sizedBoxWidth(16.w),
],
),
body: Stack(clipBehavior: Clip.none, children: [
body:
Stack(clipBehavior: Clip.none, children: [
Container(
decoration: const BoxDecoration(
image: DecorationImage(

View File

@@ -495,7 +495,6 @@ class _FollowingTabState extends State<FollowingTab> {
@override
void initState() {
var updata = "";
Profilegetmethod().getFollowing(updata, streamController: searchcontroller);

View File

@@ -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';
}

View File

@@ -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(),
),
];
}

View File

@@ -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<String, dynamic> json) {
status = json['status'];
statusCode = json['status_code'];
message = json['message'];
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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>? pinnedTag;
List<PinnedCommunity>? pinnedCommunity;
List<PinnedUser>? pinnedUser;
Data({this.pinnedTag, this.pinnedCommunity, this.pinnedUser});
Data.fromJson(Map<String, dynamic> json) {
if (json['pinned_tag'] != null) {
pinnedTag = <PinnedTag>[];
json['pinned_tag'].forEach((v) {
pinnedTag!.add(new PinnedTag.fromJson(v));
});
}
if (json['pinned_community'] != null) {
pinnedCommunity = <PinnedCommunity>[];
json['pinned_community'].forEach((v) {
pinnedCommunity!.add(new PinnedCommunity.fromJson(v));
});
}
if (json['pinned_user'] != null) {
pinnedUser = <PinnedUser>[];
json['pinned_user'].forEach((v) {
pinnedUser!.add(new PinnedUser.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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<String, dynamic> json) {
id = json['id'];
manageTagsXid = json['manage_tags_xid'];
tag = json['tag'] != null ? new Tag.fromJson(json['tag']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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<String, dynamic> json) {
id = json['id'];
manageCommunitiesXid = json['manage_communities_xid'];
community = json['community'] != null
? new Community.fromJson(json['community'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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<String, dynamic> json) {
id = json['id'];
communityProfilePhoto = json['community_profile_photo'];
communityBannerImage = json['community_banner_image'];
communityName = json['community_name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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<String, dynamic> json) {
id = json['id'];
pinIamPrincipalXid = json['pin_iam_principal_xid'];
pinUser = json['pin_user'] != null
? new PinUser.fromJson(json['pin_user'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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<String, dynamic> json) {
id = json['id'];
userName = json['user_name'];
fullName = json['full_name'];
profilePhoto = json['profile_photo'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['user_name'] = this.userName;
data['full_name'] = this.fullName;
data['profile_photo'] = this.profilePhoto;
return data;
}
}

View File

@@ -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<Communitiespinned> createState() => _Communitiespinned();
}
class _Communitiespinned extends State<Communitiespinned> {
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<String, dynamic> 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,
),
),
],
),
)),
);
},
),
],
)
],
);
}
}

View File

@@ -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<SideMenu> {
late Future myfuture;
@override
void initState() {
// TODO: implement initState
myfuture = Sidegetmethod().getUserpinnedList();
super.initState();
}
@@ -54,7 +63,17 @@ class _SideMenuState extends State<SideMenu> {
Color sideBarBackgroundColor = const Color(0xFF222935);
Color whitecolor = Colors.white;
var selectedIndices = <int>{}.obs;
// var selectedIndices = <int>{}.obs;
// void toggleSelectedIndex(int index) {
// if (selectedIndices.contains(index)) {
// selectedIndices.remove(index);
// } else {
// selectedIndices.add(index);
// }
// }
final RxSet<int> selectedIndices = <int>{}.obs;
void toggleSelectedIndex(int index) {
if (selectedIndices.contains(index)) {
@@ -64,179 +83,542 @@ class _SideMenuState extends State<SideMenu> {
}
}
final RxSet<int> selectedIndicescommunity = <int>{}.obs;
void toggleSelectedIndexComunity(int index) {
if (selectedIndicescommunity.contains(index)) {
selectedIndicescommunity.remove(index);
} else {
selectedIndicescommunity.add(index);
}
}
final RxSet<int> selectedIndicesuser = <int>{}.obs;
void toggleSelectedIndexUser(int index) {
if (selectedIndicesuser.contains(index)) {
selectedIndicesuser.remove(index);
} else {
selectedIndicesuser.add(index);
}
}
pinunpinTag(int tagid) async {
utils.loader();
Map<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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({

178
lib/sidemenu/tags.dart Normal file
View File

@@ -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<Viewtags> createState() => _ViewtagsState();
}
class _ViewtagsState extends State<Viewtags> {
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<String, dynamic> 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),
),
],
)
],
);
}
}

203
lib/sidemenu/users.dart Normal file
View File

@@ -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<Viewtusertags> createState() => _ViewtusertagsState();
}
class _ViewtusertagsState extends State<Viewtusertags> {
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<String, dynamic> 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),
),
],
)
],
);
}
}

View File

@@ -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<ResponseData<dynamic>> 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;
}
}

View File

@@ -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<ResponseData<dynamic>> postUserpin(updata) async {
final response = await NetworkApiServices().postApi(
updata,
ApiUrls.postusertag,
);
return response;
}
}