From fc0a71d3c1de9b0ba1df8de6c3f47518ea35a9e4 Mon Sep 17 00:00:00 2001 From: Shubhamshirva Date: Tue, 23 Jul 2024 20:25:32 +0530 Subject: [PATCH] conlficts resolvesd for guest user --- .../EditProfile/Model/GetEditProfileIndi.dart | 128 ++- .../EditProfile/View/ProfileTab.dart | 34 +- .../Model/GuestGetProfileDataIndi.dart | 24 +- .../View/Individual/ProfileTabIndGuest.dart | 78 +- .../ProfileTab/My Network/MyNetwork.dart | 866 ++++++++++-------- lib/Utils/Common/ShimmerCommon.dart | 14 +- 6 files changed, 611 insertions(+), 533 deletions(-) diff --git a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/Model/GetEditProfileIndi.dart b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/Model/GetEditProfileIndi.dart index 339e49d..ebe4ad3 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/Model/GetEditProfileIndi.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/Model/GetEditProfileIndi.dart @@ -43,7 +43,7 @@ class Data { Follows? follows; List? timelines; int? accountVisibility; - List? myJoinedSubgroups; + List? myJoinedGroups; List? certifications; int? daysBeforeJoined; @@ -66,7 +66,7 @@ class Data { this.follows, this.timelines, this.accountVisibility, - this.myJoinedSubgroups, + this.myJoinedGroups, this.certifications, this.daysBeforeJoined }); @@ -100,10 +100,10 @@ class Data { }); } accountVisibility = json['account_visibility']; - if (json['my_joined_subgroups'] != null) { - myJoinedSubgroups = []; - json['my_joined_subgroups'].forEach((v) { - myJoinedSubgroups!.add(new MyJoinedSubgroups.fromJson(v)); + if (json['my_joined_groups'] != null) { + myJoinedGroups = []; + json['my_joined_groups'].forEach((v) { + myJoinedGroups!.add(new MyJoinedGroups.fromJson(v)); }); } if (json['certifications'] != null) { @@ -140,9 +140,9 @@ class Data { data['timelines'] = this.timelines!.map((v) => v.toJson()).toList(); } data['account_visibility'] = this.accountVisibility; - if (this.myJoinedSubgroups != null) { - data['my_joined_subgroups'] = - this.myJoinedSubgroups!.map((v) => v.toJson()).toList(); + if (this.myJoinedGroups != null) { + data['my_joined_groups'] = + this.myJoinedGroups!.map((v) => v.toJson()).toList(); } if (this.certifications != null) { data['certifications'] = @@ -262,64 +262,6 @@ class Follows { } } -class MyJoinedSubgroups { - int? id; - int? iamPrincipalXid; - int? manageGroupXid; - int? manageSubGroupXid; - SubGroupData? subGroupData; - - MyJoinedSubgroups( - {this.id, - this.iamPrincipalXid, - this.manageGroupXid, - this.manageSubGroupXid, - this.subGroupData}); - - MyJoinedSubgroups.fromJson(Map json) { - id = json['id']; - iamPrincipalXid = json['iam_principal_xid']; - manageGroupXid = json['manage_group_xid']; - manageSubGroupXid = json['manage_sub_group_xid']; - subGroupData = json['sub_group_data'] != null - ? new SubGroupData.fromJson(json['sub_group_data']) - : null; - } - - Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['iam_principal_xid'] = this.iamPrincipalXid; - data['manage_group_xid'] = this.manageGroupXid; - data['manage_sub_group_xid'] = this.manageSubGroupXid; - if (this.subGroupData != null) { - data['sub_group_data'] = this.subGroupData!.toJson(); - } - return data; - } -} - -class SubGroupData { - int? id; - String? title; - String? subGroupImage; - - SubGroupData({this.id, this.title, this.subGroupImage}); - - SubGroupData.fromJson(Map json) { - id = json['id']; - title = json['title']; - subGroupImage = json['sub_group_image']; - } - - Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['title'] = this.title; - data['sub_group_image'] = this.subGroupImage; - return data; - } -} class Certifications { int? id; @@ -357,3 +299,55 @@ class Certifications { return data; } } + +class MyJoinedGroups { + int? id; + int? iamPrincipalXid; + int? manageGroupXid; + GroupData? groupData; + + MyJoinedGroups( + {this.id, this.iamPrincipalXid, this.manageGroupXid, this.groupData}); + + MyJoinedGroups.fromJson(Map 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 toJson() { + final Map data = new Map(); + 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 json) { + id = json['id']; + title = json['title']; + groupImage = json['group_image']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['title'] = this.title; + data['group_image'] = this.groupImage; + return data; + } +} diff --git a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/ProfileTab.dart b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/ProfileTab.dart index a0d16c9..e3c1880 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/ProfileTab.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/ProfileTab.dart @@ -584,6 +584,8 @@ class _ProfileTabState extends State { ], ), Row( + mainAxisAlignment: + MainAxisAlignment.center, children: [ InkWell( onTap: @@ -625,13 +627,16 @@ class _ProfileTabState extends State { }); }, child: - SizedBox( - width: 20.w, - height: 20.h, - child: Image.asset( - "assets/images/png/iconamoon_edit-thin.png", - height: 14.h, - width: 14.w, + Padding( + padding: EdgeInsets.only(top: 4.h), + child: SizedBox( + width: 20.w, + height: 20.h, + child: Image.asset( + "assets/images/png/iconamoon_edit-thin.png", + height: 20.h, + width: 20.w, + ), ), ), ) @@ -974,7 +979,7 @@ class _ProfileTabState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - text18w700white("Subgroups"), + text18w700white("Groups"), ], ), ), @@ -987,22 +992,22 @@ class _ProfileTabState extends State { scrollDirection: Axis.horizontal, padding: EdgeInsets.only(left: 16.w), itemCount: getEditProfileIndi! - .data!.myJoinedSubgroups!.length, + .data!.myJoinedGroups!.length, itemBuilder: (context, index) { return Padding( padding: EdgeInsets.only(right: 20.w), child: profilecardtile( imagePath: getEditProfileIndi! .data! - .myJoinedSubgroups![index] - .subGroupData! - .subGroupImage ?? + .myJoinedGroups![index] + .groupData! + .groupImage ?? '', // cardtile[index]["imagePath"], title: getEditProfileIndi! .data! - .myJoinedSubgroups![index] - .subGroupData! + .myJoinedGroups![index] + .groupData! .title! // cardtile[index]["title"] @@ -1074,7 +1079,6 @@ class _ProfileTabState extends State { builder: (ctx, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return ShimmerCommon(); - } if (snapshot.hasError) { diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Guest User/Model/GuestGetProfileDataIndi.dart b/lib/Feed Module/Main_Screens/ProfileTab/Guest User/Model/GuestGetProfileDataIndi.dart index 28227ab..97a9af1 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/Guest User/Model/GuestGetProfileDataIndi.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/Guest User/Model/GuestGetProfileDataIndi.dart @@ -44,7 +44,7 @@ class Data { List? timelines; int? accountVisibility; List? myJoinedGroups; - List? myJoinedSubgroups; + // List? myJoinedSubgroups; List? certifications; int? daysBeforeJoined; @@ -66,7 +66,7 @@ class Data { this.timelines, this.accountVisibility, this.myJoinedGroups, - this.myJoinedSubgroups, + // this.myJoinedSubgroups, this.certifications, this.daysBeforeJoined}); @@ -104,12 +104,12 @@ class Data { myJoinedGroups!.add(new MyJoinedGroups.fromJson(v)); }); } - if (json['my_joined_subgroups'] != null) { - myJoinedSubgroups = []; - json['my_joined_subgroups'].forEach((v) { - myJoinedSubgroups!.add(new MyJoinedSubgroups.fromJson(v)); - }); - } + // if (json['my_joined_subgroups'] != null) { + // myJoinedSubgroups = []; + // json['my_joined_subgroups'].forEach((v) { + // myJoinedSubgroups!.add(new MyJoinedSubgroups.fromJson(v)); + // }); + // } if (json['certifications'] != null) { certifications = []; json['certifications'].forEach((v) { @@ -147,10 +147,10 @@ class Data { 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.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(); diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Guest User/View/Individual/ProfileTabIndGuest.dart b/lib/Feed Module/Main_Screens/ProfileTab/Guest User/View/Individual/ProfileTabIndGuest.dart index a44a330..48aa32d 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/Guest User/View/Individual/ProfileTabIndGuest.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/Guest User/View/Individual/ProfileTabIndGuest.dart @@ -275,37 +275,37 @@ class _ProfileTabIndGuestState extends State { ], ), ), - sizedBoxWidth(20.w), - Container( - height: 58.h, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all( - color: Colors.white, - width: 1.0, - ), - boxShadow: const [ - BoxShadow( - color: Color(0x66000000), - offset: Offset(0, 4), - blurRadius: 4.0, - ), - ], - ), - ), - sizedBoxWidth(20.w), - GestureDetector( - onTap: () { - Get.toNamed(RouteName.clubs); - }, - child: Column( - children: [ - text16400white("10"), - sizedBoxHeight(6.h), - text12400whiteblur("Clubs") - ], - ), - ), + // sizedBoxWidth(20.w), + // Container( + // height: 58.h, + // decoration: BoxDecoration( + // color: Colors.white, + // border: Border.all( + // color: Colors.white, + // width: 1.0, + // ), + // boxShadow: const [ + // BoxShadow( + // color: Color(0x66000000), + // offset: Offset(0, 4), + // blurRadius: 4.0, + // ), + // ], + // ), + // ), + // sizedBoxWidth(20.w), + // GestureDetector( + // onTap: () { + // Get.toNamed(RouteName.clubs); + // }, + // child: Column( + // children: [ + // text16400white("10"), + // sizedBoxHeight(6.h), + // text12400whiteblur("Clubs") + // ], + // ), + // ), ], ), sizedBoxHeight(20.h), @@ -601,16 +601,16 @@ class _ProfileTabIndGuestState extends State { ), ), sizedBoxHeight(30.h), - text18w400white("Subgroups"), + text18w400white("Groups"), ]), ), sizedBoxHeight(20.h), - guestGetProfileInd!.data!.myJoinedSubgroups!.isEmpty + guestGetProfileInd!.data!.myJoinedGroups!.isEmpty ? Padding( padding: EdgeInsets.symmetric(vertical: 30.h), child: Center( child: text18w700white( - "No Subgroups Found")), + "No groups Found")), ) : SizedBox( height: 190.h, @@ -619,17 +619,17 @@ class _ProfileTabIndGuestState extends State { scrollDirection: Axis.horizontal, padding: EdgeInsets.only(left: 16.w), itemCount: guestGetProfileInd! - .data!.myJoinedSubgroups!.length, + .data!.myJoinedGroups!.length, itemBuilder: (context, index) { var subGroupData = guestGetProfileInd! .data! - .myJoinedSubgroups![index] - .subGroupData!; + .myJoinedGroups![index] + .groupData!; return Padding( padding: EdgeInsets.only(right: 20.w), child: profilecardtile( imagePath: subGroupData - .subGroupImage ?? + .groupImage ?? cardtile[index]["imagePath"], title: subGroupData.title ?? cardtile[index]["title"]), @@ -1307,7 +1307,7 @@ class _ProfileTabIndGuestState extends State { Widget profilecardtile({required String imagePath, required String title}) { return Column( children: [ - guestGetProfileInd!.data!.myJoinedSubgroups!.isNotEmpty + guestGetProfileInd!.data!.myJoinedGroups!.isNotEmpty ? Container( width: 100.w, height: 109.h, diff --git a/lib/Feed Module/Main_Screens/ProfileTab/My Network/MyNetwork.dart b/lib/Feed Module/Main_Screens/ProfileTab/My Network/MyNetwork.dart index 71f7829..923be90 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/My Network/MyNetwork.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/My Network/MyNetwork.dart @@ -32,7 +32,7 @@ class _MyNetworkState extends State { @override Widget build(BuildContext context) { return GestureDetector( - onTap: () => FocusManager.instance.primaryFocus?.unfocus(), + onTap: () => FocusManager.instance.primaryFocus?.unfocus(), child: Scaffold( // key: _scaffoldKey1, resizeToAvoidBottomInset: false, @@ -238,188 +238,221 @@ class _FollowersTabState extends State { 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: 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) => - [ - 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: Container( - height: 20, - width: 20, - child: Center( - child: Image.asset( - "assets/images/png/Group 1000004071.png", - height: 22.h, - width: 4.w, + 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! + .profilePhoto == + null || + 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) => + [ + 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: Container( + height: 20, + width: 20, + child: Center( + child: Image.asset( + "assets/images/png/Group 1000004071.png", + height: 22.h, + width: 4.w, + ), + ), + )), + ], + ), + ) + ], + ), ); }, ); @@ -537,231 +570,278 @@ class _FollowingTabState extends State { @override Widget build(BuildContext context) { return ListView( - physics: const ScrollPhysics(), - scrollDirection: Axis.vertical, - children: [ - Column( + physics: const ScrollPhysics(), + scrollDirection: Axis.vertical, children: [ - sizedBoxHeight(25.h), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), - child: CustomTextFormField( - leadingIcon: SizedBox( - height: 23, - width: 23, - child: Center( - child: Image.asset( - "assets/images/png/ion_search-outline.png", + Column( + children: [ + sizedBoxHeight(25.h), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: CustomTextFormField( + leadingIcon: SizedBox( height: 23, width: 23, + child: Center( + child: Image.asset( + "assets/images/png/ion_search-outline.png", + height: 23, + width: 23, + ), + ), ), + hintText: "Search people", + texttype: TextInputType.text, + inputFormatters: [ + // LengthLimitingTextInputFormatter(20), + RemoveEmojiInputFormatter(), + ], + onInput: (value) { + // Onboard().postGroupsearch({"search": value}, + // streamController: searchcontroller); + // searchGroups(value!); + Profilegetmethod().getFollowing(value, + streamController: searchcontroller); + return null; + }, ), ), - hintText: "Search people", - texttype: TextInputType.text, - inputFormatters: [ - // LengthLimitingTextInputFormatter(20), - RemoveEmojiInputFormatter(), - ], - onInput: (value) { - // Onboard().postGroupsearch({"search": value}, - // streamController: searchcontroller); - // searchGroups(value!); - Profilegetmethod() - .getFollowing(value, streamController: searchcontroller); - return null; - }, - ), - ), - sizedBoxHeight(20.h), - StreamBuilder( - stream: searchcontroller.stream, - builder: (ctx, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { - // Display shimmer effect while waiting for data - return const Expanded( - child: Center(child: CircularProgressIndicator())); - } else if (snapshot.hasError) { - // Handle error state - return Center( - child: Text( - '${snapshot.error} occurred', - style: const TextStyle(fontSize: 18), - ), - ); - } else { - // Data has been loaded, show actual UI - return followingobj!.data!.isEmpty - ? _buildNoDataBody(context) - : 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(), - // ], - // ); - Column( - children: [ - Padding( - padding: EdgeInsets.symmetric( - vertical: 16.h, horizontal: 16.w), - child: Row( + sizedBoxHeight(20.h), + StreamBuilder( + stream: searchcontroller.stream, + builder: (ctx, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + // Display shimmer effect while waiting for data + return const Expanded( + child: Center(child: CircularProgressIndicator())); + } else if (snapshot.hasError) { + // Handle error state + return Center( + child: Text( + '${snapshot.error} occurred', + style: const TextStyle(fontSize: 18), + ), + ); + } else { + // Data has been loaded, show actual UI + return followingobj!.data!.isEmpty + ? _buildNoDataBody(context) + : 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: [ - followingobj!.data![index].following! - .profilePhoto == - null || - 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) => - [ - 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, - ) - ], - ), + 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: const AssetImage( + 'assets/images/png/Ellipse 43.png'), + radius: 25.r, + ) + : CircleAvatar( + backgroundImage: NetworkImage( + followingobj! + .data![index] + .following! + .profilePhoto!), + radius: 25.r, ), - ), - 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, - ) - ], - ), - ), - ), + 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!) ], - child: Container( - height: 20, - width: 20, - child: Center( - child: Image.asset( - "assets/images/png/Group 1000004071.png", - height: 22.h, - width: 4.w, - ), ), - )), + 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) => + [ + 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, + ), + ), + )), + ], + ), + ), ], ), - ), - ], + ); + }, ); - }, - ); - } - }, + } + }, + ), + ], ), - ], - ), - ] - ); + ]); } Widget _buildNoDataBody(context) { diff --git a/lib/Utils/Common/ShimmerCommon.dart b/lib/Utils/Common/ShimmerCommon.dart index 40e73bb..593b7d0 100644 --- a/lib/Utils/Common/ShimmerCommon.dart +++ b/lib/Utils/Common/ShimmerCommon.dart @@ -7,7 +7,7 @@ class ShimmerCommon extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Color(0xffFFF3E4), body: _buildShimmerBody()); + backgroundColor: Color(0xFF222935), body: _buildShimmerBody()); } // Build shimmer effect for the body @@ -28,8 +28,8 @@ class ShimmerCommon extends StatelessWidget { // Build shimmer UI for InsightWidget Widget _buildShimmerInsightWidget() { return Shimmer.fromColors( - baseColor: Colors.grey[300]!, - highlightColor: Colors.grey[100]!, + baseColor: Colors.grey[500]!, + highlightColor: Colors.grey[300]!, child: Container( padding: EdgeInsets.all(16.0), child: Column( @@ -38,25 +38,25 @@ class ShimmerCommon extends StatelessWidget { Container( width: double.infinity, height: 20, - color: Colors.grey[300], + color: Colors.grey[500], ), SizedBox(height: 8), Container( width: double.infinity, height: 20, - color: Colors.grey[300], + color: Colors.grey[500], ), SizedBox(height: 8), Container( width: double.infinity, height: 20, - color: Colors.grey[300], + color: Colors.grey[500], ), SizedBox(height: 8), Container( width: double.infinity, height: 20, - color: Colors.grey[300], + color: Colors.grey[500], ), ], ),