Guest View api integration done.

This commit is contained in:
cj201199
2024-07-22 20:29:15 +05:30
parent 07f9168053
commit abf668e14c
12 changed files with 2002 additions and 1436 deletions

View File

@@ -252,7 +252,11 @@ class _ProfileTabState extends State<ProfileTab> {
GestureDetector(
onTap: () {
Get.toNamed(
RouteName.mynetwork);
RouteName.mynetwork,
// arguments: {
// "From": 'MainIndProfile',
// }
);
},
child: Container(
height: 34.h,
@@ -516,6 +520,8 @@ class _ProfileTabState extends State<ProfileTab> {
return Container();
},
)
//BusProfile
: FutureBuilder(
future: businessfuture,
builder: (ctx, snapshot) {
@@ -607,7 +613,11 @@ class _ProfileTabState extends State<ProfileTab> {
GestureDetector(
onTap: () {
Get.toNamed(
RouteName.followers);
RouteName.followers,
arguments: {
"From":
'MainBusProfile',
});
},
child: Column(
children: [
@@ -647,7 +657,11 @@ class _ProfileTabState extends State<ProfileTab> {
GestureDetector(
onTap: () {
Get.toNamed(
RouteName.following);
RouteName.following,
arguments: {
"From":
'MainBusProfile',
});
},
child: Column(
children: [

View File

@@ -61,14 +61,21 @@ class Follower {
String? userName;
String? fullName;
String? profilePhoto;
int? principleTypeXid;
Follower({this.id, this.userName, this.fullName, this.profilePhoto});
Follower(
{this.id,
this.userName,
this.fullName,
this.profilePhoto,
this.principleTypeXid});
Follower.fromJson(Map<String, dynamic> json) {
id = json['id'];
userName = json['user_name'];
fullName = json['full_name'];
profilePhoto = json['profile_photo'];
principleTypeXid = json['principal_type_xid'];
}
Map<String, dynamic> toJson() {
@@ -77,6 +84,8 @@ class Follower {
data['user_name'] = this.userName;
data['full_name'] = this.fullName;
data['profile_photo'] = this.profilePhoto;
data['principal_type_xid'] = this.principleTypeXid;
return data;
}
}

View File

@@ -61,14 +61,17 @@ class Following {
String? userName;
String? fullName;
String? profilePhoto;
int? principleTypeXid;
Following({this.id, this.userName, this.fullName, this.profilePhoto});
Following({this.id, this.userName, this.fullName, this.profilePhoto, this.principleTypeXid});
Following.fromJson(Map<String, dynamic> json) {
id = json['id'];
userName = json['user_name'];
fullName = json['full_name'];
profilePhoto = json['profile_photo'];
principleTypeXid = json['principal_type_xid'];
}
Map<String, dynamic> toJson() {
@@ -77,6 +80,7 @@ class Following {
data['user_name'] = this.userName;
data['full_name'] = this.fullName;
data['profile_photo'] = this.profilePhoto;
data['principal_type_xid'] = this.principleTypeXid;
return data;
}
}

View File

@@ -31,6 +31,7 @@ class Data {
String? userName;
String? fullName;
String? gender;
String? profilePhoto;
String? dateOfBirth;
List<Interest>? interest;
String? about;
@@ -42,13 +43,17 @@ class Data {
Follows? follows;
List<Timelines>? timelines;
int? accountVisibility;
List<MyJoinedGroups>? myJoinedGroups;
List<MyJoinedSubgroups>? myJoinedSubgroups;
List<Certifications>? certifications;
int? daysBeforeJoined;
Data(
{this.id,
this.userName,
this.fullName,
this.gender,
this.profilePhoto,
this.dateOfBirth,
this.interest,
this.about,
@@ -60,15 +65,19 @@ class Data {
this.follows,
this.timelines,
this.accountVisibility,
this.myJoinedSubgroups});
this.myJoinedGroups,
this.myJoinedSubgroups,
this.certifications,
this.daysBeforeJoined});
Data.fromJson(Map<String, dynamic> json) {
id = json['id'];
userName = json['user_name'];
fullName = json['full_name'];
gender = json['gender'];
profilePhoto = json['profile_photo'];
dateOfBirth = json['date_of_birth'];
if (json['interest'] != null) {
if (json['interest'] != null) {
interest = <Interest>[];
json['interest'].forEach((v) {
interest!.add(new Interest.fromJson(v));
@@ -89,12 +98,25 @@ class Data {
});
}
accountVisibility = json['account_visibility'];
if (json['my_joined_groups'] != null) {
myJoinedGroups = <MyJoinedGroups>[];
json['my_joined_groups'].forEach((v) {
myJoinedGroups!.add(new MyJoinedGroups.fromJson(v));
});
}
if (json['my_joined_subgroups'] != null) {
myJoinedSubgroups = <MyJoinedSubgroups>[];
json['my_joined_subgroups'].forEach((v) {
myJoinedSubgroups!.add(new MyJoinedSubgroups.fromJson(v));
});
}
if (json['certifications'] != null) {
certifications = <Certifications>[];
json['certifications'].forEach((v) {
certifications!.add(new Certifications.fromJson(v));
});
}
daysBeforeJoined = json['days_before_joined'];
}
Map<String, dynamic> toJson() {
@@ -103,6 +125,7 @@ class Data {
data['user_name'] = this.userName;
data['full_name'] = this.fullName;
data['gender'] = this.gender;
data['profile_photo'] = this.profilePhoto;
data['date_of_birth'] = this.dateOfBirth;
if (this.interest != null) {
data['interest'] = this.interest!.map((v) => v.toJson()).toList();
@@ -120,10 +143,19 @@ class Data {
data['timelines'] = this.timelines!.map((v) => v.toJson()).toList();
}
data['account_visibility'] = this.accountVisibility;
if (this.myJoinedGroups != null) {
data['my_joined_groups'] =
this.myJoinedGroups!.map((v) => v.toJson()).toList();
}
if (this.myJoinedSubgroups != null) {
data['my_joined_subgroups'] =
this.myJoinedSubgroups!.map((v) => v.toJson()).toList();
}
if (this.certifications != null) {
data['certifications'] =
this.certifications!.map((v) => v.toJson()).toList();
}
data['days_before_joined'] = this.daysBeforeJoined;
return data;
}
}
@@ -236,6 +268,58 @@ class Abilities {
}
}
class MyJoinedGroups {
int? id;
int? iamPrincipalXid;
int? manageGroupXid;
GroupData? groupData;
MyJoinedGroups(
{this.id, this.iamPrincipalXid, this.manageGroupXid, this.groupData});
MyJoinedGroups.fromJson(Map<String, dynamic> json) {
id = json['id'];
iamPrincipalXid = json['iam_principal_xid'];
manageGroupXid = json['manage_group_xid'];
groupData = json['group_data'] != null
? new GroupData.fromJson(json['group_data'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['iam_principal_xid'] = this.iamPrincipalXid;
data['manage_group_xid'] = this.manageGroupXid;
if (this.groupData != null) {
data['group_data'] = this.groupData!.toJson();
}
return data;
}
}
class GroupData {
int? id;
String? title;
String? groupImage;
GroupData({this.id, this.title, this.groupImage});
GroupData.fromJson(Map<String, dynamic> json) {
id = json['id'];
title = json['title'];
groupImage = json['group_image'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['title'] = this.title;
data['group_image'] = this.groupImage;
return data;
}
}
class MyJoinedSubgroups {
int? id;
int? iamPrincipalXid;
@@ -294,3 +378,40 @@ class SubGroupData {
return data;
}
}
class Certifications {
int? id;
String? certificationName;
String? certificationImage;
String? certificationReason;
String? certificationDate;
int? iamPrincipalXid;
Certifications(
{this.id,
this.certificationName,
this.certificationImage,
this.certificationReason,
this.certificationDate,
this.iamPrincipalXid});
Certifications.fromJson(Map<String, dynamic> json) {
id = json['id'];
certificationName = json['certification_name'];
certificationImage = json['certification_image'];
certificationReason = json['certification_reason'];
certificationDate = json['certification_date'];
iamPrincipalXid = json['iam_principal_xid'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['certification_name'] = this.certificationName;
data['certification_image'] = this.certificationImage;
data['certification_reason'] = this.certificationReason;
data['certification_date'] = this.certificationDate;
data['iam_principal_xid'] = this.iamPrincipalXid;
return data;
}
}

View File

@@ -24,7 +24,9 @@ class _profiletabBusGestState extends State<profiletabBusGest> {
@override
void initState() {
// TODO: implement initState
updata = "64";
updata = Get.arguments?['FolloweridIndex'] ??
Get.arguments?['FollowingidIndex'] ??
"64";
guestBusfuture = GuestProfileApi().getGuestProfileBus(updata);
@@ -76,14 +78,31 @@ class _profiletabBusGestState extends State<profiletabBusGest> {
children: [
Stack(
children: [
Container(
height: 484.h,
width: double.infinity,
child: Image.asset(
"assets/images/png/Rectangle 49 (1).png",
fit: BoxFit.cover,
),
),
guestGetProfileBus!.data!.bannerImage != null
? Container(
width: double.infinity,
height: 484.h,
decoration: ShapeDecoration(
image: DecorationImage(
image: Image(
image: NetworkImage(
guestGetProfileBus!
.data!.bannerImage ??
''),
).image,
fit: BoxFit.cover,
),
shape: LinearBorder(),
),
)
: Container(
height: 484.h,
width: double.infinity,
child: Image.asset(
"assets/images/png/Rectangle 49 (1).png",
fit: BoxFit.cover,
),
),
Positioned.fill(
child: Container(
decoration: BoxDecoration(
@@ -129,7 +148,13 @@ class _profiletabBusGestState extends State<profiletabBusGest> {
GestureDetector(
onTap: () {
Get.toNamed(
RouteName.followers);
RouteName.followers,
arguments: {
'From':
"GuestBusFollowers",
'UpdataGuestBusIdfollowers':
updata
});
},
child: Column(
children: [
@@ -168,7 +193,13 @@ class _profiletabBusGestState extends State<profiletabBusGest> {
GestureDetector(
onTap: () {
Get.toNamed(
RouteName.following);
RouteName.following,
arguments: {
'From':
"GuestBusFollowing",
'UpdataGuestBusIdfollowing':
updata,
});
},
child: Column(
children: [

View File

@@ -81,8 +81,6 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
late Future guestIndfuture;
var updata;
// FollowingidIndex
@override
void initState() {
// updata = Get.arguments != null
@@ -103,14 +101,14 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
Widget build(BuildContext context) {
return Scaffold(
// key: _scaffoldKey1,
backgroundColor: Color(0xFF222935),
backgroundColor: const Color(0xFF222935),
extendBody: true,
// accountTypeValue == '1' ||
body: FutureBuilder(
future: guestIndfuture,
builder: (ctx, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
return const Center(
child: CircularProgressIndicator(
color: Colors.blue,
),
@@ -144,17 +142,33 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
children: [
Stack(
children: [
Container(
height: 484.h,
width: double.infinity,
child: Image.asset(
"assets/images/png/profileimg.png",
fit: BoxFit.cover,
),
),
guestGetProfileInd!.data!.profilePhoto!.isNotEmpty
? Container(
width: double.infinity,
height: 484.h,
decoration: ShapeDecoration(
image: DecorationImage(
image: Image(
image: NetworkImage(
guestGetProfileInd!
.data!.profilePhoto!),
).image,
fit: BoxFit.cover,
),
shape: LinearBorder(),
),
)
: Container(
height: 484.h,
width: double.infinity,
child: Image.asset(
"assets/images/png/profileimg.png",
fit: BoxFit.cover,
),
),
Positioned.fill(
child: Container(
decoration: BoxDecoration(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
@@ -227,7 +241,7 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
color: Colors.white,
width: 1.0,
),
boxShadow: [
boxShadow: const [
BoxShadow(
color: Color(0x66000000),
offset: Offset(0, 4),
@@ -270,7 +284,7 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
color: Colors.white,
width: 1.0,
),
boxShadow: [
boxShadow: const [
BoxShadow(
color: Color(0x66000000),
offset: Offset(0, 4),
@@ -321,7 +335,7 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
height: 40.h,
width: 170.w,
decoration: BoxDecoration(
color: Color(0xFFD90B2E),
color: const Color(0xFFD90B2E),
borderRadius:
BorderRadius.circular(30.r),
),
@@ -470,7 +484,7 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
Row(
children: [
text18w700white("Timeline"),
Spacer(),
const Spacer(),
InkWell(
onTap: () {
Get.toNamed(RouteName.addtimeline);
@@ -488,12 +502,32 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
height: 300.h,
child: ListView.builder(
shrinkWrap: true,
itemCount: timeline.length,
itemCount: guestGetProfileInd!
.data!.timelines!.length,
itemBuilder: (context, index) {
var abilities;
abilities = guestGetProfileInd!.data!
.timelines![index].abilities!
.map((e) => e.name)
.join(', ');
return commonTimelineCard(
imagePath: timeline[index]
["imagePath"],
title: timeline[index]["title"]);
imagePath: timeline[index]
["imagePath"],
title: guestGetProfileInd!
.data!
.timelines![index]
.teamName ??
'',
teamName: guestGetProfileInd!
.data!
.timelines![index]
.teamName ??
'',
abilities: abilities,
startendDate:
"${guestGetProfileInd!.data!.timelines![index].startDate} - ${guestGetProfileInd!.data!.timelines![index].endDate} " ??
'',
);
},
)),
sizedBoxHeight(30.h),
@@ -501,7 +535,7 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
children: [
text16w700white(
"Certifications/Qualifications"),
Spacer(),
const Spacer(),
InkWell(
onTap: () {
Get.toNamed(RouteName.certificate);
@@ -515,20 +549,31 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: certificationData.length,
itemCount: guestGetProfileInd!
.data!.certifications!.length ??
certificationData.length,
itemBuilder: (context, index) {
var certifiData = guestGetProfileInd!
.data!.certifications![index];
return Padding(
padding: EdgeInsets.only(right: 20.w),
child: certificationCardTile(
imagePath:
imagePath: certifiData
.certificationImage ??
certificationData[index]
["imagePath"],
title: certificationData[index]
["title"],
subtitle: certificationData[index]
["subtitle"],
date: certificationData[index]
["date"]),
title: certifiData
.certificationName ??
certificationData[index]
["title"],
subtitle: certifiData
.certificationReason ??
certificationData[index]
["subtitle"],
date:
("Issued ${certifiData.certificationDate}") ??
(certificationData[index]
["date"])),
);
},
),
@@ -544,13 +589,18 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
shrinkWrap: true,
scrollDirection: Axis.horizontal,
padding: EdgeInsets.only(left: 16.w),
itemCount: cardtile.length,
itemCount: guestGetProfileInd!
.data!.myJoinedSubgroups!.length,
itemBuilder: (context, index) {
var subGroupData = guestGetProfileInd!.data!
.myJoinedSubgroups![index].subGroupData!;
return Padding(
padding: EdgeInsets.only(right: 20.w),
child: profilecardtile(
imagePath: cardtile[index]["imagePath"],
title: cardtile[index]["title"]),
imagePath: subGroupData.subGroupImage ??
cardtile[index]["imagePath"],
title: subGroupData.title ??
cardtile[index]["title"]),
);
},
),
@@ -585,7 +635,7 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
sizedBoxHeight(20.h),
Row(
children: [
Spacer(),
const Spacer(),
commonContainer(
width: 40.w,
height: 40.h,
@@ -706,7 +756,11 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
}
Widget commonTimelineCard(
{required String imagePath, required String title}) {
{required String imagePath,
required String title,
required String teamName,
required String startendDate,
required String abilities}) {
return Row(
children: [
Container(
@@ -720,7 +774,7 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
child: Container(
height: 11.h,
width: 11.w,
decoration: BoxDecoration(
decoration: const BoxDecoration(
color: Colors.white, shape: BoxShape.circle)),
),
Positioned(
@@ -728,7 +782,7 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
child: Container(
width: 1.w,
height: 170.h,
decoration: BoxDecoration(color: Colors.white),
decoration: const BoxDecoration(color: Colors.white),
),
),
],
@@ -759,12 +813,11 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
],
),
sizedBoxHeight(10.h),
text12700white("Team captain"),
text12700white(teamName),
sizedBoxHeight(8.h),
text12400white("April 2023 - May 2024"),
text12400white(startendDate),
sizedBoxHeight(10.h),
text10400whiteblur(
"Lorem Ipsum is simply dummy text of the printing and typesetting industry.")
text10400whiteblur(abilities)
],
),
),
@@ -824,7 +877,7 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
sizedBoxWidth(7.w),
Icon(
Icons.circle,
color: Color(0xFFFCFCFC),
color: const Color(0xFFFCFCFC),
size: 4.sp,
),
sizedBoxWidth(6.w),
@@ -833,12 +886,12 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
)
],
),
Spacer(),
const Spacer(),
PopupMenuButton(
surfaceTintColor: Color(0xFF222935),
surfaceTintColor: const Color(0xFF222935),
constraints: BoxConstraints.tightFor(width: 176.w),
offset: Offset(0, 50),
color: Color(0xFF222935),
offset: const Offset(0, 50),
color: const Color(0xFF222935),
tooltip: "",
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
PopupMenuItem(
@@ -856,7 +909,7 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
fontFamily: "Nunito Sans",
),
),
Spacer(),
const Spacer(),
Image.asset(
"assets/images/png/Vector (5).png",
height: 15.h,
@@ -866,7 +919,7 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
),
),
),
PopupMenuDivider(),
const PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
child: Padding(
@@ -882,7 +935,7 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
fontFamily: "Nunito Sans",
),
),
Spacer(),
const Spacer(),
Image.asset(
"assets/images/png/share.png",
height: 20.h,
@@ -892,7 +945,7 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
),
),
),
PopupMenuDivider(),
const PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
child: Padding(
@@ -908,7 +961,7 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
fontFamily: "Nunito Sans",
),
),
Spacer(),
const Spacer(),
Image.asset(
"assets/images/png/f7_pin-fill (2).png",
height: 25.h,
@@ -973,7 +1026,7 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
'assets/images/png/heart 2.png',
'assets/images/png/party-popper 2.png'
]),
Spacer(),
const Spacer(),
commonContainer(
width: 30.w,
height: 30.h,
@@ -1056,11 +1109,12 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
boxRadius: 30,
itemsSpacing: 8,
itemScale: 0.4,
itemSize: Size(45, 45),
boxPadding: EdgeInsets.all(8),
boxAnimationDuration: Duration(milliseconds: 200),
itemAnimationDuration: Duration(milliseconds: 500),
hoverDuration: Duration(milliseconds: 700),
itemSize: const Size(45, 45),
boxPadding: const EdgeInsets.all(8),
boxAnimationDuration: const Duration(milliseconds: 200),
itemAnimationDuration:
const Duration(milliseconds: 500),
hoverDuration: const Duration(milliseconds: 700),
// toggle: false,
child: _buildReactionsIcon(mainImage.value),
@@ -1118,14 +1172,28 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
height: 40.h,
width: 57.w,
child: Image.asset(
imagePath,
fit: BoxFit.cover,
),
),
guestGetProfileInd!.data!.certifications != null
? Container(
width: 57.w,
height: 40.h,
decoration: ShapeDecoration(
image: DecorationImage(
image: Image(
image: NetworkImage(imagePath),
).image,
fit: BoxFit.cover,
),
shape: LinearBorder(),
),
)
: Container(
height: 40.h,
width: 57.w,
child: Image.asset(
imagePath,
fit: BoxFit.cover,
),
),
sizedBoxWidth(10.w),
Expanded(
child: Column(
@@ -1177,7 +1245,7 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
width: 100.w,
height: 30.h,
borderRadius: BorderRadius.circular(30.r),
borderColor: Color(0xFFD90B2E),
borderColor: const Color(0xFFD90B2E),
borderwidth: 0.9,
customWidget: Padding(
padding: EdgeInsets.symmetric(horizontal: 10.w),
@@ -1188,14 +1256,29 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
Widget profilecardtile({required String imagePath, required String title}) {
return Column(
children: [
Container(
height: 109.h,
width: 100.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.r),
),
child: Image.asset(imagePath),
),
guestGetProfileInd!.data!.myJoinedSubgroups!.isNotEmpty
? Container(
width: 100.w,
height: 109.h,
decoration: ShapeDecoration(
image: DecorationImage(
image: Image(
image: NetworkImage(imagePath),
).image,
fit: BoxFit.cover,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.r)),
),
)
: Container(
height: 109.h,
width: 100.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.r),
),
child: Image.asset(imagePath),
),
sizedBoxHeight(10.h),
SizedBox(width: 100.w, child: text12w700_FCFCFC(title)),
],

View File

@@ -61,14 +61,18 @@ class Follower {
String? userName;
String? fullName;
String? profilePhoto;
int? principleTypeXid;
Follower({this.id, this.userName, this.fullName, this.profilePhoto});
Follower({this.id, this.userName, this.fullName, this.profilePhoto, this.principleTypeXid});
Follower.fromJson(Map<String, dynamic> json) {
id = json['id'];
userName = json['user_name'];
fullName = json['full_name'];
profilePhoto = json['profile_photo'];
principleTypeXid = json['principal_type_xid'];
}
Map<String, dynamic> toJson() {
@@ -77,6 +81,8 @@ class Follower {
data['user_name'] = this.userName;
data['full_name'] = this.fullName;
data['profile_photo'] = this.profilePhoto;
data['principal_type_xid'] = this.principleTypeXid;
return data;
}
}

View File

@@ -61,14 +61,21 @@ class Following {
String? userName;
String? fullName;
String? profilePhoto;
int? principleTypeXid;
Following({this.id, this.userName, this.fullName, this.profilePhoto});
Following(
{this.id,
this.userName,
this.fullName,
this.profilePhoto,
this.principleTypeXid});
Following.fromJson(Map<String, dynamic> json) {
id = json['id'];
userName = json['user_name'];
fullName = json['full_name'];
profilePhoto = json['profile_photo'];
principleTypeXid = json['principal_type_xid'];
}
Map<String, dynamic> toJson() {
@@ -77,6 +84,8 @@ class Following {
data['user_name'] = this.userName;
data['full_name'] = this.fullName;
data['profile_photo'] = this.profilePhoto;
data['principal_type_xid'] = this.principleTypeXid;
return data;
}
}

View File

@@ -16,6 +16,7 @@ import 'package:regroup/Utils/Common/CustomTextformfield.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:remove_emoji_input_formatter/remove_emoji_input_formatter.dart';
class MyNetwork extends StatefulWidget {
@@ -26,14 +27,16 @@ class MyNetwork extends StatefulWidget {
}
class _MyNetworkState extends State<MyNetwork> {
// var fromMainIndProfile = Get.arguments['From'] ?? '';
// MainIndProfile
@override
Widget build(BuildContext context) {
return Scaffold(
// key: _scaffoldKey1,
resizeToAvoidBottomInset: false,
backgroundColor: Color(0xFF222935),
backgroundColor: const Color(0xFF222935),
extendBody: true,
appBar: CommonAppbar(
appBar: const CommonAppbar(
titleTxt: "My networks",
),
body: Stack(children: [
@@ -58,11 +61,11 @@ class _MyNetworkState extends State<MyNetwork> {
text: 'Following',
),
]),
Expanded(
const Expanded(
child: TabBarView(
children: [
followersTab(),
followingTab(),
FollowersTab(),
FollowingTab(),
],
),
),
@@ -73,19 +76,20 @@ class _MyNetworkState extends State<MyNetwork> {
}
}
class followersTab extends StatefulWidget {
const followersTab({super.key});
class FollowersTab extends StatefulWidget {
const FollowersTab({super.key});
@override
State<followersTab> createState() => _followersTabState();
State<FollowersTab> createState() => _FollowersTabState();
}
class _followersTabState extends State<followersTab> {
class _FollowersTabState extends State<FollowersTab> {
StreamController<FollowersModel> searchcontroller = StreamController();
@override
void initState() {
var updata = "";
Profilegetmethod().getFollowers(updata, streamController: searchcontroller);
// TODO: implement initState
@@ -204,200 +208,221 @@ class _followersTabState extends State<followersTab> {
builder: (ctx, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
// Display shimmer effect while waiting for data
return Expanded(
return const Expanded(
child: Center(child: CircularProgressIndicator()));
} else if (snapshot.hasError) {
// Handle error state
return Center(
child: Text(
'${snapshot.error} occurred',
style: TextStyle(fontSize: 18),
style: const TextStyle(fontSize: 18),
),
);
} else {
// Data has been loaded, show actual UI
return followersobj!.data!.isEmpty
? _buildNoDataBody(context)
: ListView.separated(
physics: ScrollPhysics(),
shrinkWrap: true,
itemCount: followersobj!.data!.length,
separatorBuilder: (BuildContext context, int index) {
return commonDivider();
},
itemBuilder: (context, index) {
return Column(
children: [
Padding(
padding: EdgeInsets.symmetric(
vertical: 16.h, horizontal: 16.w),
child: Row(
children: [
followersobj!.data![index].follower!
.profilePhoto ==
null ||
followersobj!.data![index].follower!
.profilePhoto!.isEmpty
? CircleAvatar(
backgroundImage: AssetImage(
'assets/images/png/Ellipse 43.png'),
radius: 25.r,
)
: CircleAvatar(
backgroundImage: NetworkImage(
followersobj!.data![index]
.follower!.profilePhoto!),
radius: 25.r,
),
sizedBoxWidth(10.w),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
: Expanded(
child: ListView.separated(
physics: const ScrollPhysics(),
shrinkWrap: true,
itemCount: followersobj!.data!.length,
separatorBuilder: (BuildContext context, int index) {
return commonDivider();
},
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
followersobj!.data![index].follower!
.principleTypeXid ==
1
? Get.toNamed(RouteName.profiletabindguest,
arguments: {
"FolloweridIndex": followersobj!
.data![index].iamPrincipalXid!,
})
: Get.toNamed(RouteName.profiletabbusguest,
arguments: {
"FolloweridIndex": followersobj!
.data![index].iamPrincipalXid!,
});
},
child: Column(
children: [
Padding(
padding: EdgeInsets.symmetric(
vertical: 16.h, horizontal: 16.w),
child: Row(
children: [
followersobj!.data![index].follower!
.fullName ==
.profilePhoto ==
null ||
followersobj!
.data![index]
.follower!
.fullName!
.isEmpty ==
true
? text16w400_FCFCFC("Regroup")
: text16w400_FCFCFC(followersobj!
.data![index]
.follower!
.fullName!),
sizedBoxHeight(4.h),
followersobj!.data![index].follower!
.userName ==
null ||
followersobj!
.data![index]
.follower!
.userName!
.isEmpty ==
true
? text12w400_FCFCFC_blur("regroup")
: text12w400_FCFCFC_blur(followersobj!
.data![index].follower!.userName!)
followersobj!.data![index].follower!
.profilePhoto!.isEmpty
? CircleAvatar(
backgroundImage: const AssetImage(
'assets/images/png/Ellipse 43.png'),
radius: 25.r,
)
: CircleAvatar(
backgroundImage: NetworkImage(
followersobj!.data![index]
.follower!.profilePhoto!),
radius: 25.r,
),
sizedBoxWidth(10.w),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
followersobj!.data![index].follower!
.fullName ==
null ||
followersobj!
.data![index]
.follower!
.fullName!
.isEmpty ==
true
? text16w400_FCFCFC("Regroup")
: text16w400_FCFCFC(followersobj!
.data![index]
.follower!
.fullName!),
sizedBoxHeight(4.h),
followersobj!.data![index].follower!
.userName ==
null ||
followersobj!
.data![index]
.follower!
.userName!
.isEmpty ==
true
? text12w400_FCFCFC_blur("regroup")
: text12w400_FCFCFC_blur(
followersobj!.data![index]
.follower!.userName!)
],
),
const Spacer(),
PopupMenuButton(
surfaceTintColor:
const Color(0xFF222935),
constraints: BoxConstraints.tightFor(
width: 176.w),
offset: const Offset(0, 20),
color: const Color(0xFF222935),
tooltip: "",
itemBuilder: (BuildContext context) =>
<PopupMenuEntry>[
PopupMenuItem(
// onTap: () {},
onTap: () async {
setState(() {
removeid = followersobj!
.data![index]
.follower!
.id ??
0;
followersobj!.data!
.removeWhere((item) =>
item.follower!.id ==
removeid);
RemoveUploadata();
});
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 12.w),
child: Row(
children: [
text14400white(
"Remove user"),
const Spacer(),
Image.asset(
"assets/images/png/fluent_delete-28-regular.png",
height: 15.h,
width: 15.w,
)
],
),
),
),
const PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 12.w),
child: Row(
children: [
text14400white(
"Message user"),
const Spacer(),
Image.asset(
"assets/images/png/fluent_chat-20-regular.png",
height: 20.h,
width: 20.w,
)
],
),
),
),
const PopupMenuDivider(),
PopupMenuItem(
onTap: () async {
setState(() {
blockid = followersobj!
.data![index]
.follower!
.id ??
0;
followersobj!.data!
.removeWhere((item) =>
item.follower!.id ==
blockid);
BlockUploadata();
});
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 12.w),
child: Row(
children: [
text14400white(
"Block user"),
const Spacer(),
Image.asset(
"assets/images/png/blockchat.png",
height: 25.h,
width: 25.w,
)
],
),
),
),
],
child: SizedBox(
height: 20,
width: 20,
child: Center(
child: Image.asset(
"assets/images/png/Group 1000004071.png",
height: 22.h,
width: 4.w,
),
),
)),
],
),
Spacer(),
PopupMenuButton(
surfaceTintColor: Color(0xFF222935),
constraints:
BoxConstraints.tightFor(width: 176.w),
offset: Offset(0, 20),
color: Color(0xFF222935),
tooltip: "",
itemBuilder: (BuildContext context) =>
<PopupMenuEntry>[
PopupMenuItem(
// onTap: () {},
onTap: () async {
setState(() {
removeid = followersobj!
.data![index]
.follower!
.id ??
0;
followersobj!.data!
.removeWhere((item) =>
item.follower!.id ==
removeid);
RemoveUploadata();
});
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 12.w),
child: Row(
children: [
text14400white(
"Remove user"),
Spacer(),
Image.asset(
"assets/images/png/fluent_delete-28-regular.png",
height: 15.h,
width: 15.w,
)
],
),
),
),
PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 12.w),
child: Row(
children: [
text14400white(
"Message user"),
Spacer(),
Image.asset(
"assets/images/png/fluent_chat-20-regular.png",
height: 20.h,
width: 20.w,
)
],
),
),
),
PopupMenuDivider(),
PopupMenuItem(
onTap: () async {
setState(() {
blockid = followersobj!
.data![index]
.follower!
.id ??
0;
followersobj!.data!
.removeWhere((item) =>
item.follower!.id ==
blockid);
BlockUploadata();
});
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 12.w),
child: Row(
children: [
text14400white(
"Block user"),
Spacer(),
Image.asset(
"assets/images/png/blockchat.png",
height: 25.h,
width: 25.w,
)
],
),
),
),
],
child: Container(
height: 20,
width: 20,
child: Center(
child: Image.asset(
"assets/images/png/Group 1000004071.png",
height: 22.h,
width: 4.w,
),
),
)),
],
),
)
],
);
},
);
)
],
),
);
},
),
);
}
},
),
@@ -426,14 +451,14 @@ class _followersTabState extends State<followersTab> {
}
}
class followingTab extends StatefulWidget {
const followingTab({super.key});
class FollowingTab extends StatefulWidget {
const FollowingTab({super.key});
@override
State<followingTab> createState() => _followingTabState();
State<FollowingTab> createState() => _FollowingTabState();
}
class _followingTabState extends State<followingTab> {
class _FollowingTabState extends State<FollowingTab> {
StreamController<FollowingModel> searchcontroller = StreamController();
List followingData = [
@@ -548,181 +573,217 @@ class _followingTabState extends State<followingTab> {
builder: (ctx, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
// Display shimmer effect while waiting for data
return Expanded(
return const Expanded(
child: Center(child: CircularProgressIndicator()));
} else if (snapshot.hasError) {
// Handle error state
return Center(
child: Text(
'${snapshot.error} occurred',
style: TextStyle(fontSize: 18),
style: const TextStyle(fontSize: 18),
),
);
} else {
// Data has been loaded, show actual UI
return followingobj!.data!.isEmpty
? _buildNoDataBody(context)
: ListView.separated(
physics: ScrollPhysics(),
shrinkWrap: true,
itemCount: followingobj!.data!.length,
separatorBuilder: (BuildContext context, int index) {
return commonDivider();
},
itemBuilder: (context, index) {
return
// Column(
// children: [
// Followinglist(
// imagePath: followingobj?.data?[index]
// .following?.profilePhoto ??
// '',
// title: followingobj!
// .data?[index].following?.fullName ??
// '',
// subtitle: followingobj!
// .data?[index].following?.userName ??
// '',
// unfollowontap: (id) => Uploadata(id),
// unfollowindex: followingobj!
// .data![index].following!.id!,
// ),
// if (index != followingobj!.data!.length - 1)
// commonDivider(),
// ],
// );
Column(
children: [
Padding(
padding: EdgeInsets.symmetric(
vertical: 16.h, horizontal: 16.w),
child: Row(
children: [
followingobj!.data![index].following!
.profilePhoto ==
null ||
followingobj!.data![index].following!
.profilePhoto!.isEmpty
? CircleAvatar(
backgroundImage: AssetImage(
'assets/images/png/Ellipse 43.png'),
radius: 25.r,
)
: CircleAvatar(
backgroundImage: NetworkImage(
followingobj!.data![index]
.following!.profilePhoto!),
radius: 25.r,
),
sizedBoxWidth(10.w),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
: Expanded(
child: ListView.separated(
physics: const ScrollPhysics(),
shrinkWrap: true,
itemCount: followingobj!.data!.length,
separatorBuilder: (BuildContext context, int index) {
return commonDivider();
},
itemBuilder: (context, index) {
return
// Column(
// children: [
// Followinglist(
// imagePath: followingobj?.data?[index]
// .following?.profilePhoto ??
// '',
// title: followingobj!
// .data?[index].following?.fullName ??
// '',
// subtitle: followingobj!
// .data?[index].following?.userName ??
// '',
// unfollowontap: (id) => Uploadata(id),
// unfollowindex: followingobj!
// .data![index].following!.id!,
// ),
// if (index != followingobj!.data!.length - 1)
// commonDivider(),
// ],
// );
GestureDetector(
onTap: () {
followingobj!.data![index].following!
.principleTypeXid ==
1
? Get.toNamed(RouteName.profiletabindguest,
arguments: {
"FollowingidIndex": followingobj!
.data![index]
.followingIamPrincipalXid!,
})
: Get.toNamed(RouteName.profiletabbusguest,
arguments: {
"FollowingidIndex": followingobj!
.data![index]
.followingIamPrincipalXid!,
});
},
child: Column(
children: [
Padding(
padding: EdgeInsets.symmetric(
vertical: 16.h, horizontal: 16.w),
child: Row(
children: [
followingobj!.data![index].following!
.fullName ==
.profilePhoto ==
null ||
followingobj!.data![index]
.following!.fullName!.isEmpty
? text16w400_FCFCFC("Regroup")
: text16w400_FCFCFC(followingobj!
.data![index]
.following!
.fullName!),
sizedBoxHeight(4.h),
followingobj!.data![index].following!
.userName ==
null ||
followingobj!.data![index]
.following!.userName!.isEmpty
? text12w400_FCFCFC_blur("regroup")
: text12w400_FCFCFC_blur(followingobj!
.data![index]
.following!
.userName!)
followingobj!
.data![index]
.following!
.profilePhoto!
.isEmpty
? CircleAvatar(
backgroundImage: const AssetImage(
'assets/images/png/Ellipse 43.png'),
radius: 25.r,
)
: CircleAvatar(
backgroundImage: NetworkImage(
followingobj!
.data![index]
.following!
.profilePhoto!),
radius: 25.r,
),
sizedBoxWidth(10.w),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
followingobj!.data![index].following!
.fullName ==
null ||
followingobj!
.data![index]
.following!
.fullName!
.isEmpty
? text16w400_FCFCFC("Regroup")
: text16w400_FCFCFC(followingobj!
.data![index]
.following!
.fullName!),
sizedBoxHeight(4.h),
followingobj!.data![index].following!
.userName ==
null ||
followingobj!
.data![index]
.following!
.userName!
.isEmpty
? text12w400_FCFCFC_blur(
"regroup")
: text12w400_FCFCFC_blur(
followingobj!.data![index]
.following!.userName!)
],
),
const Spacer(),
PopupMenuButton(
surfaceTintColor:
const Color(0xFF222935),
constraints: BoxConstraints.tightFor(
width: 176.w),
offset: const Offset(0, 20),
color: const Color(0xFF222935),
tooltip: "",
itemBuilder: (BuildContext context) =>
<PopupMenuEntry>[
PopupMenuItem(
onTap: () async {
setState(() {
unfollowid = followingobj!
.data![index]
.following!
.id ??
0;
// followingobj!.data!.removeAt(index);
followingobj!.data!
.removeWhere((item) =>
item.following!
.id ==
unfollowid);
Uploadata();
});
},
child: Padding(
padding:
EdgeInsets.symmetric(
horizontal: 12.w),
child: Row(
children: [
text14400white(
"Unfollow user"),
const Spacer(),
Image.asset(
"assets/images/png/Black1323e.png",
height: 20.h,
width: 20.w,
)
],
),
),
),
const PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
child: Padding(
padding:
EdgeInsets.symmetric(
horizontal: 12.w),
child: Row(
children: [
text14400white(
"Message user"),
const Spacer(),
Image.asset(
"assets/images/png/fluent_chat-20-22.png",
height: 20.h,
width: 20.w,
)
],
),
),
),
],
child: Container(
height: 20,
width: 20,
child: Center(
child: Image.asset(
"assets/images/png/Group 1000004071.png",
height: 22.h,
width: 4.w,
),
),
)),
],
),
Spacer(),
PopupMenuButton(
surfaceTintColor: Color(0xFF222935),
constraints:
BoxConstraints.tightFor(width: 176.w),
offset: Offset(0, 20),
color: Color(0xFF222935),
tooltip: "",
itemBuilder: (BuildContext context) =>
<PopupMenuEntry>[
PopupMenuItem(
onTap: () async {
setState(() {
unfollowid = followingobj!
.data![index]
.following!
.id ??
0;
// followingobj!.data!.removeAt(index);
followingobj!.data!
.removeWhere((item) =>
item.following!.id ==
unfollowid);
Uploadata();
});
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 12.w),
child: Row(
children: [
text14400white(
"Unfollow user"),
Spacer(),
Image.asset(
"assets/images/png/Black1323e.png",
height: 20.h,
width: 20.w,
)
],
),
),
),
PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 12.w),
child: Row(
children: [
text14400white(
"Message user"),
Spacer(),
Image.asset(
"assets/images/png/fluent_chat-20-22.png",
height: 20.h,
width: 20.w,
)
],
),
),
),
],
child: Container(
height: 20,
width: 20,
child: Center(
child: Image.asset(
"assets/images/png/Group 1000004071.png",
height: 22.h,
width: 4.w,
),
),
)),
],
),
),
],
),
],
);
},
);
},
),
);
}
},

View File

@@ -182,7 +182,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
fontFamily: 'Cambria',
),
debugShowCheckedModeBanner: false,
initialRoute: RouteName.profiletabbusguest,
initialRoute: RouteName.splashScreen,
getPages: AppRoutes.appRoutes(),
),
designSize: const Size(390, 844),