From abf668e14c9e235b2f9c6861d2e7729043b137fc Mon Sep 17 00:00:00 2001 From: cj201199 Date: Mon, 22 Jul 2024 20:29:15 +0530 Subject: [PATCH] Guest View api integration done. --- .../EditProfile/View/ProfileTab.dart | 20 +- .../ProfileTab/Followers/Followers.dart | 1267 +++++++++-------- .../ProfileTab/Following/Following.dart | 949 ++++++------ .../Guest User/Model/GetGuestFollowers.dart | 11 +- .../Guest User/Model/GetGuestFollowing.dart | 6 +- .../Model/GuestGetProfileDataIndi.dart | 125 +- .../View/Business/ProfileTabBusGuest.dart | 53 +- .../View/Individual/ProfileTabIndGuest.dart | 231 ++- .../ProfileTab/Model/followersModel.dart | 8 +- .../ProfileTab/Model/followingModel.dart | 11 +- .../ProfileTab/My Network/MyNetwork.dart | 755 +++++----- lib/main.dart | 2 +- 12 files changed, 2002 insertions(+), 1436 deletions(-) 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 4e6686a..cc0e74a 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/ProfileTab.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/ProfileTab.dart @@ -252,7 +252,11 @@ class _ProfileTabState extends State { GestureDetector( onTap: () { Get.toNamed( - RouteName.mynetwork); + RouteName.mynetwork, + // arguments: { + // "From": 'MainIndProfile', + // } + ); }, child: Container( height: 34.h, @@ -516,6 +520,8 @@ class _ProfileTabState extends State { return Container(); }, ) + + //BusProfile : FutureBuilder( future: businessfuture, builder: (ctx, snapshot) { @@ -607,7 +613,11 @@ class _ProfileTabState extends State { GestureDetector( onTap: () { Get.toNamed( - RouteName.followers); + RouteName.followers, + arguments: { + "From": + 'MainBusProfile', + }); }, child: Column( children: [ @@ -647,7 +657,11 @@ class _ProfileTabState extends State { GestureDetector( onTap: () { Get.toNamed( - RouteName.following); + RouteName.following, + arguments: { + "From": + 'MainBusProfile', + }); }, child: Column( children: [ diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Followers/Followers.dart b/lib/Feed Module/Main_Screens/ProfileTab/Followers/Followers.dart index f6aa298..b28155e 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/Followers/Followers.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/Followers/Followers.dart @@ -31,16 +31,28 @@ class _FollowersState extends State { StreamController(); var guestUserid = Get.arguments['UpdataGuestIdfollowers'] ?? ''; + var fromBusFollower = Get.arguments['From'] ?? ''; + var guestUserBusid = Get.arguments['UpdataGuestBusIdfollowers'] ?? ''; + var fromMainBusProfile = Get.arguments['From'] ?? ''; + @override void initState() { // TODO: implement initState var updata = ""; - Profilegetmethod().getFollowers(updata, streamController: searchcontroller); + if (fromMainBusProfile == 'MainBusProfile') { + Profilegetmethod() + .getFollowers(updata, streamController: searchcontroller); + } var guestupdata = ""; - GuestProfileApi().getGuestfollowers(guestUserid, guestupdata, - streamController: guestsearchcontroller); + if (fromBusFollower == 'GuestBusFollowers') { + GuestProfileApi().getGuestfollowers(guestUserBusid, guestupdata, + streamController: guestsearchcontroller); + } else { + GuestProfileApi().getGuestfollowers(guestUserid, guestupdata, + streamController: guestsearchcontroller); + } super.initState(); } @@ -92,580 +104,699 @@ class _FollowersState extends State { Widget build(BuildContext context) { return Scaffold( // key: _scaffoldKey1, - backgroundColor: Color(0xFF222935), + backgroundColor: const Color(0xFF222935), extendBody: true, - appBar: CommonAppbar( + appBar: const CommonAppbar( titleTxt: "Followers", ), resizeToAvoidBottomInset: false, - body: Stack(children: [ - Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/png/Ellipse 1496.png"), - fit: BoxFit.fill)), - ), - SingleChildScrollView( - child: Column(children: [ - Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: CustomTextFormField( - leadingIcon: SizedBox( - height: 23, - width: 23, - child: Center( - child: Image.asset( - "assets/images/png/ion_search-outline.png", - height: 23, - width: 23, - ), - ), - ), - texttype: TextInputType.text, - inputFormatters: [ - RemoveEmojiInputFormatter(), - ], - onInput: (value) { - GuestProfileApi().getGuestfollowers(guestUserid, value, - streamController: guestsearchcontroller); - }, - hintText: "Search people", + body: fromMainBusProfile == 'MainBusProfile' + ? Stack(children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: + AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), ), - ), - sizedBoxHeight(25.h), - StreamBuilder( - stream: guestsearchcontroller.stream, - builder: (ctx, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { - // Display shimmer effect while waiting for data - return Center(child: CircularProgressIndicator()); - } else if (snapshot.hasError) { - // Handle error state - return Center( - child: Text( - '${snapshot.error} occurred', - style: TextStyle(fontSize: 18), - ), - ); - } else { - // Data has been loaded, show actual UI - return getguestfollowersobj!.data!.isEmpty - ? _buildNoDataBody(context) - : ListView.separated( - physics: ScrollPhysics(), - shrinkWrap: true, - itemCount: getguestfollowersobj!.data!.length, - separatorBuilder: - (BuildContext context, int index) { - return commonDivider(); + SingleChildScrollView( + child: Column(children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: CustomTextFormField( + leadingIcon: SizedBox( + height: 23, + width: 23, + child: Center( + child: Image.asset( + "assets/images/png/ion_search-outline.png", + height: 23, + width: 23, + ), + ), + ), + texttype: TextInputType.text, + inputFormatters: [ + RemoveEmojiInputFormatter(), + ], + onInput: (value) { + Profilegetmethod().getFollowers(value, + streamController: searchcontroller); }, - itemBuilder: (context, index) { - return GestureDetector( - onTap: () { - Get.toNamed(RouteName.profiletabindguest, - arguments: { - "FolloweridIndex": getguestfollowersobj! - .data![index].iamPrincipalXid, - }); - }, - child: Column( - children: [ - Padding( - padding: EdgeInsets.symmetric( - vertical: 16.h, horizontal: 16.w), - child: Row( - children: [ - getguestfollowersobj! - .data![index] - .follower! - .profilePhoto == - null || - getguestfollowersobj! - .data![index] - .follower! - .profilePhoto! - .isEmpty - ? CircleAvatar( - backgroundImage: AssetImage( - 'assets/images/png/Ellipse 43.png'), - radius: 25.r, - ) - : CircleAvatar( - backgroundImage: NetworkImage( - getguestfollowersobj! - .data![index] - .follower! - .profilePhoto!), - radius: 25.r, - ), - sizedBoxWidth(10.w), - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - getguestfollowersobj! - .data![index] - .follower! - .fullName == - null || - getguestfollowersobj! - .data![index] - .follower! - .fullName! - .isEmpty == - true - ? text16w400_FCFCFC("Regroup") - : text16w400_FCFCFC( - getguestfollowersobj! - .data![index] - .follower! - .fullName!), - sizedBoxHeight(4.h), - getguestfollowersobj! - .data![index] - .follower! - .userName == - null || - getguestfollowersobj! - .data![index] - .follower! - .userName! - .isEmpty == - true - ? text12w400_FCFCFC_blur( - "regroup") - : text12w400_FCFCFC_blur( - getguestfollowersobj! - .data![index] - .follower! - .userName!) - ], - ), - Spacer(), - PopupMenuButton( - surfaceTintColor: - Color(0xFF222935), - constraints: - BoxConstraints.tightFor( - width: 176.w), - offset: Offset(0, 20), - color: Color(0xFF222935), - tooltip: "", - itemBuilder: - (BuildContext context) => - [ - PopupMenuItem( - // onTap: () {}, - onTap: () async { - setState(() { - removeid = getguestfollowersobj! - .data![ - index] - .follower! - .id ?? - 0; - getguestfollowersobj! - .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 = getguestfollowersobj! - .data![ - index] - .follower! - .id ?? - 0; - getguestfollowersobj! - .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, - ), - ), - )), - ], - ), - ) - ], + hintText: "Search people", + ), + ), + sizedBoxHeight(25.h), + StreamBuilder( + stream: searchcontroller.stream, + builder: (ctx, snapshot) { + if (snapshot.connectionState == + ConnectionState.waiting) { + // Display shimmer effect while waiting for data + return const 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 followersobj!.data!.isEmpty + ? _buildNoDataBody(context) + : + // ListView.builder( + // shrinkWrap: true, + // itemCount: followersobj!.data!.length, + // itemBuilder: (context, index) { + // return Column( + // children: [ + // followerWidget( + // imagePath: followersobj?.data?[index] + // .follower?.profilePhoto ?? + // "", + // // followersData[index]["imagePath"], + // title: followersobj?.data?[index].follower + // ?.fullName ?? + // "", + // // followersData[index]["title"], + // subtitle: followersobj?.data?[index] + // .follower?.userName ?? + // "", + // blockonTap: () { + // BlockUploadata(followersobj! + // .data![index].follower!.id); + // } + // // followersData[index]["subtitle"] + // ), + // if (index != followersobj!.data!.length - 1) + // commonDivider(), + // ], + // ); + // }, + // ); + + 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! + .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: SizedBox( + height: 20, + width: 20, + child: Center( + child: Image.asset( + "assets/images/png/Group 1000004071.png", + height: 22.h, + width: 4.w, + ), + ), + )), + ], + ), + ) + ], + ), + ); + }, + ); + } + }, + ), + ]) + ])) + ]) + : Stack(children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: + AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + SingleChildScrollView( + child: Column(children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: CustomTextFormField( + leadingIcon: SizedBox( + height: 23, + width: 23, + child: Center( + child: Image.asset( + "assets/images/png/ion_search-outline.png", + height: 23, + width: 23, + ), + ), + ), + texttype: TextInputType.text, + inputFormatters: [ + RemoveEmojiInputFormatter(), + ], + onInput: (value) { + if (fromBusFollower == 'GuestBusFollowers') { + GuestProfileApi().getGuestfollowers( + guestUserBusid, value, + streamController: guestsearchcontroller); + } + GuestProfileApi().getGuestfollowers( + guestUserid, value, + streamController: guestsearchcontroller); }, - ); - } - }, - ), - ]) - ])) - ])); - - // Stack(children: [ - // Container( - // decoration: const BoxDecoration( - // image: DecorationImage( - // image: AssetImage("assets/images/png/Ellipse 1496.png"), - // fit: BoxFit.fill)), - // ), - // SingleChildScrollView( - // child: Column(children: [ - // Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - // Padding( - // padding: EdgeInsets.symmetric(horizontal: 16.w), - // child: CustomTextFormField( - // leadingIcon: SizedBox( - // height: 23, - // width: 23, - // child: Center( - // child: Image.asset( - // "assets/images/png/ion_search-outline.png", - // height: 23, - // width: 23, - // ), - // ), - // ), - // texttype: TextInputType.text, - // inputFormatters: [ - // RemoveEmojiInputFormatter(), - // ], - // onInput: (value) { - // Profilegetmethod().getFollowers(value, - // streamController: searchcontroller); - // }, - // hintText: "Search people", - // ), - // ), - // sizedBoxHeight(25.h), - // StreamBuilder( - // stream: searchcontroller.stream, - // builder: (ctx, snapshot) { - // if (snapshot.connectionState == ConnectionState.waiting) { - // // Display shimmer effect while waiting for data - // return Center(child: CircularProgressIndicator()); - // } else if (snapshot.hasError) { - // // Handle error state - // return Center( - // child: Text( - // '${snapshot.error} occurred', - // style: TextStyle(fontSize: 18), - // ), - // ); - // } else { - // // Data has been loaded, show actual UI - // return followersobj!.data!.isEmpty - // ? _buildNoDataBody(context) - // : - // // ListView.builder( - // // shrinkWrap: true, - // // itemCount: followersobj!.data!.length, - // // itemBuilder: (context, index) { - // // return Column( - // // children: [ - // // followerWidget( - // // imagePath: followersobj?.data?[index] - // // .follower?.profilePhoto ?? - // // "", - // // // followersData[index]["imagePath"], - // // title: followersobj?.data?[index].follower - // // ?.fullName ?? - // // "", - // // // followersData[index]["title"], - // // subtitle: followersobj?.data?[index] - // // .follower?.userName ?? - // // "", - // // blockonTap: () { - // // BlockUploadata(followersobj! - // // .data![index].follower!.id); - // // } - // // // followersData[index]["subtitle"] - // // ), - // // if (index != followersobj!.data!.length - 1) - // // commonDivider(), - // // ], - // // ); - // // }, - // // ); - - // 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, - // 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!) - // ], - // ), - // Spacer(), - // PopupMenuButton( - // surfaceTintColor: Color(0xFF222935), - // constraints: - // BoxConstraints.tightFor( - // width: 176.w), - // offset: Offset(0, 20), - // color: 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"), - // 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, - // ), - // ), - // )), - // ], - // ), - // ) - // ], - // ); - // }, - // ); - // } - // }, - // ), - // ]) - // ])) - // ])); + hintText: "Search people", + ), + ), + sizedBoxHeight(25.h), + StreamBuilder( + stream: guestsearchcontroller.stream, + builder: (ctx, snapshot) { + if (snapshot.connectionState == + ConnectionState.waiting) { + // Display shimmer effect while waiting for data + return const 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 getguestfollowersobj!.data!.isEmpty + ? _buildNoDataBody(context) + : ListView.separated( + physics: const ScrollPhysics(), + shrinkWrap: true, + itemCount: + getguestfollowersobj!.data!.length, + separatorBuilder: + (BuildContext context, int index) { + return commonDivider(); + }, + itemBuilder: (context, index) { + return GestureDetector( + onTap: () { + getguestfollowersobj! + .data![index] + .follower! + .principleTypeXid == + 1 + ? Get.toNamed( + RouteName + .profiletabindguest, + arguments: { + "FolloweridIndex": + getguestfollowersobj! + .data![index] + .iamPrincipalXid, + }) + : Get.toNamed( + RouteName + .profiletabbusguest, + arguments: { + "FolloweridIndex": + getguestfollowersobj! + .data![index] + .iamPrincipalXid, + }); + }, + child: Column( + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 16.h, + horizontal: 16.w), + child: Row( + children: [ + getguestfollowersobj! + .data![ + index] + .follower! + .profilePhoto == + null || + getguestfollowersobj! + .data![index] + .follower! + .profilePhoto! + .isEmpty + ? CircleAvatar( + backgroundImage: + const AssetImage( + 'assets/images/png/Ellipse 43.png'), + radius: 25.r, + ) + : CircleAvatar( + backgroundImage: NetworkImage( + getguestfollowersobj! + .data![ + index] + .follower! + .profilePhoto!), + radius: 25.r, + ), + sizedBoxWidth(10.w), + Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + getguestfollowersobj! + .data![ + index] + .follower! + .fullName == + null || + getguestfollowersobj! + .data![ + index] + .follower! + .fullName! + .isEmpty == + true + ? text16w400_FCFCFC( + "Regroup") + : text16w400_FCFCFC( + getguestfollowersobj! + .data![ + index] + .follower! + .fullName!), + sizedBoxHeight(4.h), + getguestfollowersobj! + .data![ + index] + .follower! + .userName == + null || + getguestfollowersobj! + .data![ + index] + .follower! + .userName! + .isEmpty == + true + ? text12w400_FCFCFC_blur( + "regroup") + : text12w400_FCFCFC_blur( + getguestfollowersobj! + .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 = + getguestfollowersobj!.data![index].follower!.id ?? + 0; + getguestfollowersobj!.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 = + getguestfollowersobj!.data![index].follower!.id ?? + 0; + getguestfollowersobj!.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, + ), + ), + )), + ], + ), + ) + ], + ), + ); + }, + ); + } + }, + ), + ]) + ])) + ])); } Widget _buildNoDataBody(context) { diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Following/Following.dart b/lib/Feed Module/Main_Screens/ProfileTab/Following/Following.dart index 65e921f..c7d5e87 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/Following/Following.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/Following/Following.dart @@ -32,16 +32,30 @@ class _FollowingState extends State { StreamController(); var guestUserid = Get.arguments['UpdataGuestIdfollowing'] ?? ''; + + var fromBusFollowing = Get.arguments['From'] ?? ''; + + var guestBusUserid = Get.arguments['UpdataGuestBusIdfollowing'] ?? ''; + + var fromMainBusProfile = Get.arguments['From'] ?? ''; + @override void initState() { // TODO: implement initState var updata = ""; - Profilegetmethod().getFollowing(updata, streamController: searchcontroller); + if (fromMainBusProfile == 'MainBusProfile') { + Profilegetmethod() + .getFollowing(updata, streamController: searchcontroller); + } var guestupdata = ""; - - GuestProfileApi().getGuestfollowing(guestUserid, guestupdata, - streamController: guestsearchcontroller); + if (fromBusFollowing == 'GuestBusFollowing') { + GuestProfileApi().getGuestfollowing(guestBusUserid, guestupdata, + streamController: guestsearchcontroller); + } else { + GuestProfileApi().getGuestfollowing(guestUserid, guestupdata, + streamController: guestsearchcontroller); + } super.initState(); } @@ -79,181 +93,218 @@ class _FollowingState extends State { Widget build(BuildContext context) { return Scaffold( // key: _scaffoldKey1, - backgroundColor: Color(0xFF222935), + backgroundColor: const Color(0xFF222935), extendBody: true, resizeToAvoidBottomInset: false, - appBar: CommonAppbar( + appBar: const CommonAppbar( titleTxt: "Following", ), - body: Stack( - children: [ - Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/png/Ellipse 1496.png"), - fit: BoxFit.fill)), - ), - SingleChildScrollView( - child: Column(children: [ - Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: CustomTextFormField( - leadingIcon: SizedBox( - height: 23, - width: 23, - child: Center( - child: Image.asset( - "assets/images/png/ion_search-outline.png", + body: fromMainBusProfile == 'MainBusProfile' + ? Stack(children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + SingleChildScrollView( + child: Column(children: [ + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + 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); + }, ), ), - hintText: "Search people", - texttype: TextInputType.text, - inputFormatters: [ - // LengthLimitingTextInputFormatter(20), - RemoveEmojiInputFormatter(), - ], - onInput: (value) { - GuestProfileApi().getGuestfollowing(guestUserid, value, - streamController: guestsearchcontroller); - }, - ), - ), - sizedBoxHeight(25.h), - StreamBuilder( - stream: guestsearchcontroller.stream, - builder: (ctx, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { - // Display shimmer effect while waiting for data - return Center(child: CircularProgressIndicator()); - } else if (snapshot.hasError) { - // Handle error state - return Center( - child: Text( - '${snapshot.error} occurred', - style: TextStyle(fontSize: 18), - ), - ); - } else { - // Data has been loaded, show actual UI - return getguestfollowingobj!.data!.isEmpty - ? _buildNoDataBody(context) - : ListView.separated( - physics: ScrollPhysics(), - shrinkWrap: true, - itemCount: getguestfollowingobj!.data!.length, - separatorBuilder: - (BuildContext context, int index) { - return commonDivider(); - }, - itemBuilder: (context, index) { - return GestureDetector( - onTap: () { - Get.toNamed(RouteName.profiletabindguest, - arguments: { - "FollowingidIndex": - getguestfollowingobj!.data![index] - .followingIamPrincipalXid!, - }); + sizedBoxHeight(25.h), + StreamBuilder( + stream: searchcontroller.stream, + builder: (ctx, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + // Display shimmer effect while waiting for data + return const 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(); }, - child: Column( - children: [ - Padding( - padding: EdgeInsets.symmetric( - vertical: 16.h, horizontal: 16.w), - child: Row( - children: [ - getguestfollowingobj! - .data![index] - .following! - .profilePhoto == - null || - getguestfollowingobj! + 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] - .following! - .profilePhoto! - .isEmpty - ? CircleAvatar( - backgroundImage: AssetImage( - 'assets/images/png/Ellipse 43.png'), - radius: 25.r, - ) - : CircleAvatar( - backgroundImage: NetworkImage( - getguestfollowingobj! - .data![index] - .following! - .profilePhoto!), - radius: 25.r, - ), - sizedBoxWidth(10.w), - Column( - crossAxisAlignment: - CrossAxisAlignment.start, + .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: [ - getguestfollowingobj! + followingobj! .data![index] .following! - .fullName == + .profilePhoto == null || - getguestfollowingobj! + followingobj! .data![index] .following! - .fullName! + .profilePhoto! .isEmpty - ? text16w400_FCFCFC("Regroup") - : text16w400_FCFCFC( - getguestfollowingobj! - .data![index] - .following! - .fullName!), - sizedBoxHeight(4.h), - getguestfollowingobj! + ? 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! - .userName == - null || - getguestfollowingobj! - .data![index] - .following! - .userName! - .isEmpty - ? text12w400_FCFCFC_blur( - "regroup") - : text12w400_FCFCFC_blur( - getguestfollowingobj! - .data![index] - .following! - .userName!) - ], - ), - Spacer(), - PopupMenuButton( - surfaceTintColor: - Color(0xFF222935), - constraints: - BoxConstraints.tightFor( - width: 176.w), - offset: Offset(0, 20), - color: Color(0xFF222935), - tooltip: "", - itemBuilder: - (BuildContext context) => + .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 = getguestfollowingobj! + unfollowid = followingobj! .data![ index] .following! .id ?? 0; // followingobj!.data!.removeAt(index); - getguestfollowingobj! + followingobj! .data! .removeWhere((item) => item.following! @@ -271,7 +322,7 @@ class _FollowingState extends State { children: [ text14400white( "Unfollow user"), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/Black1323e.png", height: 20.h, @@ -281,7 +332,7 @@ class _FollowingState extends State { ), ), ), - PopupMenuDivider(), + const PopupMenuDivider(), PopupMenuItem( onTap: () {}, child: Padding( @@ -293,7 +344,7 @@ class _FollowingState extends State { children: [ text14400white( "Message user"), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/fluent_chat-20-22.png", height: 20.h, @@ -304,283 +355,329 @@ class _FollowingState extends State { ), ), ], - child: Container( - height: 20, - width: 20, - child: Center( - child: Image.asset( - "assets/images/png/Group 1000004071.png", - height: 22.h, - width: 4.w, - ), - ), - )), - ], - ), + child: Container( + height: 20, + width: 20, + child: Center( + child: Image.asset( + "assets/images/png/Group 1000004071.png", + height: 22.h, + width: 4.w, + ), + ), + )), + ], + ), + ), + ], ), - ], + ); + }, + ); + } + }, + ), + ]) + ])) + ]) + : Stack( + children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: + AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + SingleChildScrollView( + child: Column(children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + 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) { + // GuestProfileApi().getGuestfollowing(guestUserid, value, + // streamController: guestsearchcontroller); + if (fromBusFollowing == 'GuestBusFollowing') { + GuestProfileApi().getGuestfollowing( + guestBusUserid, value, + streamController: guestsearchcontroller); + } else { + GuestProfileApi().getGuestfollowing( + guestUserid, value, + streamController: guestsearchcontroller); + } + }, + ), + ), + sizedBoxHeight(25.h), + StreamBuilder( + stream: guestsearchcontroller.stream, + builder: (ctx, snapshot) { + if (snapshot.connectionState == + ConnectionState.waiting) { + // Display shimmer effect while waiting for data + return const Center(child: CircularProgressIndicator()); + } else if (snapshot.hasError) { + // Handle error state + return Center( + child: Text( + '${snapshot.error} occurred', + style: const TextStyle(fontSize: 18), ), ); - }, - ); - } - }, - ), - ]) - ])) - ], - ), - - // Stack( - // children: [ - // Container( - // decoration: const BoxDecoration( - // image: DecorationImage( - // image: AssetImage("assets/images/png/Ellipse 1496.png"), - // fit: BoxFit.fill)), - // ), - // SingleChildScrollView( - // child: Column(children: [ - // Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - // Padding( - // padding: EdgeInsets.symmetric(horizontal: 16.w), - // 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); - // }, - // ), - // ), - // sizedBoxHeight(25.h), - // StreamBuilder( - // stream: searchcontroller.stream, - // builder: (ctx, snapshot) { - // if (snapshot.connectionState == ConnectionState.waiting) { - // // Display shimmer effect while waiting for data - // return Center(child: CircularProgressIndicator()); - // } else if (snapshot.hasError) { - // // Handle error state - // return Center( - // child: Text( - // '${snapshot.error} occurred', - // style: 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, - // 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!) - // ], - // ), - // Spacer(), - // PopupMenuButton( - // surfaceTintColor: Color(0xFF222935), - // constraints: - // BoxConstraints.tightFor( - // width: 176.w), - // offset: Offset(0, 20), - // color: 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"), - // 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, - // ), - // ), - // )), - // ], - // ), - // ), - // ], - // ); - // }, - // ); - // } - // }, - // ), - // ]) - // ])) - // ], - // ), + } else { + // Data has been loaded, show actual UI + return getguestfollowingobj!.data!.isEmpty + ? _buildNoDataBody(context) + : ListView.separated( + physics: const ScrollPhysics(), + shrinkWrap: true, + itemCount: + getguestfollowingobj!.data!.length, + separatorBuilder: + (BuildContext context, int index) { + return commonDivider(); + }, + itemBuilder: (context, index) { + return GestureDetector( + onTap: () { + getguestfollowingobj! + .data![index] + .following! + .principleTypeXid == + 1 + ? Get.toNamed( + RouteName + .profiletabindguest, + arguments: { + "FollowingidIndex": + getguestfollowingobj! + .data![index] + .followingIamPrincipalXid!, + }) + : Get.toNamed( + RouteName + .profiletabbusguest, + arguments: { + "FollowingidIndex": + getguestfollowingobj! + .data![index] + .followingIamPrincipalXid!, + }, + ); + }, + child: Column( + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 16.h, + horizontal: 16.w), + child: Row( + children: [ + getguestfollowingobj! + .data![ + index] + .following! + .profilePhoto == + null || + getguestfollowingobj! + .data![index] + .following! + .profilePhoto! + .isEmpty + ? CircleAvatar( + backgroundImage: + const AssetImage( + 'assets/images/png/Ellipse 43.png'), + radius: 25.r, + ) + : CircleAvatar( + backgroundImage: NetworkImage( + getguestfollowingobj! + .data![ + index] + .following! + .profilePhoto!), + radius: 25.r, + ), + sizedBoxWidth(10.w), + Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + getguestfollowingobj! + .data![ + index] + .following! + .fullName == + null || + getguestfollowingobj! + .data![ + index] + .following! + .fullName! + .isEmpty + ? text16w400_FCFCFC( + "Regroup") + : text16w400_FCFCFC( + getguestfollowingobj! + .data![ + index] + .following! + .fullName!), + sizedBoxHeight(4.h), + getguestfollowingobj! + .data![ + index] + .following! + .userName == + null || + getguestfollowingobj! + .data![ + index] + .following! + .userName! + .isEmpty + ? text12w400_FCFCFC_blur( + "regroup") + : text12w400_FCFCFC_blur( + getguestfollowingobj! + .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 = + getguestfollowingobj!.data![index].following!.id ?? + 0; + // followingobj!.data!.removeAt(index); + getguestfollowingobj!.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, + ), + ), + )), + ], + ), + ), + ], + ), + ); + }, + ); + } + }, + ), + ]) + ])) + ], + ), ); } diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Guest User/Model/GetGuestFollowers.dart b/lib/Feed Module/Main_Screens/ProfileTab/Guest User/Model/GetGuestFollowers.dart index eaa866c..84e829d 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/Guest User/Model/GetGuestFollowers.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/Guest User/Model/GetGuestFollowers.dart @@ -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 json) { id = json['id']; userName = json['user_name']; fullName = json['full_name']; profilePhoto = json['profile_photo']; + principleTypeXid = json['principal_type_xid']; } Map 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; } } diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Guest User/Model/GetGuestFollowing.dart b/lib/Feed Module/Main_Screens/ProfileTab/Guest User/Model/GetGuestFollowing.dart index ad8a848..e6eb03c 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/Guest User/Model/GetGuestFollowing.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/Guest User/Model/GetGuestFollowing.dart @@ -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 json) { id = json['id']; userName = json['user_name']; fullName = json['full_name']; profilePhoto = json['profile_photo']; + principleTypeXid = json['principal_type_xid']; } Map 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; } } 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 fa2e75c..28227ab 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 @@ -31,6 +31,7 @@ class Data { String? userName; String? fullName; String? gender; + String? profilePhoto; String? dateOfBirth; List? interest; String? about; @@ -42,13 +43,17 @@ class Data { Follows? follows; List? timelines; int? accountVisibility; + List? myJoinedGroups; List? myJoinedSubgroups; + List? 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 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 = []; 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 = []; + json['my_joined_groups'].forEach((v) { + 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['certifications'] != null) { + certifications = []; + json['certifications'].forEach((v) { + certifications!.add(new Certifications.fromJson(v)); + }); + } + daysBeforeJoined = json['days_before_joined']; } Map 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 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; + } +} + 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 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 toJson() { + final Map data = new Map(); + 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; + } +} diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Guest User/View/Business/ProfileTabBusGuest.dart b/lib/Feed Module/Main_Screens/ProfileTab/Guest User/View/Business/ProfileTabBusGuest.dart index ade1a7f..ba8c3f2 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/Guest User/View/Business/ProfileTabBusGuest.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/Guest User/View/Business/ProfileTabBusGuest.dart @@ -24,7 +24,9 @@ class _profiletabBusGestState extends State { @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 { 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 { GestureDetector( onTap: () { Get.toNamed( - RouteName.followers); + RouteName.followers, + arguments: { + 'From': + "GuestBusFollowers", + 'UpdataGuestBusIdfollowers': + updata + }); }, child: Column( children: [ @@ -168,7 +193,13 @@ class _profiletabBusGestState extends State { GestureDetector( onTap: () { Get.toNamed( - RouteName.following); + RouteName.following, + arguments: { + 'From': + "GuestBusFollowing", + 'UpdataGuestBusIdfollowing': + updata, + }); }, child: Column( children: [ 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 9630ae5..1fef178 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 @@ -81,8 +81,6 @@ class _ProfileTabIndGuestState extends State { late Future guestIndfuture; var updata; - // FollowingidIndex - @override void initState() { // updata = Get.arguments != null @@ -103,14 +101,14 @@ class _ProfileTabIndGuestState extends State { 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 { 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 { 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 { 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 { 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 { Row( children: [ text18w700white("Timeline"), - Spacer(), + const Spacer(), InkWell( onTap: () { Get.toNamed(RouteName.addtimeline); @@ -488,12 +502,32 @@ class _ProfileTabIndGuestState extends State { 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 { children: [ text16w700white( "Certifications/Qualifications"), - Spacer(), + const Spacer(), InkWell( onTap: () { Get.toNamed(RouteName.certificate); @@ -515,20 +549,31 @@ class _ProfileTabIndGuestState extends State { 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 { 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 { sizedBoxHeight(20.h), Row( children: [ - Spacer(), + const Spacer(), commonContainer( width: 40.w, height: 40.h, @@ -706,7 +756,11 @@ class _ProfileTabIndGuestState extends State { } 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 { 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 { 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 { ], ), 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 { 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 { ) ], ), - 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) => [ PopupMenuItem( @@ -856,7 +909,7 @@ class _ProfileTabIndGuestState extends State { 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 { ), ), ), - PopupMenuDivider(), + const PopupMenuDivider(), PopupMenuItem( onTap: () {}, child: Padding( @@ -882,7 +935,7 @@ class _ProfileTabIndGuestState extends State { fontFamily: "Nunito Sans", ), ), - Spacer(), + const Spacer(), Image.asset( "assets/images/png/share.png", height: 20.h, @@ -892,7 +945,7 @@ class _ProfileTabIndGuestState extends State { ), ), ), - PopupMenuDivider(), + const PopupMenuDivider(), PopupMenuItem( onTap: () {}, child: Padding( @@ -908,7 +961,7 @@ class _ProfileTabIndGuestState extends State { 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 { '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 { 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 { 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 { 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 { 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)), ], diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Model/followersModel.dart b/lib/Feed Module/Main_Screens/ProfileTab/Model/followersModel.dart index 1c0e3d7..c8fcb02 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/Model/followersModel.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/Model/followersModel.dart @@ -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 json) { id = json['id']; userName = json['user_name']; fullName = json['full_name']; profilePhoto = json['profile_photo']; + principleTypeXid = json['principal_type_xid']; + } Map 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; } } diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Model/followingModel.dart b/lib/Feed Module/Main_Screens/ProfileTab/Model/followingModel.dart index 323b892..869a84e 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/Model/followingModel.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/Model/followingModel.dart @@ -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 json) { id = json['id']; userName = json['user_name']; fullName = json['full_name']; profilePhoto = json['profile_photo']; + principleTypeXid = json['principal_type_xid']; } Map 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; } } 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 0f4d4c7..f85a350 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/My Network/MyNetwork.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/My Network/MyNetwork.dart @@ -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 { + // 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 { text: 'Following', ), ]), - Expanded( + const Expanded( child: TabBarView( children: [ - followersTab(), - followingTab(), + FollowersTab(), + FollowingTab(), ], ), ), @@ -73,19 +76,20 @@ class _MyNetworkState extends State { } } -class followersTab extends StatefulWidget { - const followersTab({super.key}); +class FollowersTab extends StatefulWidget { + const FollowersTab({super.key}); @override - State createState() => _followersTabState(); + State createState() => _FollowersTabState(); } -class _followersTabState extends State { +class _FollowersTabState extends State { StreamController searchcontroller = StreamController(); @override void initState() { var updata = ""; + Profilegetmethod().getFollowers(updata, streamController: searchcontroller); // TODO: implement initState @@ -204,200 +208,221 @@ class _followersTabState extends State { 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) => + [ + 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) => - [ - 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 { } } -class followingTab extends StatefulWidget { - const followingTab({super.key}); +class FollowingTab extends StatefulWidget { + const FollowingTab({super.key}); @override - State createState() => _followingTabState(); + State createState() => _FollowingTabState(); } -class _followingTabState extends State { +class _FollowingTabState extends State { StreamController searchcontroller = StreamController(); List followingData = [ @@ -548,181 +573,217 @@ class _followingTabState extends State { 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) => + [ + 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) => - [ - 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, - ), - ), - )), - ], - ), + ), + ], ), - ], - ); - }, + ); + }, + ), ); } }, diff --git a/lib/main.dart b/lib/main.dart index 59cf7bc..d1aa8d7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -182,7 +182,7 @@ class _MyAppState extends State with WidgetsBindingObserver { fontFamily: 'Cambria', ), debugShowCheckedModeBanner: false, - initialRoute: RouteName.profiletabbusguest, + initialRoute: RouteName.splashScreen, getPages: AppRoutes.appRoutes(), ), designSize: const Size(390, 844),