From 634b1a3bc482f3d6864421ac62a1d59db179e2e9 Mon Sep 17 00:00:00 2001 From: cj201199 Date: Fri, 26 Jul 2024 15:27:50 +0530 Subject: [PATCH] some ui changes --- lib/Common/api_urls.dart | 3 + .../EditProfile/Model/InterestModel.dart | 53 + .../EditProfile/View/BusEditProfile.dart | 16 +- .../EditProfile/View/EditProfile.dart | 714 +++++++++-- .../EditProfile/ViewModel/EditProfileApi.dart | 25 +- .../ViewModel/InterestApiList.dart | 29 + .../ProfileTab/Followers/Followers.dart | 16 +- .../View/Business/ProfileTabBusGuest.dart | 13 +- .../ProfileTab/My Network/MyNetwork.dart | 1084 ++++++++--------- .../ProfileTab/Settings/ContactUs.dart | 6 +- .../ProfileTab/Settings/DeleteAccount.dart | 7 +- lib/Utils/Common/CommonDropdown.dart | 1 + 12 files changed, 1255 insertions(+), 712 deletions(-) create mode 100644 lib/Feed Module/Main_Screens/ProfileTab/EditProfile/Model/InterestModel.dart create mode 100644 lib/Feed Module/Main_Screens/ProfileTab/EditProfile/ViewModel/InterestApiList.dart diff --git a/lib/Common/api_urls.dart b/lib/Common/api_urls.dart index afd85c2..11613b9 100644 --- a/lib/Common/api_urls.dart +++ b/lib/Common/api_urls.dart @@ -95,6 +95,9 @@ class ApiUrls { // Individual static const posteditprofile = "${baseUrl}update-profile"; static const geteditprofile = "${baseUrl}fetch-profile"; + static const getinterestlist = "${baseUrl}fetch-interests"; + + // Business static const posteditprofilebusiness = "${baseUrl}update-business-profile"; diff --git a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/Model/InterestModel.dart b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/Model/InterestModel.dart new file mode 100644 index 0000000..edcd7e2 --- /dev/null +++ b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/Model/InterestModel.dart @@ -0,0 +1,53 @@ +class InterestModel { + String? status; + int? statusCode; + String? message; + List? data; + + InterestModel({this.status, this.statusCode, this.message, this.data}); + + InterestModel.fromJson(Map json) { + status = json['status']; + statusCode = json['status_code']; + message = json['message']; + if (json['data'] != null) { + data = []; + json['data'].forEach((v) { + data!.add(new Data.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['status'] = this.status; + data['status_code'] = this.statusCode; + data['message'] = this.message; + if (this.data != null) { + data['data'] = this.data!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Data { + int? id; + String? name; + Null? image; + + Data({this.id, this.name, this.image}); + + Data.fromJson(Map json) { + id = json['id']; + name = json['name']; + image = json['image']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['image'] = this.image; + return data; + } +} diff --git a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/BusEditProfile.dart b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/BusEditProfile.dart index b1bd745..04b40c5 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/BusEditProfile.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/BusEditProfile.dart @@ -66,7 +66,8 @@ class _BusEditProfileState extends State { setValues() { if (isOnce) { busNameController.text = getEditProfileBus!.data!.businessName ?? ''; - busUserNameController.text = getEditProfileBus!.data!.businessName ?? 'victorygames _10'; + busUserNameController.text = + getEditProfileBus!.data!.businessName ?? 'victorygames _10'; ownerNameController.text = getEditProfileBus!.data!.businessOwnerName ?? 'James Bothman'; foundedonController.text = @@ -164,13 +165,14 @@ class _BusEditProfileState extends State { future: myfuture, builder: (ctx, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { - return const ShimmerCommon(); + return + // const ShimmerCommon(); - // Center( - // child: CircularProgressIndicator( - // color: Colors.blue, - // ), - // ); + Center( + child: CircularProgressIndicator( + color: Colors.blue, + ), + ); } if (snapshot.hasError) { diff --git a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/EditProfile.dart b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/EditProfile.dart index 4ab2574..5d03857 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/EditProfile.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/EditProfile.dart @@ -1,3 +1,4 @@ +import 'dart:developer'; import 'dart:io'; import 'package:dio/dio.dart'; @@ -7,7 +8,11 @@ import 'package:get/get.dart' hide MultipartFile, FormData; import 'package:regroup/Common/CommonButton.dart'; import 'package:regroup/Common/CommonWidget.dart'; import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/EditProfile/Model/GetEditProfileIndi.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/EditProfile/Model/InterestModel.dart' + as interestlist; import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/EditProfile/ViewModel/EditProfileApi.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/EditProfile/ViewModel/InterestApiList.dart'; import 'package:regroup/Utils/Common/CommonDropdown.dart'; import 'package:regroup/Utils/Common/CustomTextformfield.dart'; import 'package:regroup/Utils/Common/CommonAppbar.dart'; @@ -16,6 +21,7 @@ import 'package:regroup/Utils/Common/sized_box.dart'; import 'package:regroup/Utils/dialogs.dart'; import 'package:regroup/Utils/texts.dart'; import 'package:path/path.dart' as path; +import 'package:regroup/resources/routes/route_name.dart'; class EditProfile extends StatefulWidget { const EditProfile({super.key}); @@ -24,6 +30,8 @@ class EditProfile extends StatefulWidget { State createState() => _EditProfileState(); } +//location in normal profile individual api + class _EditProfileState extends State { TextEditingController fullNameController = TextEditingController(); TextEditingController userNameController = TextEditingController(); @@ -71,39 +79,102 @@ class _EditProfileState extends State { }); } - List getSelectedSportsIds() { - if (getEditProfileIndi == null || - getEditProfileIndi!.data!.interest == null) { - return []; - } + // List getSelectedSportsIds() { + // if (getEditProfileIndi == null || + // getEditProfileIndi!.data!.interest == null) { + // print("No interests found."); + // return []; + // } - return _selectedSports - .map((sportName) => getEditProfileIndi!.data!.interest! - .firstWhere((interest) => interest.name == sportName) - .id!) - .toList(); + // print("Selected sports: $_selectedSports"); + + // List selectedIds = _selectedSports + // .map((sportName) { + // var interest = getEditProfileIndi!.data!.interest!.firstWhere( + // (interest) => interest.name == sportName, + // orElse: () => Interest(id: -1, name: ''), + // ); + + // if (interest.id == -1) { + // print("No matching interest found for sport: $sportName"); + // } else { + // print( + // "Found interest for sport: $sportName with ID: ${interest.id}"); + // } + + // return interest.id!; + // }) + // .where((id) => id != -1) + // .toList(); + + // print("Selected IDs: $selectedIds"); + // return selectedIds; + // } + + //interestList + + // int id = Get.arguments["id"]; + // bool edited = Get.arguments["edit"]; + + interestlist.InterestModel? interestModel; + List interest = []; + List _interestdrop = []; + List selectedinterestid = []; + List selctedNameList = []; + RxBool isloading = true.obs; + + Future fetchInterestlist() async { + InterestListApi interestListAPI = InterestListApi(); + ResponseData response = await interestListAPI.getinterestlistApi(); + + if (response.status == ResponseStatus.SUCCESS) { + interestModel = interestlist.InterestModel.fromJson(response.data!); + setState(() { + interest = interestModel!.data ?? []; + _interestdrop = + interest.map((platform) => platform.name.toString()).toList(); + }); + log(interest.toString()); + } else { + print('Failed to fetch abilities'); + } + } + + void getCatIdFromName(List selectedInterests) { + selectedinterestid.clear(); + for (var name in selectedInterests) { + for (var i = 0; i < interest.length; i++) { + if (name == interest[i].name) { + selectedinterestid.add(interest[i].id!); + break; + } + } + } } @override void initState() { // TODO: implement initState - + // if (edited == true) { myfuture = EditProfileApi() .getEditProfileIndividual() .then((value) => {setValues()}); + super.initState(); } - setValues() { + setValues() async { if (isOnce) { fullNameController.text = getEditProfileIndi!.data!.fullName ?? ''; userNameController.text = getEditProfileIndi!.data!.userName ?? ''; dateController.text = getEditProfileIndi!.data!.dateOfBirth ?? ''; _selectedgenderType = getEditProfileIndi!.data!.gender ?? ''; - _selectedSports = - getEditProfileIndi!.data!.interest!.map((e) => e.name!).toList(); - _selectedsportType = _selectedSports.join(', '); + // _selectedSports = + // getEditProfileIndi!.data!.interest!.map((e) => e.name!).toList(); + // _selectedsportType = _selectedSports.join(', '); + locationController.text = getEditProfileIndi!.data!.about ?? ''; + aboutController.text = getEditProfileIndi!.data!.about ?? ''; positionController.text = getEditProfileIndi!.data!.position ?? 'Lorem lpsum'; @@ -115,86 +186,90 @@ class _EditProfileState extends State { battingAvgController.text = getEditProfileIndi!.data!.battingAverage ?? '372'; + + isOnce = false; setState(() {}); } } + List interestsIds = []; + List> _interestsMap = []; + void saveEditProfileInd() async { - List selectedSportsIds = getSelectedSportsIds(); + // List selectedSportsIds = getSelectedSportsIds(); + // String interestsString = '[' + + // selectedSportsIds.join(', ') + + // ']'; + + // print("Interests String: $interestsString"); FormData? updata; - if (fullNameController.text.isBlank! || - userNameController.text.isBlank! || - dateController.text.isBlank! || - locationController.text.isBlank! || - aboutController.text.isBlank! || - positionController.text.isBlank! || - trainingScoresController.text.isBlank! || - heightController.text.isBlank! || - weightController.text.isBlank! || - battingAvgController.text.isBlank!) { - Get.snackbar( - 'Error', - 'Enter your credentials', - snackPosition: SnackPosition.BOTTOM, - backgroundColor: Colors.red, - colorText: Colors.white, - ); - } else if (profilePicture == "") { - utils.showToast('Upload edit profile picture!'); + + String abilitiesIds = selectedinterestid.toString(); + print("Interests String: $abilitiesIds"); + + updata = FormData.fromMap({ + // "email_address": "priyanka14@yopmail.com", + "full_name": fullNameController.text, + "profile_image": await convertFileToMultiPart1(profilePicture), + // "profile_image": "ghjkk.png", + + "user_name": userNameController.text, + "date_of_birth": dateController.text, + "gender": _selectedgenderType, + // "interest": "selectedSportsIds", + "interest": abilitiesIds, + "about": aboutController.text, + "position": positionController.text, + "training_scores": trainingScoresController.text, + "height": heightController.text, + "weight": weightController.text, + "batting_average": battingAvgController.text, + "address_line1": battingAvgController.text, + }); + + final data = await EditProfileApi().postEditProfileIndividual(updata); + if (data.status == ResponseStatus.SUCCESS) { + // await global.setname(); + // Get.snackbar( + // "Success!", + // 'success!', + // duration: const Duration(seconds: 2), + // colorText: Colors.white, + // backgroundColor: Colors.green, + // margin: const EdgeInsets.all(8), + // snackStyle: SnackStyle.FLOATING, + // snackPosition: SnackPosition.BOTTOM, + // ); + + Get.toNamed(RouteName.profiletab); } else { - updata = FormData.fromMap({ - "email_address": "priyanka12@yopmail.com", - "full_name": fullNameController.text, - "profile_image": await convertFileToMultiPart1(profilePicture), - // "profile_image": "ghjkk.png", + // btnController.reset(); + Get.snackbar( + "Error!", + data.data['message'], + duration: const Duration(seconds: 2), + colorText: Colors.white, + backgroundColor: Colors.red, + margin: const EdgeInsets.all(8), + snackStyle: SnackStyle.FLOATING, + snackPosition: SnackPosition.BOTTOM, + ); + // _controller.isTextFieldEnabled.value = true; + } + } - "user_name": userNameController.text, - "date_of_birth": dateController.text, - "gender": _selectedgenderType, - // "interest": "selectedSportsIds", - "interest": ["1", "2", "3"].toList(), - "about": aboutController.text, - "position": positionController.text, - "training_scores": trainingScoresController.text, - "height": heightController.text, - "weight": weightController.text, - "batting_average": battingAvgController.text, - "address_line1": battingAvgController.text, - }); - - final data = await EditProfileApi().postEditProfileIndividual(updata); - if (data.status == ResponseStatus.SUCCESS) { - // await global.setname(); - Get.snackbar( - "Success!", - 'success!', - duration: const Duration(seconds: 2), - colorText: Colors.white, - backgroundColor: Colors.green, - margin: const EdgeInsets.all(8), - snackStyle: SnackStyle.FLOATING, - snackPosition: SnackPosition.BOTTOM, - ); - Get.back(); - - // Get.toNamed(RouteName.individualgroupstep3); - Get.back(); - } else { - // btnController.reset(); - Get.snackbar( - "Error!", - data.data['message'], - duration: const Duration(seconds: 2), - colorText: Colors.white, - backgroundColor: Colors.red, - margin: const EdgeInsets.all(8), - snackStyle: SnackStyle.FLOATING, - snackPosition: SnackPosition.BOTTOM, - ); - // _controller.isTextFieldEnabled.value = true; + Future> getSelectedNames(List selectedIds) async { + List selectedNames = []; + for (int id in selectedIds) { + for (var interest in interest) { + if (interest.id == id) { + selectedNames.add(interest.name!); + break; + } } } + return selectedNames; } @override @@ -250,18 +325,47 @@ class _EditProfileState extends State { size: Size.fromRadius(50.r), child: Image.file( File(profilePicture), - // filePath[0]!, fit: BoxFit.cover, width: double.infinity, + errorBuilder: (BuildContext context, + Object exception, + StackTrace? stackTrace) { + return CircleAvatar( + backgroundImage: const AssetImage( + "assets/images/png/cimg3.png"), + radius: 50.r, + ); + }, ), ), ) - : CircleAvatar( - backgroundImage: const AssetImage( - "assets/images/png/cimg3.png", - ), - radius: 50.r, - ), + : getEditProfileIndi?.data?.profilePhoto != + null && + getEditProfileIndi! + .data!.profilePhoto!.isNotEmpty + ? Container( + width: 100.w, + height: 100.h, + decoration: ShapeDecoration( + image: DecorationImage( + image: NetworkImage( + getEditProfileIndi! + .data!.profilePhoto!, + ), + fit: BoxFit.cover, + // onError: (error, stackTrace) { + // // Fallback to default image in case of error + // return const AssetImage("assets/images/png/cimg3.png"); + // }, + ), + shape: const OvalBorder(), + ), + ) + : CircleAvatar( + backgroundImage: const AssetImage( + "assets/images/png/cimg3.png"), + radius: 50.r, + ), Positioned( bottom: 0, right: 0, @@ -424,31 +528,7 @@ class _EditProfileState extends State { ], ), sizedBoxHeight(16.h), - CustomDropDownChexkBox( - header: _selectedsportType ?? - "Rowing, Rugby, Swimming", - title: "", - listData: [ - "Rowing", - "Cycling", - "Running", - "Swimming", - "Triathlon", - "Hiking", - "Football", - "Rugby" - ], - onItemSelected: _onSportSelected, - leadingImage: Image.asset( - "assets/images/png/Vector (4).png", - width: 18.w, - height: 17.h, - ), - showOtherOption: true, - initiallySelected: _selectedSports, - ), - // CustomDropDownRadio( - // showOtherOption: true, + // CustomDropDownChexkBox( // header: _selectedsportType ?? // "Rowing, Rugby, Swimming", // title: "", @@ -468,8 +548,28 @@ class _EditProfileState extends State { // width: 18.w, // height: 17.h, // ), + // showOtherOption: true, + // initiallySelected: _selectedSports, // ), + Obx(() { + return CustomDropDownChexkBox( + header: 'Select interest', + title: "", + listData: _interestdrop, + onItemSelected: getCatIdFromName, + leadingImage: Image.asset( + "assets/images/png/Vector (4).png", + width: 18.w, + height: 17.h, + ), + // showOtherOption: true, + initiallySelected: selctedNameList, + ); + }), + + + sizedBoxHeight(20.h), text16400white("About"), sizedBoxHeight(16.h), @@ -521,7 +621,31 @@ class _EditProfileState extends State { CommonBtn( text: "Save", onTap: () { - saveEditProfileInd(); + if (fullNameController.text.isBlank! || + userNameController.text.isBlank! || + dateController.text.isBlank! || + locationController.text.isBlank! || + aboutController.text.isBlank! || + positionController.text.isBlank! || + trainingScoresController + .text.isBlank! || + heightController.text.isBlank! || + weightController.text.isBlank! || + battingAvgController.text.isBlank!) { + Get.snackbar( + 'Error', + 'Enter your credentials', + snackPosition: SnackPosition.BOTTOM, + backgroundColor: Colors.red, + colorText: Colors.white, + ); + } else if (profilePicture == "") { + utils.showToast( + 'Upload edit profile picture!'); + } else { + print(selectedinterestid.toString()); + saveEditProfileInd(); + } }, ), sizedBoxHeight(60.h), @@ -532,5 +656,361 @@ class _EditProfileState extends State { } return Container(); })); + + // FutureBuilder( + // future: myfuture, + // builder: (ctx, snapshot) { + // if (snapshot.connectionState == ConnectionState.waiting) { + // return const Center( + // child: CircularProgressIndicator( + // color: Colors.blue, + // ), + // ); + // } + + // if (snapshot.hasError) { + // return Center( + // child: Text( + // '${snapshot.error} occurred', + // style: TextStyle(fontSize: 18.spMin), + // ), + // ); + // } + + // if (snapshot.connectionState == ConnectionState.done && + // snapshot.hasData) { + // print("Data fetched-->"); + // return Stack(children: [ + // Container( + // decoration: const BoxDecoration( + // image: DecorationImage( + // image: AssetImage( + // "assets/images/png/Ellipse 1496.png"), + // fit: BoxFit.fill)), + // ), + // SingleChildScrollView( + // child: Padding( + // padding: const EdgeInsets.symmetric(horizontal: 16), + // child: Column(children: [ + // sizedBoxHeight(25.h), + // Stack( + // children: [ + // profilePicture != "" && isImageAdded + // ? ClipOval( + // child: SizedBox.fromSize( + // size: Size.fromRadius(50.r), + // child: Image.file( + // File(profilePicture), + // fit: BoxFit.cover, + // width: double.infinity, + // errorBuilder: (BuildContext context, + // Object exception, + // StackTrace? stackTrace) { + // return CircleAvatar( + // backgroundImage: const AssetImage( + // "assets/images/png/cimg3.png"), + // radius: 50.r, + // ); + // }, + // ), + // ), + // ) + // : getEditProfileIndi?.data?.profilePhoto != + // null && + // getEditProfileIndi! + // .data!.profilePhoto!.isNotEmpty + // ? Container( + // width: 100.w, + // height: 100.h, + // decoration: ShapeDecoration( + // image: DecorationImage( + // image: NetworkImage( + // getEditProfileIndi! + // .data!.profilePhoto!, + // ), + // fit: BoxFit.cover, + // // onError: (error, stackTrace) { + // // // Fallback to default image in case of error + // // return const AssetImage("assets/images/png/cimg3.png"); + // // }, + // ), + // shape: const OvalBorder(), + // ), + // ) + // : CircleAvatar( + // backgroundImage: const AssetImage( + // "assets/images/png/cimg3.png"), + // radius: 50.r, + // ), + // Positioned( + // bottom: 0, + // right: 0, + // child: InkWell( + // onTap: () { + // ImageUploadBottomSheet().showModal( + // context, + // true, + // (result) { + // var filenameresult = + // extractFileName1(result); + + // profilePicture = result; + // isImageAdded = true; + // setState(() {}); + // }, + // ); + // }, + // child: Container( + // height: 35.h, + // width: 35.w, + // decoration: const BoxDecoration( + // shape: BoxShape.circle, + // color: Color(0xFFD90B2E)), + // child: Center( + // child: Image.asset( + // "assets/images/png/cameraicon2.png", + // height: 19.h, + // width: 19.w, + // ), + // ), + // ), + // )) + // ], + // ), + // sizedBoxHeight(15.h), + // text16400white("Edit profile picture"), + // sizedBoxHeight(20.h), + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // text16400white("Full name"), + // sizedBoxHeight(16.h), + // CustomTextFormField( + // textEditingController: fullNameController, + // leadingIcon: Container( + // width: 18.w, + // height: 17.h, + // child: Center( + // child: Image.asset( + // "assets/images/png/Frame 24.png", + // width: 18.w, + // height: 17.h, + // ), + // ), + // ), + // hintText: "Edward Hackett", + // ), + // sizedBoxHeight(20.h), + // text16400white("User name"), + // sizedBoxHeight(16.h), + // CustomTextFormField( + // textEditingController: userNameController, + // leadingIcon: Container( + // width: 18.w, + // height: 17.h, + // child: Center( + // child: Image.asset( + // "assets/images/png/Frame 24.png", + // width: 18.w, + // height: 17.h, + // ), + // ), + // ), + // hintText: "edward_01", + // ), + // sizedBoxHeight(20.h), + // text16400white("Date of birth"), + // sizedBoxHeight(16.h), + // GestureDetector( + // onTap: () => + // datePicker(context, dateController), + // child: AbsorbPointer( + // child: CustomTextFormField( + // leadingIcon: Container( + // width: 18.0, + // height: 17.0, + // child: Center( + // child: Image.asset( + // "assets/images/png/calender.png", + // width: 18.0, + // height: 17.0, + // ), + // ), + // ), + // hintText: "12-04-2024", + // textEditingController: dateController, + // ), + // ), + // ), + + // sizedBoxHeight(20.h), + // text16400white("Gender"), + // sizedBoxHeight(16.h), + // CustomDropDownRadio( + // initialSelectedValue: _selectedgenderType, + // header: _selectedgenderType ?? "Male", + // title: "", + // showOtherOption: true, + // listData: [ + // "Male", + // "Female", + // "Prefer not to say" + // ], + // onItemSelected: _onItemSelected, + // leadingImage: Image.asset( + // "assets/images/png/Vector ws.png", + // width: 18.w, + // height: 17.h, + // ), + // ), + // sizedBoxHeight(25.h), + // Row( + // children: [ + // text16400white("Location"), + // sizedBoxWidth(6.w), + // Image.asset( + // "assets/images/png/octicon_question-24.png", + // height: 16.h, + // width: 16.w, + // ) + // ], + // ), + // sizedBoxHeight(16.h), + // CustomTextFormField( + // textEditingController: locationController, + // leadingIcon: Container( + // width: 18.w, + // height: 17.h, + // child: Center( + // child: Image.asset( + // "assets/images/png/Group 58645.png", + // width: 18.w, + // height: 17.h, + // ), + // ), + // ), + // hintText: "Elm street london, United Kingdom", + // ), + // sizedBoxHeight(20.h), + // Row( + // children: [ + // text16400white("Interests"), + // sizedBoxWidth(6.w), + // Image.asset( + // "assets/images/png/octicon_question-24.png", + // height: 16.h, + // width: 16.w, + // ) + // ], + // ), + // sizedBoxHeight(16.h), + // // CustomDropDownChexkBox( + // // header: _selectedsportType ?? + // // "Rowing, Rugby, Swimming", + // // title: "", + // // listData: [ + // // "Rowing", + // // "Cycling", + // // "Running", + // // "Swimming", + // // "Triathlon", + // // "Hiking", + // // "Football", + // // "Rugby" + // // ], + // // onItemSelected: _onSportSelected, + // // leadingImage: Image.asset( + // // "assets/images/png/Vector (4).png", + // // width: 18.w, + // // height: 17.h, + // // ), + // // showOtherOption: true, + // // initiallySelected: _selectedSports, + // // ), + // // CustomDropDownRadio( + // // showOtherOption: true, + // // header: _selectedsportType ?? + // // "Rowing, Rugby, Swimming", + // // title: "", + // // listData: [ + // // "Rowing", + // // "Cycling", + // // "Running", + // // "Swimming", + // // "Triathlon", + // // "Hiking", + // // "Football", + // // "Rugby" + // // ], + // // onItemSelected: _onSportSelected, + // // leadingImage: Image.asset( + // // "assets/images/png/Vector (4).png", + // // width: 18.w, + // // height: 17.h, + // // ), + // // ), + + // sizedBoxHeight(20.h), + // text16400white("About"), + // sizedBoxHeight(16.h), + // CustomTextFormField2( + // textEditingController: aboutController, + // hintText: + // "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s. Lorem Ipsum has been the industry's standard", + // maxlines: 3, + // ), + // // sizedBoxHeight(20.h), + + // text16400white("Position"), + // sizedBoxHeight(16.h), + // CustomTextFormField( + // textEditingController: positionController, + // hintText: "Lorem Ipsum", + // ), + // sizedBoxHeight(20.h), + // text16400white("Training Scores"), + // sizedBoxHeight(16.h), + // CustomTextFormField( + // textEditingController: + // trainingScoresController, + // hintText: "50", + // ), + // sizedBoxHeight(20.h), + // text16400white("Height"), + // sizedBoxHeight(16.h), + // CustomTextFormField( + // textEditingController: heightController, + // hintText: "6 feet", + // ), + // sizedBoxHeight(20.h), + // text16400white("Weight"), + // sizedBoxHeight(16.h), + // CustomTextFormField( + // textEditingController: weightController, + // hintText: "70kg", + // ), + // sizedBoxHeight(20.h), + // text16400white("Batting Average"), + // sizedBoxHeight(16.h), + // CustomTextFormField( + // textEditingController: battingAvgController, + // hintText: "372", + // ), + // sizedBoxHeight(20.h), + // sizedBoxHeight(60.h), + // CommonBtn( + // text: "Save", + // onTap: () { + // saveEditProfileInd(); + // }, + // ), + // sizedBoxHeight(60.h), + // ], + // ) + // ]))) + // ]); + // } + // return Container(); + // })); } } diff --git a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/ViewModel/EditProfileApi.dart b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/ViewModel/EditProfileApi.dart index 6aec043..8273645 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/ViewModel/EditProfileApi.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/ViewModel/EditProfileApi.dart @@ -35,13 +35,35 @@ class EditProfileApi { getEditProfileIndi = GetEditProfileIndi.fromJson(response.data); if (response.status == ResponseStatus.SUCCESS) { if (response.data["status"] == "success") { - print("Success---->"); if (getEditProfileIndi!.data!.accountVisibility == 1) { accountvisibility = true; } else { accountvisibility = false; } print(accountvisibility.toString()); + // await fetchInterestlist().then((value) { + // String interestsXids = + // getEditProfileIndi!.data!.interest!.map((e) => e.id!).join(','); + // interestsIds = interestsXids + // .split(',') + // .map((e) => int.tryParse(e.trim()) ?? 0) + // .toList(); + // selectedinterestid = interestsIds; + + // print(selectedinterestid.toList()); + + // for (int i = 0; i < interest.length; i++) { + // _interestsMap.add({ + // "id": interest[i].id!, + // "name": interest[i].name!, + // }); + // } + // getSelectedNames(selectedinterestid).then((value) { + // setState(() { + // selctedNameList = value; + // }); + // }); + // }); return ResponseData( response.data['message'], ResponseStatus.SUCCESS, data: response.data); @@ -54,6 +76,7 @@ class EditProfileApi { return response; } + Future> postEditProfileBusiness(var data) async { SharedPreferences prefs = await SharedPreferences.getInstance(); final response = await NetworkApiServices() diff --git a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/ViewModel/InterestApiList.dart b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/ViewModel/InterestApiList.dart new file mode 100644 index 0000000..b93c3c3 --- /dev/null +++ b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/ViewModel/InterestApiList.dart @@ -0,0 +1,29 @@ +import 'package:regroup/Common/api_urls.dart'; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Common/controller/data/network/network_api.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/EditProfile/Model/InterestModel.dart'; + +class InterestListApi { + InterestListApi(); + var data = ""; + Future> getinterestlistApi() async { + final response = await NetworkApiServices().getApi( + ApiUrls.getinterestlist, + + ); + + if (response.status == ResponseStatus.SUCCESS) { + Map responseData = + Map.from(response.data); + if (responseData['status'] == "success") { + print("success"); + InterestModel interestlistobj = + InterestModel.fromJson(responseData); + } else { + // return ResponseData( + // responseData['message'], ResponseStatus.FAILED); + } + } + return response; + } +} diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Followers/Followers.dart b/lib/Feed Module/Main_Screens/ProfileTab/Followers/Followers.dart index d2910c5..8117225 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/Followers/Followers.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/Followers/Followers.dart @@ -119,8 +119,7 @@ class _FollowersState extends State { AssetImage("assets/images/png/Ellipse 1496.png"), fit: BoxFit.fill)), ), - SingleChildScrollView( - child: Column(children: [ + Column(children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -448,7 +447,7 @@ class _FollowersState extends State { }, ), ]) - ])) + ]) ]) : Stack(children: [ Container( @@ -458,8 +457,7 @@ class _FollowersState extends State { AssetImage("assets/images/png/Ellipse 1496.png"), fit: BoxFit.fill)), ), - SingleChildScrollView( - child: Column(children: [ + Column(children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -501,8 +499,10 @@ class _FollowersState extends State { if (snapshot.connectionState == ConnectionState.waiting) { // Display shimmer effect while waiting for data - return const Center( - child: CircularProgressIndicator()); + return Expanded( + child: const Center( + child: CircularProgressIndicator()), + ); } else if (snapshot.hasError) { // Handle error state return Center( @@ -762,7 +762,7 @@ class _FollowersState extends State { }, ), ]) - ])) + ]) ])); } 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 5559c40..de01d99 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 @@ -45,13 +45,14 @@ class _profiletabBusGestState extends State { future: guestBusfuture, builder: (ctx, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { - return ShimmerCommon(); + return + // ShimmerCommon(); - // Center( - // child: CircularProgressIndicator( - // color: Colors.blue, - // ), - // ); + Center( + child: CircularProgressIndicator( + color: Colors.blue, + ), + ); } if (snapshot.hasError) { 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 e25a73c..28d1731 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/My Network/MyNetwork.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/My Network/MyNetwork.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -177,308 +178,262 @@ class _FollowersTabState extends State { @override Widget build(BuildContext context) { - return ListView( - scrollDirection: Axis.vertical, - physics: const ScrollPhysics(), - children: [ - 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, - ), - ), - ), - texttype: TextInputType.text, - inputFormatters: [ - RemoveEmojiInputFormatter(), - ], - onInput: (value) { - Profilegetmethod().getFollowers(value, - streamController: searchcontroller); - }, - hintText: "Search people", + return + // ListView( + // scrollDirection: Axis.vertical, + // physics: const ScrollPhysics(), + // children: [ + 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, ), ), - 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 followersobj!.data!.isEmpty - ? _buildNoDataBody(context) - : 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( + ), + texttype: TextInputType.text, + inputFormatters: [ + RemoveEmojiInputFormatter(), + ], + onInput: (value) { + Profilegetmethod() + .getFollowers(value, streamController: searchcontroller); + }, + hintText: "Search people", + ), + ), + sizedBoxHeight(20.h), + StreamBuilder( + stream: searchcontroller.stream, + builder: (ctx, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + // Display shimmer effect while waiting for data + return 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 followersobj!.data!.isEmpty + ? _buildNoDataBody(context) + : 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: [ - 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!) - ], + 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, ), - 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, + 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, + ), + ), + )), ], ), - ); - }, - ); - } - }, - ), - ], - ), - ]); - } - - Widget _buildNoDataBody(context) { - return Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - "No Data Found", - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w600), - ) - ], - ), + ) + ], + ), + ); + }, + ); + } + }, + ), + ], ); } } @@ -567,283 +522,274 @@ class _FollowingTabState extends State { @override Widget build(BuildContext context) { - return ListView( - physics: const ScrollPhysics(), - scrollDirection: Axis.vertical, - children: [ - 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; - }, - ), + return + // ListView( + // physics: const ScrollPhysics(), + // scrollDirection: Axis.vertical, + // children: [ + 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, ), - 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: [ - 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, - ), - 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, - ), - ), - )), - ], - ), - ), - ], - ), - ); - }, - ); - } - }, - ), - ], + ), ), - ]); + 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 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: [ + 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, + ), + 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, + ), + ), + )), + ], + ), + ), + ], + ), + ); + }, + ); + } + }, + ), + ]); } - Widget _buildNoDataBody(context) { - return Expanded( + // Widget _buildNoDataBody(context) { + // return Expanded( + // child: Center( + // child: Column( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // Text( + // "No Data Found", + // style: TextStyle( + // color: Colors.white, + // fontSize: 16.sp, + // fontWeight: FontWeight.w600), + // ) + // ], + // ), + // ), + // ); + // } +} + +Widget _buildNoDataBody(context) { + return Expanded( + child: Padding( + padding: EdgeInsets.only(bottom: 40.h), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -857,6 +803,6 @@ class _FollowingTabState extends State { ) ], ), - ); - } + ), + ); } diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Settings/ContactUs.dart b/lib/Feed Module/Main_Screens/ProfileTab/Settings/ContactUs.dart index 616ef33..1e0dc27 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/Settings/ContactUs.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/Settings/ContactUs.dart @@ -190,9 +190,9 @@ class _ContactUsState extends State { onPressed: () { // final isValid = // _formkey.currentState?.validate(); - if (fullname.text.isBlank! && - email.text.isBlank! && - querycontroller.text.isBlank! && + if (fullname.text.isBlank! || + email.text.isBlank! || + querycontroller.text.isBlank! || _selectedreasontocontact.isEmpty) { utils.showToast("Please fill all fields"); } else { diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Settings/DeleteAccount.dart b/lib/Feed Module/Main_Screens/ProfileTab/Settings/DeleteAccount.dart index de96830..7d453cf 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/Settings/DeleteAccount.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/Settings/DeleteAccount.dart @@ -115,7 +115,12 @@ class _DeleteAccountState extends State { textEditingController: leavingcontroller, ), sizedBoxHeight(20.h), - CommonBtn(text: "I don’t want to delete"), + CommonBtn( + text: "I don’t want to delete", + onTap: () { + Get.toNamed(RouteName.mainscreen); + }, + ), sizedBoxHeight(18.h), GestureDetector( onTap: () { diff --git a/lib/Utils/Common/CommonDropdown.dart b/lib/Utils/Common/CommonDropdown.dart index 18e8c47..ca4ba3f 100644 --- a/lib/Utils/Common/CommonDropdown.dart +++ b/lib/Utils/Common/CommonDropdown.dart @@ -752,6 +752,7 @@ class _CustomDropDownRadioState extends State { } } + class CustomDropDownChexkBox extends StatefulWidget { const CustomDropDownChexkBox({ Key? key,