diff --git a/lib/Common/api_urls.dart b/lib/Common/api_urls.dart index dfb6276..73385c8 100644 --- a/lib/Common/api_urls.dart +++ b/lib/Common/api_urls.dart @@ -75,6 +75,14 @@ class ApiUrls { static const postremovetimeline = "${baseUrl}delete-timeline"; + static const postremovecertification = "${baseUrl}delete-certification"; + + static const postcertification = "${baseUrl}store-certification"; + + static const getaccountsessions = "${baseUrl}get-account-session"; + + static const postuserdevice = "${baseUrl}store-account-session"; + diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Certificate/AddCertificate.dart b/lib/Feed Module/Main_Screens/ProfileTab/Certificate/AddCertificate.dart new file mode 100644 index 0000000..b7c02ec --- /dev/null +++ b/lib/Feed Module/Main_Screens/ProfileTab/Certificate/AddCertificate.dart @@ -0,0 +1,398 @@ +import 'dart:io'; + +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart' hide MultipartFile, FormData; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/view_model/profilePostmethod.dart'; +import 'package:regroup/Utils/Common/CommonAppbar.dart'; +import 'package:regroup/Utils/Common/CustomNextButton.dart'; +import 'package:regroup/Utils/Common/CustomTextformfield.dart'; +import 'package:regroup/Utils/Common/ImageUpload.dart'; +import 'package:regroup/Utils/Common/sized_box.dart'; +import 'package:regroup/Utils/dialogs.dart'; +import 'package:regroup/Utils/texts.dart'; +import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart'; +import 'package:path/path.dart' as path; + +class AddCertificate extends StatefulWidget { + const AddCertificate({super.key}); + + @override + State createState() => _AddCertificateState(); +} + +class _AddCertificateState extends State { + final GlobalKey _formkey = GlobalKey(); + TextEditingController certicationname = TextEditingController(); + TextEditingController certificationreason = TextEditingController(); + TextEditingController datecontroller = TextEditingController(); + + TextEditingController querycontroller = TextEditingController(); + + DateTime? _selectedDate; + + Future _selectDate(BuildContext context) async { + DateTime yesterday = DateTime.now().subtract(const Duration(days: 1)); + DateTime eighteenYearsAgo = + DateTime.now().subtract(const Duration(days: 365 * 18)); + + final ThemeData customTheme = Theme.of(context).copyWith( + colorScheme: const ColorScheme.light( + primary: Color(0xFFD90B2E), + surfaceTint: Color(0xFF222935), + surface: Color(0xFF222935), + onPrimary: Colors.white, + onSurface: Colors.white, + onSecondary: Colors.white), + textButtonTheme: TextButtonThemeData( + style: TextButton.styleFrom( + foregroundColor: const Color(0xFFD90B2E), + ), + )); + + final DateTime? pickedDate = await showDatePicker( + context: context, + initialDate: yesterday, + firstDate: DateTime(1950), + lastDate: DateTime(2026), + builder: (BuildContext context, Widget? child) { + return Theme( + data: customTheme, + // ThemeData.light().copyWith( + // colorScheme: ColorScheme.dark( + // primary: Color(0XFF222935).withOpacity(0.60), + // onPrimary: Colors.white, // Change text color + // ), + // textButtonTheme: TextButtonThemeData( + // style: TextButton.styleFrom( + // foregroundColor: Colors.white, // Change button text color + // ), + // ), + // dialogBackgroundColor: Color(0XFF222935) + // .withOpacity(0.60), // Change dialog background color + // ), + child: child!, + ); + }, + ); + + if (pickedDate != null) { + // if (pickedDate.isBefore(eighteenYearsAgo)) { + setState(() { + _selectedDate = pickedDate; + datecontroller.text = + "${_selectedDate!.year.toString().padLeft(2, '0')}-${_selectedDate!.month.toString().padLeft(2, '0')}-${_selectedDate!.day.toString().padLeft(2, '0')}"; + }); + // } + } + } + + List filePath = []; + bool isImageAdded = false; + + UploadData() async { + utils.loader(); + List certificatelist = []; + + for (var file in filePath.where((file) => file != null)) { + certificatelist.add( + await MultipartFile.fromFile( + file!.path, + filename: path.basename(file.path), + ), + ); + } + FormData formdata = FormData.fromMap({ + "certification_name": certicationname.text, + "certification_reason": certificationreason.text, + "certification_date": datecontroller.text, + "certification_image": certificatelist[0], + }); + final data = await Profilepostmethod().postCertification(formdata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + Get.back(); + return utils.showToast(data.message); + } else { + Get.back(); + return utils.showToast(data.message); + } + } + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () => FocusManager.instance.primaryFocus?.unfocus(), + child: Scaffold( + // key: _scaffoldKey1, + backgroundColor: Color(0xFF222935), + extendBody: true, + appBar: CommonAppbar( + titleTxt: "Add certifications", + ), + body: Stack(children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: SingleChildScrollView( + child: Form( + key: _formkey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + sizedBoxHeight(20.h), + text16400white("Certification name"), + sizedBoxHeight(16.h), + CustomTextFormField( + leadingIcon: Container( + height: 17.h, + width: 18.w, + child: Center( + child: Image.asset( + "assets/images/png/Frame 24.png", + height: 17.h, + width: 18.w, + fit: BoxFit.cover, + ), + ), + ), + validator: (value) { + if (value!.isEmpty) { + return 'Enter your certification name '; + } + return null; + }, + inputFormatters: [ + // LengthLimitingTextInputFormatter(20), + RemoveEmojiInputFormatter(), + FilteringTextInputFormatter.allow( + RegExp('[a-zA-Z ]')) + ], + hintText: "Enter certification name", + textEditingController: certicationname, + ), + sizedBoxHeight(10.h), + text16400white("Certification reason"), + sizedBoxHeight(16.h), + CustomTextFormField( + leadingIcon: Container( + height: 17.h, + width: 18.w, + child: Center( + child: Image.asset( + "assets/images/png/Frame 24.png", + height: 17.h, + width: 18.w, + fit: BoxFit.cover, + ), + ), + ), + validator: (value) { + if (value!.isEmpty) { + return 'Enter your certification reason '; + } + return null; + }, + inputFormatters: [ + // LengthLimitingTextInputFormatter(20), + RemoveEmojiInputFormatter(), + FilteringTextInputFormatter.allow( + RegExp('[a-zA-Z ]')) + ], + hintText: "Enter certification reason", + textEditingController: certificationreason, + ), + sizedBoxHeight(10.h), + text16400white("Certification date"), + sizedBoxHeight(16.h), + CustomTextFormField( + textEditingController: datecontroller, + readonly: true, + onTap: () { + _selectDate(context); + }, + // texttype: TextInputType.text, + hintText: "Enter your certification date", + leadingIcon: + // const Icon(Icons.mail_outline), + Image.asset( + width: 22.w, + height: 17.h, + 'assets/images/png/dateimage.png', + ), + // validatorText: "Enter date of birth", + validator: (value) { + if (value!.isEmpty) { + return 'Enter your certification date'; + } + return null; + }, + ), + sizedBoxHeight(10.h), + text16400white("Certification image"), + sizedBoxHeight(16.h), + filePath.isNotEmpty && isImageAdded + ? Container( + height: 167.h, + width: double.infinity, + decoration: ShapeDecoration( + gradient: LinearGradient( + begin: Alignment(0.98, -0.21), + end: Alignment(-0.98, 0.21), + colors: [ + Colors.white + .withOpacity(0.30000001192092896), + Colors.white + .withOpacity(0.2800000011920929) + ], + ), + shape: RoundedRectangleBorder( + side: BorderSide( + width: 0.50, + color: Color(0xFF7E7E7E)), + borderRadius: BorderRadius.circular(10), + ), + ), + child: Stack(children: [ + Image.file( + filePath[0]!, + fit: BoxFit.cover, + width: double.infinity, + ), + Positioned( + // top: 0, + // left: 0, + right: 12, + bottom: 12, + child: GestureDetector( + onTap: () { + // Clear the list and show the upload button + filePath.clear(); + isImageAdded = false; + setState(() {}); + }, + child: Container( + width: 27, + height: 27, + decoration: ShapeDecoration( + color: Colors.black, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular( + 5)), + ), + child: Icon( + Icons.delete_outline_outlined, + color: Colors.white, + ))), + ), + // ), + ]), + ) + : GestureDetector( + // onTap: () { + // ImageUploadBottomSheet().showModal( + // context, + // false, + // (result) { + // var file = File(result); + // filePath.add(file); + // // isImageAdded = true; + // setState(() { + // isImageAdded = true; + + // }); + // }, + // ); + // }, + onTap: () { + ImageUploadBottomSheet().showModal( + context, + false, + (result) { + var file = File(result); + + filePath.add(file); + isImageAdded = true; + setState(() { + // Navigator.of(context).pop(); + Get.back(); + }); + }, + ); + }, + child: Container( + width: double.infinity, + height: 167, + decoration: ShapeDecoration( + gradient: LinearGradient( + begin: Alignment(0.98, -0.21), + end: Alignment(-0.98, 0.21), + colors: [ + Colors.white + .withOpacity(0.30000001192092896), + Colors.white + .withOpacity(0.2800000011920929) + ], + ), + shape: RoundedRectangleBorder( + side: BorderSide( + width: 0.50, + color: Color(0xFF7E7E7E)), + borderRadius: BorderRadius.circular(10), + ), + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Image.asset( + 'assets/images/png/onlycamera.png'), + sizedBoxHeight(5.h), + Text( + 'Upload certification \nimage', + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontFamily: 'Poppins', + fontWeight: FontWeight.w400, + ), + ), + ], + ), + ), + ), + sizedBoxHeight(50.h), + CustomButton( + onPressed: () { + // final isValid = + // _formkey.currentState?.validate(); + if (certicationname.text.isBlank! && + certificationreason.text.isBlank! && + datecontroller.text.isBlank! && + filePath.isEmpty) { + utils.showToast("Please fill all fields"); + } else { + UploadData(); + } + }, + text: "Send") + ]), + ), + )) + ])), + ); + } +} diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Certificate/Certificate.dart b/lib/Feed Module/Main_Screens/ProfileTab/Certificate/Certificate.dart index 7a7a94f..370bcb3 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/Certificate/Certificate.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/Certificate/Certificate.dart @@ -1,9 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:regroup/Common/CommonGlassmorphism.dart'; -import 'package:regroup/Common/CommonWidget.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/EditProfile/ViewModel/EditProfileApi.dart'; import 'package:regroup/Utils/Common/CommonAppbar.dart'; -import 'package:regroup/Utils/Common/blureffect.dart'; import 'package:regroup/Utils/Common/sized_box.dart'; import 'package:regroup/Utils/texts.dart'; @@ -45,57 +43,143 @@ class _CertificateState extends State { @override Widget build(BuildContext context) { return Scaffold( - // key: _scaffoldKey1, - backgroundColor: Color(0xFF222935), - extendBody: true, - appBar: CommonAppbar( - titleTxt: "Certifications/Qualifications", - ), - resizeToAvoidBottomInset: false, - body: 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), - Container( - height: 600.h, - child: GridView.builder( - scrollDirection: Axis.vertical, - gridDelegate: - const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, - mainAxisSpacing: 20, - crossAxisSpacing: 8, - childAspectRatio: 0.65, + // key: _scaffoldKey1, + backgroundColor: Color(0xFF222935), + extendBody: true, + appBar: CommonAppbar( + titleTxt: "Certifications/Qualifications", + ), + resizeToAvoidBottomInset: false, + body: FutureBuilder( + future: EditProfileApi().getEditProfileIndividual(), + builder: (ctx, snapshot) { + if (snapshot.data == null) { + return const Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: CircularProgressIndicator( + color: Color(0xFFC18948), + ), + ) + ], + ); + } + if (snapshot.connectionState == ConnectionState.done) { + if (snapshot.hasError) { + return Center( + child: Text( + '${snapshot.error} occured', + style: TextStyle(fontSize: 18.spMin), + ), + ); + } + } + return getEditProfileIndi!.data!.certifications!.isEmpty + ? _buildNoDataBody(context) + : _buildBody(context); + }, + ), + ); + } + + Widget _buildNoDataBody(context) { + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "No Data Found", + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ) + ], + ), + ); + } + + Widget _buildBody(context) { + 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), + Container( + height: 600.h, + child: GridView.builder( + scrollDirection: Axis.vertical, + gridDelegate: + const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + mainAxisSpacing: 20, + crossAxisSpacing: 8, + childAspectRatio: 0.65, + ), + itemCount: + getEditProfileIndi!.data!.certifications!.length, + itemBuilder: (context, index) { + return Column( + // mainAxisAlignment: MainAxisAlignment.start, + children: [ + getEditProfileIndi!.data!.certifications![index] + .certificationImage == + null || + getEditProfileIndi! + .data! + .certifications![index] + .certificationImage! + .isEmpty + ? Image.asset( + CertificateData[index]["imagePath"], + height: 100.h, + width: 105.w, + ) + : Image.network( + getEditProfileIndi! + .data! + .certifications![index] + .certificationImage!, + height: 100.h, + width: 105.w, + ), + Expanded( + child: Center( + child: text14w400_FCFCFC( + getEditProfileIndi! + .data! + .certifications![index] + .certificationName == + null || + getEditProfileIndi! + .data! + .certifications![index] + .certificationName! + .isEmpty + ? CertificateData[index]["text"] + : getEditProfileIndi! + .data! + .certifications![index] + .certificationName, + textAlign: TextAlign.center, + ), ), - itemCount: CertificateData.length, - itemBuilder: (context, index) { - return Column( - children: [ - Image.asset( - CertificateData[index]["imagePath"], - height: 100.h, - width: 105.w, - ), - Expanded( - child: Center( - child: text14w400_FCFCFC( - CertificateData[index]["text"], - textAlign: TextAlign.center, - ), - ), - ), - ], - ); - }), - ) - ]))) - ])); + ), + ], + ); + }), + ) + ]))) + ]); } } diff --git a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/Model/GetEditProfileIndi.dart b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/Model/GetEditProfileIndi.dart index 2422a2a..339e49d 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/Model/GetEditProfileIndi.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/Model/GetEditProfileIndi.dart @@ -29,7 +29,8 @@ class Data { int? id; String? userName; String? fullName; - String? profileImage; + // String? profileImage; + String? profilePhoto; String? gender; String? dateOfBirth; List? interest; @@ -43,13 +44,16 @@ class Data { List? timelines; int? accountVisibility; List? myJoinedSubgroups; + List? certifications; + int? daysBeforeJoined; Data( {this.id, this.userName, this.fullName, - this.profileImage, + // this.profileImage, + this.profilePhoto, this.gender, this.dateOfBirth, this.interest, @@ -62,14 +66,17 @@ class Data { this.follows, this.timelines, this.accountVisibility, - this.myJoinedSubgroups + this.myJoinedSubgroups, + this.certifications, + this.daysBeforeJoined }); Data.fromJson(Map json) { id = json['id']; userName = json['user_name']; fullName = json['full_name']; - profileImage = json['profile_image']; + // profileImage = json['profile_image']; + profilePhoto = json['profile_photo']; gender = json['gender']; dateOfBirth = json['date_of_birth']; if (json['interest'] != null) { @@ -99,6 +106,13 @@ class Data { 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() { @@ -106,7 +120,8 @@ class Data { data['id'] = this.id; data['user_name'] = this.userName; data['full_name'] = this.fullName; - data['profile_image'] = this.profileImage; + // data['profile_image'] = this.profileImage; + data['profile_photo'] = this.profilePhoto; data['gender'] = this.gender; data['date_of_birth'] = this.dateOfBirth; if (this.interest != null) { @@ -129,6 +144,11 @@ class Data { 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; } } @@ -300,3 +320,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/EditProfile/View/ProfileTab.dart b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/ProfileTab.dart index 8f3ca26..a0d16c9 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/ProfileTab.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/ProfileTab.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; import 'package:flutter_reaction_button/flutter_reaction_button.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -7,6 +8,7 @@ import 'package:regroup/Common/CommonGlassmorphism.dart'; import 'package:regroup/Common/CommonWidget.dart'; import 'package:regroup/Common/base_manager.dart'; import 'package:regroup/Common/controller/MainScreen.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/EditProfile/Model/GetEditProfileIndi.dart'; import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/EditProfile/ViewModel/EditProfileApi.dart'; import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/view_model/profilePostmethod.dart'; @@ -152,6 +154,8 @@ class _ProfileTabState extends State { int? timelineremoveid; + int? certificationsremoveid; + RemoveTimelineUploadata() async { utils.loader(); Map updata = { @@ -169,6 +173,23 @@ class _ProfileTabState extends State { } } + RemoveCertificationUploadata() async { + utils.loader(); + Map updata = { + "certification_id": certificationsremoveid, + }; + final data = await Profilepostmethod().postRemoveCertification(updata); + if (data.status == ResponseStatus.SUCCESS) { + Get.back(); + print("block done"); + return utils.showToast(data.message); + } else { + Get.back(); + print("block not done"); + return utils.showToast(data.message); + } + } + @override Widget build(BuildContext context) { return Scaffold( @@ -267,13 +288,13 @@ class _ProfileTabState extends State { '@${getEditProfileIndi!.data!.userName}' ?? "@edward_01"), sizedBoxWidth(5.w), - Icon( - Icons.circle, - size: 5.sp, - color: Colors.white, - ), - sizedBoxWidth(5.w), - text18w400white("2,124 days") + // Icon( + // Icons.circle, + // size: 5.sp, + // color: Colors.white, + // ), + // sizedBoxWidth(5.w), + // text18w400white("2,124 days") ], ), sizedBoxHeight(15.h), @@ -450,15 +471,15 @@ class _ProfileTabState extends State { getEditProfileIndi!.data! .timelines![index]; - List> - abilities = - timeline.abilities! - .map((ability) => { - 'id': ability.id, - 'name': - ability.name, - }) - .toList(); + // List> + // abilities = + // timeline.abilities! + // .map((ability) => { + // 'id': ability.id, + // 'name': + // ability.name, + // }) + // .toList(); return // commonTimelineCard( // imagePath: getEditProfileIndi @@ -552,9 +573,9 @@ class _ProfileTabState extends State { children: [ Row( children: [ - getEditProfileIndi?.data?.profileImage == null || getEditProfileIndi!.data!.profileImage!.isEmpty + getEditProfileIndi?.data?.profilePhoto == null || getEditProfileIndi!.data!.profilePhoto!.isEmpty ? CircleAvatar(radius: 10.r, backgroundImage: AssetImage('assets/images/png/cimg1.png')) - : CircleAvatar(radius: 10.r, backgroundImage: NetworkImage(getEditProfileIndi!.data!.profileImage!)), + : CircleAvatar(radius: 10.r, backgroundImage: NetworkImage(getEditProfileIndi!.data!.profilePhoto!)), sizedBoxWidth( 8.w), getEditProfileIndi!.data!.timelines![index].clubName == null || getEditProfileIndi!.data!.timelines![index].clubName!.isEmpty @@ -562,42 +583,59 @@ class _ProfileTabState extends State { : text14700white(getEditProfileIndi!.data!.timelines![index].clubName!) ], ), - InkWell( - onTap: - () { - // setState( - // () { - // timelineremoveid = - // getEditProfileIndi!.data!.timelines![index].id ?? 0; - // getEditProfileIndi!.data!.timelines!.removeWhere((item) => - // item.id! == - // timelineremoveid); - // // .removeAt(index); - // RemoveTimelineUploadata(); - // }); + Row( + children: [ + InkWell( + onTap: + () { + setState(() { + timelineremoveid = getEditProfileIndi!.data!.timelines![index].id ?? 0; + getEditProfileIndi!.data!.timelines!.removeWhere((item) => item.id! == timelineremoveid); + // .removeAt(index); + RemoveTimelineUploadata(); + }); + }, + child: SizedBox( + width: 20.w, + height: 20.h, + child: Icon( + Icons.delete, + color: Colors.white, + )), + ), + sizedBoxWidth( + 10.w), + InkWell( + onTap: + () { + // setState( + // () { + // timelineremoveid = + // getEditProfileIndi!.data!.timelines![index].id ?? 0; + // getEditProfileIndi!.data!.timelines!.removeWhere((item) => + // item.id! == + // timelineremoveid); + // // .removeAt(index); + // RemoveTimelineUploadata(); + // }); - Get.toNamed( - RouteName.addtimeline, - arguments: { + Get.toNamed(RouteName.addtimeline, arguments: { 'id': getEditProfileIndi!.data!.timelines![index].id, 'edit': true, }); - }, - child: - SizedBox( - width: - 20.w, - height: - 20.h, - child: - Image.asset( - "assets/images/png/iconamoon_edit-thin.png", - height: - 14.h, - width: - 14.w, - ), - ), + }, + child: + SizedBox( + width: 20.w, + height: 20.h, + child: Image.asset( + "assets/images/png/iconamoon_edit-thin.png", + height: 14.h, + width: 14.w, + ), + ), + ) + ], ) ], ), @@ -645,23 +683,51 @@ class _ProfileTabState extends State { startToEnd), sizedBoxHeight( 10.h), - abilities - .isEmpty + getEditProfileIndi!.data!.timelines![index].abilities == + null || + getEditProfileIndi! + .data! + .timelines![ + index] + .abilities! + .isEmpty ? text10400whiteblur( 'No data') : - // ListView.builder( - // shrinkWrap: true, - // scrollDirection: Axis.horizontal, - // padding: EdgeInsets.only(left: 16.w), - // itemCount: abilities.length, - // itemBuilder: (context, index) { - // return - // text10400whiteblur(abilities.toString()); - // }, - // ), + // Container( + // height: + // 30.h, // Adjust the height as needed + // child: + // ListView.builder( + // shrinkWrap: + // true, + // scrollDirection: + // Axis.horizontal, + // itemCount: + // getEditProfileIndi!.data!.timelines![index].abilities!.length, + // itemBuilder: + // (context, index) { + // String abilityName = getEditProfileIndi!.data!.timelines![index].abilities![index].name!; + // // String abilitiesString = abilities.map((ability) => ability['name']).join(', '); + // return Padding( + // padding: EdgeInsets.only(right: 8.w), + // child: text10400whiteblur(abilityName), + // ); + // // if (index < abilities.length) { + // // // String abilityName = abilities[index]['name']; + // // String abilitiesString = abilities.map((ability) => ability['name']).join(', '); + // // return Padding( + // // padding: EdgeInsets.only(right: 8.w), + // // child: text10400whiteblur(abilitiesString), + // // ); + // // } else { + // // return SizedBox(); + // // } + // }, + // ), + // ), Container( height: 30.h, // Adjust the height as needed @@ -672,18 +738,14 @@ class _ProfileTabState extends State { scrollDirection: Axis.horizontal, itemCount: - abilities.length, + getEditProfileIndi!.data!.timelines![index].abilities!.length, itemBuilder: - (context, index) { - if (index < abilities.length) { - String abilityName = abilities[index]['name']; - return Padding( - padding: EdgeInsets.only(right: 8.w), - child: text10400whiteblur(abilityName), - ); - } else { - return SizedBox(); - } + (context, innerIndex) { + List abilityName = getEditProfileIndi!.data!.timelines![index].abilities![innerIndex].name!.split('pattern'); + return Padding( + padding: EdgeInsets.only(right: 8.w), + child: text10400whiteblur(abilityName.toString()), + ); }, ), ), @@ -702,6 +764,211 @@ class _ProfileTabState extends State { sizedBoxHeight(30.h), ]), ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + text18w700white( + "Certifications/Qualifications"), + Spacer(), + InkWell( + onTap: () { + Get.toNamed( + RouteName.certificate, + ); + }, + child: text16400white('View more')) + ], + ), + sizedBoxHeight(20.h), + getEditProfileIndi! + .data!.certifications!.isEmpty + ? Center( + child: text16400white( + "No certificates added")) + : SizedBox( + height: 100.h, + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.horizontal, + // padding: + // EdgeInsets.only(left: 16.w), + physics: ScrollPhysics(), + itemCount: getEditProfileIndi! + .data!.certifications!.length, + itemBuilder: (context, index) { + return Row( + children: [ + commonGlassUI( + width: 266.w, + height: 70.h, + borderRadius: + BorderRadius + .circular(10.r), + customWidget: Padding( + padding: EdgeInsets + .symmetric( + horizontal: + 16.w, + vertical: + 5.h), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .start, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + getEditProfileIndi! + .data! + .certifications![ + index] + .certificationImage == + null || + getEditProfileIndi! + .data! + .certifications![ + index] + .certificationImage! + .isEmpty + ? Image.asset( + 'assets/images/png/image 17.png', + width: + 57.w, + height: + 40.h, + ) + : Image + .network( + getEditProfileIndi! + .data! + .certifications![ + index] + .certificationImage!, + width: + 77.w, + height: + 100.h, + ), + sizedBoxWidth( + 20.w), + Column( + crossAxisAlignment: + CrossAxisAlignment + .center, + mainAxisAlignment: + MainAxisAlignment + .center, + children: [ + getEditProfileIndi!.data!.certifications![index].certificationName == + null || + getEditProfileIndi! + .data! + .certifications![ + index] + .certificationName! + .isEmpty + ? text12400white( + 'Regroup') + : text12400white(getEditProfileIndi! + .data! + .certifications![ + index] + .certificationName!), + sizedBoxHeight( + 4.h), + getEditProfileIndi!.data!.certifications![index].certificationReason == + null || + getEditProfileIndi! + .data! + .certifications![ + index] + .certificationReason! + .isEmpty + ? text9400white( + 'Regroup') + : text9400white(getEditProfileIndi! + .data! + .certifications![ + index] + .certificationName!), + sizedBoxHeight( + 4.h), + getEditProfileIndi!.data!.certifications![index].certificationDate == + null || + getEditProfileIndi! + .data! + .certifications![index] + .certificationDate! + .isEmpty + ? Text( + 'Regroup', + style: TextStyle( + fontSize: 9.sp, + fontWeight: FontWeight.w400, + color: Color(0xffFFFFFF).withOpacity(0.70), + fontFamily: 'Helvetica'), + ) + : Text( + 'Issued ${DateFormat('MMM yyyy').format(DateTime.parse(getEditProfileIndi!.data!.certifications![index].certificationDate!))}', + style: TextStyle( + fontSize: 9.sp, + fontWeight: FontWeight.w400, + color: Color(0xffFFFFFF).withOpacity(0.70), + fontFamily: 'Helvetica'), + ) + ], + ), + const Spacer(), + InkWell( + onTap: () { + setState( + () { + certificationsremoveid = + getEditProfileIndi!.data!.certifications![index].id ?? + 0; + getEditProfileIndi! + .data! + .certifications! + .removeWhere((item) => + item.id! == + certificationsremoveid); + // .removeAt(index); + RemoveCertificationUploadata(); + }); + }, + child: Icon( + Icons + .delete, + color: Colors + .white, + )) + ], + ), + )), + sizedBoxWidth(20.w), + ], + ); + }, + )), + sizedBoxHeight(10.h), + InkWell( + onTap: () { + Get.toNamed( + RouteName.addcertificate, + ); + }, + child: Align( + alignment: Alignment.centerRight, + child: text16400white( + 'Add certificate'))), + sizedBoxHeight(10.h), + ]), + ), Padding( padding: EdgeInsets.symmetric(horizontal: 16.w), child: Row( diff --git a/lib/Feed Module/Main_Screens/ProfileTab/Model/accountSessionModel.dart b/lib/Feed Module/Main_Screens/ProfileTab/Model/accountSessionModel.dart new file mode 100644 index 0000000..0714af3 --- /dev/null +++ b/lib/Feed Module/Main_Screens/ProfileTab/Model/accountSessionModel.dart @@ -0,0 +1,89 @@ +class GetAccountSessionsModel { + String? status; + int? statusCode; + String? message; + List? data; + + GetAccountSessionsModel( + {this.status, this.statusCode, this.message, this.data}); + + GetAccountSessionsModel.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? deviceName; + String? ipAddress; + String? country; + String? state; + String? city; + String? zip; + String? isp; + String? lat; + String? lon; + String? timezone; + + Data( + {this.id, + this.deviceName, + this.ipAddress, + this.country, + this.state, + this.city, + this.zip, + this.isp, + this.lat, + this.lon, + this.timezone}); + + Data.fromJson(Map json) { + id = json['id']; + deviceName = json['device_name']; + ipAddress = json['ip_address']; + country = json['country']; + state = json['state']; + city = json['city']; + zip = json['zip']; + isp = json['isp']; + lat = json['lat']; + lon = json['lon']; + timezone = json['timezone']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['device_name'] = this.deviceName; + data['ip_address'] = this.ipAddress; + data['country'] = this.country; + data['state'] = this.state; + data['city'] = this.city; + data['zip'] = this.zip; + data['isp'] = this.isp; + data['lat'] = this.lat; + data['lon'] = this.lon; + data['timezone'] = this.timezone; + 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 f85a350..71f7829 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/My Network/MyNetwork.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/My Network/MyNetwork.dart @@ -31,48 +31,51 @@ class _MyNetworkState extends State { // MainIndProfile @override Widget build(BuildContext context) { - return Scaffold( - // key: _scaffoldKey1, - resizeToAvoidBottomInset: false, - backgroundColor: const Color(0xFF222935), - extendBody: true, - appBar: const CommonAppbar( - titleTxt: "My networks", - ), - body: Stack(children: [ - Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/png/Ellipse 1496.png"), - fit: BoxFit.fill)), + return GestureDetector( + onTap: () => FocusManager.instance.primaryFocus?.unfocus(), + child: Scaffold( + // key: _scaffoldKey1, + resizeToAvoidBottomInset: false, + backgroundColor: const Color(0xFF222935), + extendBody: true, + appBar: const CommonAppbar( + titleTxt: "My networks", ), - Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - sizedBoxHeight(16.h), - Expanded( - child: DefaultTabController( - length: 2, - // initialIndex: selectedIndex.value, - child: Column(children: [ - CommonTabBar(tabs: const [ - Tab( - text: 'Followers', + body: Stack(children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + sizedBoxHeight(16.h), + Expanded( + child: DefaultTabController( + length: 2, + // initialIndex: selectedIndex.value, + child: Column(children: [ + CommonTabBar(tabs: const [ + Tab( + text: 'Followers', + ), + Tab( + text: 'Following', + ), + ]), + const Expanded( + child: TabBarView( + children: [ + FollowersTab(), + FollowingTab(), + ], + ), ), - Tab( - text: 'Following', - ), - ]), - const Expanded( - child: TabBarView( - children: [ - FollowersTab(), - FollowingTab(), - ], - ), - ), - ])), - ) - ]) - ])); + ])), + ) + ]) + ])), + ); } } @@ -174,260 +177,258 @@ class _FollowersTabState extends State { @override Widget build(BuildContext context) { - return 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, + 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", ), ), - ), - 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 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) - : 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! - .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, - ), - ), - )), - ], - ), - ) - ], - ), - ); - }, + 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 Column( + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 16.h, horizontal: 16.w), + child: Row( + children: [ + followersobj!.data![index].follower! + .profilePhoto == + null || + followersobj! + .data![index] + .follower! + .profilePhoto! + .isEmpty + ? CircleAvatar( + backgroundImage: const AssetImage( + 'assets/images/png/Ellipse 43.png'), + radius: 25.r, + ) + : CircleAvatar( + backgroundImage: NetworkImage( + followersobj! + .data![index] + .follower! + .profilePhoto!), + radius: 25.r, + ), + sizedBoxWidth(10.w), + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + followersobj!.data![index].follower! + .fullName == + null || + followersobj! + .data![index] + .follower! + .fullName! + .isEmpty == + true + ? text16w400_FCFCFC("Regroup") + : text16w400_FCFCFC( + followersobj!.data![index] + .follower!.fullName!), + sizedBoxHeight(4.h), + followersobj!.data![index].follower! + .userName == + null || + followersobj! + .data![index] + .follower! + .userName! + .isEmpty == + true + ? text12w400_FCFCFC_blur( + "regroup") + : text12w400_FCFCFC_blur( + followersobj!.data![index] + .follower!.userName!) + ], + ), + const Spacer(), + PopupMenuButton( + surfaceTintColor: const Color(0xFF222935), + constraints: + BoxConstraints.tightFor( + width: 176.w), + offset: const Offset(0, 20), + color: const Color(0xFF222935), + tooltip: "", + itemBuilder: (BuildContext + context) => + [ + PopupMenuItem( + // onTap: () {}, + onTap: () async { + setState(() { + removeid = followersobj! + .data![index] + .follower! + .id ?? + 0; + followersobj!.data! + .removeWhere((item) => + item.follower! + .id == + removeid); + RemoveUploadata(); + }); + }, + child: Padding( + padding: + EdgeInsets.symmetric( + horizontal: 12.w), + child: Row( + children: [ + text14400white( + "Remove user"), + const Spacer(), + Image.asset( + "assets/images/png/fluent_delete-28-regular.png", + height: 15.h, + width: 15.w, + ) + ], + ), + ), + ), + const PopupMenuDivider(), + PopupMenuItem( + onTap: () {}, + child: Padding( + padding: + EdgeInsets.symmetric( + horizontal: 12.w), + child: Row( + children: [ + text14400white( + "Message user"), + const Spacer(), + Image.asset( + "assets/images/png/fluent_chat-20-regular.png", + height: 20.h, + width: 20.w, + ) + ], + ), + ), + ), + const PopupMenuDivider(), + PopupMenuItem( + onTap: () async { + setState(() { + blockid = followersobj! + .data![index] + .follower! + .id ?? + 0; + followersobj!.data! + .removeWhere((item) => + item.follower! + .id == + blockid); + BlockUploadata(); + }); + }, + child: Padding( + padding: + EdgeInsets.symmetric( + horizontal: 12.w), + child: Row( + children: [ + text14400white( + "Block user"), + const Spacer(), + Image.asset( + "assets/images/png/blockchat.png", + height: 25.h, + width: 25.w, + ) + ], + ), + ), + ), + ], + child: Container( + height: 20, + width: 20, + child: Center( + child: Image.asset( + "assets/images/png/Group 1000004071.png", + height: 22.h, + width: 4.w, + ), + ), + )), + ], + ), + ) + ], + ); + }, + ); + } + }, + ), + ], + ), + ]); } Widget _buildNoDataBody(context) { @@ -535,60 +536,64 @@ class _FollowingTabState extends State { @override Widget build(BuildContext context) { - return Column( + return ListView( + physics: const ScrollPhysics(), + scrollDirection: Axis.vertical, children: [ - sizedBoxHeight(25.h), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), - child: CustomTextFormField( - leadingIcon: SizedBox( - height: 23, - width: 23, - child: Center( - child: Image.asset( - "assets/images/png/ion_search-outline.png", - height: 23, - width: 23, + Column( + children: [ + sizedBoxHeight(25.h), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: CustomTextFormField( + leadingIcon: SizedBox( + height: 23, + width: 23, + child: Center( + child: Image.asset( + "assets/images/png/ion_search-outline.png", + height: 23, + width: 23, + ), ), ), + hintText: "Search people", + texttype: TextInputType.text, + inputFormatters: [ + // LengthLimitingTextInputFormatter(20), + RemoveEmojiInputFormatter(), + ], + onInput: (value) { + // Onboard().postGroupsearch({"search": value}, + // streamController: searchcontroller); + // searchGroups(value!); + Profilegetmethod() + .getFollowing(value, streamController: searchcontroller); + return null; + }, ), - hintText: "Search people", - texttype: TextInputType.text, - inputFormatters: [ - // LengthLimitingTextInputFormatter(20), - RemoveEmojiInputFormatter(), - ], - onInput: (value) { - // Onboard().postGroupsearch({"search": value}, - // streamController: searchcontroller); - // searchGroups(value!); - Profilegetmethod() - .getFollowing(value, streamController: searchcontroller); - }, ), - ), - 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) - : Expanded( - child: ListView.separated( + 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, @@ -617,178 +622,145 @@ class _FollowingTabState extends State { // 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, - ) - ], - ), + 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, ), + 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/Settings/AccountSessions.dart b/lib/Feed Module/Main_Screens/ProfileTab/Settings/AccountSessions.dart index 73c2ed1..347e96b 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/Settings/AccountSessions.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/Settings/AccountSessions.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:regroup/Common/CommonGlassmorphism.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/view_model/profileGetmethod.dart'; import 'package:regroup/Utils/Common/CommonAppbar.dart'; -import 'package:regroup/Utils/Common/blureffect.dart'; import 'package:regroup/Utils/Common/sized_box.dart'; import 'package:regroup/Utils/texts.dart'; @@ -30,7 +30,65 @@ class _AccountSessionState extends State { appBar: CommonAppbar( titleTxt: "Account sessions", ), - body: Stack(children: [ + body: + FutureBuilder( + future: Profilegetmethod().getAccountSessions(), + builder: (ctx, snapshot) { + if (snapshot.data == null) { + return const Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: CircularProgressIndicator( + color: Color(0xFFC18948), + ), + ) + ], + ); + } + if (snapshot.connectionState == ConnectionState.done) { + if (snapshot.hasError) { + return Center( + child: Text( + '${snapshot.error} occured', + style: TextStyle(fontSize: 18.spMin), + ), + ); + } + } + return accountsessionobj!.data!.isEmpty + ? _buildNoDataBody(context) + : _buildBody(context); + }, + ), + + + ); + } + + Widget _buildNoDataBody(context) { + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "No Data Found", + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ) + ], + ), + ); + } + + Widget _buildBody(context) { + return + + Stack(children: [ Container( decoration: const BoxDecoration( image: DecorationImage( @@ -45,17 +103,30 @@ class _AccountSessionState extends State { sizedBoxHeight(16.h), ListView.builder( shrinkWrap: true, - itemCount: sessionData.length, + physics: ScrollPhysics(), + itemCount: accountsessionobj!.data!.length, itemBuilder: (context, index) { - return sessionCard(title: sessionData[index]); + final city = accountsessionobj!.data![index].city; + final state = accountsessionobj!.data![index].state; + final country = accountsessionobj!.data![index].country; + + // Combine city, state, and country + final locationTitle = '$city, $state, $country'; + return sessionCard( + title: locationTitle, + devicename: accountsessionobj!.data![index].deviceName!, + ipaddress: accountsessionobj!.data![index].ipAddress! + + ); }, ) ]), ) - ])); - } + ]); + + } - Widget sessionCard({required String title}) { + Widget sessionCard({required String title, required String devicename, required String ipaddress}) { return Padding( padding: const EdgeInsets.symmetric(vertical: 15), child: commonGlassContainer( @@ -89,7 +160,7 @@ class _AccountSessionState extends State { sizedBoxHeight(16.h), Row( children: [ - text14400whiteblur("Apple iPhone 15"), + text14400whiteblur(devicename), sizedBoxWidth(6.w), Icon( Icons.circle, @@ -97,7 +168,7 @@ class _AccountSessionState extends State { color: Colors.white, ), sizedBoxWidth(6.w), - text144005DFD63("192.158.1.38") + text144005DFD63(ipaddress.toString()) ], ) ], diff --git a/lib/Feed Module/Main_Screens/ProfileTab/TimeLine/AddTimeline.dart b/lib/Feed Module/Main_Screens/ProfileTab/TimeLine/AddTimeline.dart index 5ce669c..e54acb0 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/TimeLine/AddTimeline.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/TimeLine/AddTimeline.dart @@ -6,7 +6,6 @@ import 'package:get/get.dart'; import 'package:regroup/Common/CommonGlassmorphism.dart'; import 'package:regroup/Common/CommonWidget.dart'; import 'package:regroup/Common/base_manager.dart'; -import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/EditProfile/ViewModel/EditProfileApi.dart'; import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/timelineabilityModel.dart' as timelineabilist; import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/view_model/gettimelineability.dart'; @@ -82,7 +81,7 @@ class _AddTimelineState extends State { // late Future myfuture; FutureGroup futureGroup = FutureGroup(); RxBool isloading = true.obs; - + List seelctedNameList = []; @override void initState() { // TODO: implement initState @@ -101,44 +100,40 @@ class _AddTimelineState extends State { edittimelineobj!.data!.timelineData!.startDate ?? ""; dateController2.text = edittimelineobj!.data!.timelineData!.endDate ?? ""; - String abilitiesXids = - edittimelineobj!.data!.timelineData!.abilitiesXids ?? ""; - abilitiesIds = abilitiesXids - .split(',') - .map((e) => int.tryParse(e.trim()) ?? 0) // Trim spaces around IDs - .toList(); - selectedabilityid = abilitiesIds; - print(selectedabilityid.toList()); - - for (int i = 0; i < _abilitydrop.length; i++) { - _abilityMap.add({ - "id": i + 1, - "name": _abilitydrop[i], - }); - } + log(_abilityMap.length.toString()); // futureGroup.add( fetchABilitylist().then((value) { - isloading = false.obs; + String abilitiesXids = + edittimelineobj!.data!.timelineData!.abilitiesXids ?? ""; + abilitiesIds = abilitiesXids + .split(',') + .map((e) => int.tryParse(e.trim()) ?? 0) // Trim spaces around IDs + .toList(); + selectedabilityid = abilitiesIds; + + print(selectedabilityid.toList()); + + for (int i = 0; i < _abilitydrop.length; i++) { + _abilityMap.add({ + "id": i + 1, + "name": _abilitydrop[i], + }); + } + getSelectedNames(selectedabilityid).then((value) { + seelctedNameList = value; + isloading = false.obs; + }); }); // ); }); - // ); - // myfuture = Profilegetmethod().getEditTimeline(id); + + } else { + fetchABilitylist().then((value) { + isloading = false.obs; + }); } - // futureGroup.add( - // ); - // futureGroup.close(); - fetchABilitylist().then((value) { - isloading = false.obs; - }); - - // WidgetsBinding.instance.addPostFrameCallback((_) { - // fetchABilitylist(); - // }); - - // setValues(); super.initState(); } @@ -160,13 +155,6 @@ class _AddTimelineState extends State { final data = await Profilepostmethod().postTimeline(updata); if (data.status == ResponseStatus.SUCCESS) { Get.back(); - // String? accountype; - - // accountype = prefs.getString('accountTypefromLogin'); - - // if (accountype == "1") { - // EditProfileApi().getEditProfileIndividual(); - // } Get.back(); print("timeline done"); return utils.showToast(data.message); @@ -207,7 +195,7 @@ class _AddTimelineState extends State { List listData = []; // Function to get names from selected IDs - List getSelectedNames(List selectedIds) { + Future> getSelectedNames(List selectedIds) async { List selectedNames = []; for (int id in selectedIds) { for (Map ability in _abilityMap) { @@ -219,6 +207,7 @@ class _AddTimelineState extends State { _abilitydrop = _abilityMap.map((ability) => ability["name"] as String).toList(); } + return selectedNames; } @@ -235,323 +224,6 @@ class _AddTimelineState extends State { titleTxt: "Add timeline", ), body: - // edited == true - // ? FutureBuilder( - // future: futureGroup.future, - // builder: (ctx, snapshot) { - // if (snapshot.data == null) { - // return Center( - // child: CircularProgressIndicator( - // color: Colors.blue, - // ), - // ); - // } - // if (snapshot.connectionState == ConnectionState.done) { - // if (snapshot.hasError) { - // return Center( - // child: Text( - // '${snapshot.error} occured', - // style: TextStyle(fontSize: 18.spMin), - // ), - // ); - // } else if (snapshot.hasData) { - // clubNameController.text = - // edittimelineobj!.data!.timelineData!.clubName ?? ""; - // rollnameController.text = - // edittimelineobj!.data!.timelineData!.roleName ?? ""; - // teamnameController.text = - // edittimelineobj!.data!.timelineData!.teamName ?? ""; - // ""; - // dateController.text = - // edittimelineobj!.data!.timelineData!.startDate ?? - // ""; - // dateController2.text = - // edittimelineobj!.data!.timelineData!.endDate ?? ""; - - // // String abilitiesXids = edittimelineobj! - // // .data!.timelineData!.abilitiesXids ?? - // // ""; - // // List abilitiesIds = abilitiesXids - // // .split(',') - // // .map((e) => int.tryParse(e) ?? 0) - // // .toList(); - // String abilitiesXids = edittimelineobj! - // .data!.timelineData!.abilitiesXids ?? - // ""; - // abilitiesIds = abilitiesXids - // .split(',') - // .map((e) => - // int.tryParse(e.trim()) ?? - // 0) // Trim spaces around IDs - // .toList(); - // selectedabilityid = abilitiesIds; - - // print(selectedabilityid.toList()); - - // for (int i = 0; i < _abilitydrop.length; i++) { - // _abilityMap.add({ - // "id": i + 1, - // "name": _abilitydrop[i], - // }); - // } - // } - // } - // return Stack(children: [ - // Container( - // decoration: const BoxDecoration( - // image: DecorationImage( - // image: AssetImage( - // "assets/images/png/Ellipse 1496.png"), - // fit: BoxFit.fill)), - // ), - // ListView(physics: ScrollPhysics(), children: [ - // Padding( - // padding: EdgeInsets.symmetric(horizontal: 16.w), - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // sizedBoxHeight(20.h), - // text16400white("Club name"), - // sizedBoxHeight(15.h), - // CustomTextFormField( - // textEditingController: clubNameController, - // texttype: TextInputType.text, - // hintText: 'Enter club name', - // validator: (value) { - // if (value!.isEmpty) { - // return 'Enter your full name '; - // } - // return null; - // }, - // inputFormatters: [ - // // LengthLimitingTextInputFormatter(20), - // RemoveEmojiInputFormatter(), - // FilteringTextInputFormatter.allow( - // RegExp('[a-zA-Z ]')) - // ], - // ), - // sizedBoxHeight(25.h), - // text16400white("Role in the club"), - // sizedBoxHeight(15.h), - // CustomTextFormField( - // textEditingController: rollnameController, - // texttype: TextInputType.text, - // hintText: 'Enter club name', - // validator: (value) { - // if (value!.isEmpty) { - // return 'Enter your full name '; - // } - // return null; - // }, - // inputFormatters: [ - // // LengthLimitingTextInputFormatter(20), - // RemoveEmojiInputFormatter(), - // FilteringTextInputFormatter.allow( - // RegExp('[a-zA-Z ]')) - // ], - // ), - // sizedBoxHeight(25.h), - // text16400white("Team name"), - // sizedBoxHeight(15.h), - // CustomTextFormField( - // textEditingController: teamnameController, - // texttype: TextInputType.text, - // hintText: 'Enter club name', - // validator: (value) { - // if (value!.isEmpty) { - // return 'Enter your full name '; - // } - // return null; - // }, - // inputFormatters: [ - // // LengthLimitingTextInputFormatter(20), - // RemoveEmojiInputFormatter(), - // FilteringTextInputFormatter.allow( - // RegExp('[a-zA-ZS0-9 ]')), - // ], - // ), - // sizedBoxHeight(25.h), - // Row( - // mainAxisAlignment: - // MainAxisAlignment.spaceBetween, - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Expanded( - // child: Column( - // crossAxisAlignment: - // CrossAxisAlignment.start, - // children: [ - // text16400white("Start date "), - // sizedBoxHeight(10.h), - // GestureDetector( - // onTap: () => datePicker( - // context, dateController), - // child: AbsorbPointer( - // child: CustomTextFormField( - // textEditingController: - // dateController, - // leadingIcon: Container( - // height: 20.h, - // width: 20.w, - // child: Center( - // child: Image.asset( - // "assets/images/png/calender.png", - // height: 20.h, - // width: 20.w, - // ), - // ), - // ), - // ), - // ), - // ) - // ], - // ), - // ), - // sizedBoxWidth(10.h), - // Expanded( - // child: Column( - // crossAxisAlignment: - // CrossAxisAlignment.start, - // children: [ - // text16400white("End date"), - // sizedBoxHeight(10.h), - // GestureDetector( - // onTap: () => datePicker( - // context, dateController2), - // child: AbsorbPointer( - // child: CustomTextFormField( - // textEditingController: - // dateController2, - // leadingIcon: Container( - // height: 20.h, - // width: 20.w, - // child: Center( - // child: Image.asset( - // "assets/images/png/calender.png", - // height: 20.h, - // width: 20.w, - // ), - // ), - // ), - // ), - // ), - // ), - // sizedBoxHeight(10.h), - // Row( - // children: [ - // Obx(() { - // return commonGlassContainer( - // border: 1, - // borderradius: 2, - // height: 20.h, - // width: 20.w, - // opacity1: 0.24, - // opacity2: 0.24, - // customWidget: Transform.scale( - // scale: 1.2, - // child: Checkbox( - // side: BorderSide( - // color: Color( - // 0xFF434A53)), - // value: isChecked.value, - // activeColor: - // Colors.transparent, - // checkColor: Colors.white, - // onChanged: ((value) { - // // isChecked.value = value!; - // isChecked.value = - // value!; - // if (isChecked.value) { - // // Set end date to today's date - // dateController2 - // .text = DateFormat( - // 'yyyy-MM-dd') - // .format(DateTime - // .now()); - // } else { - // // Clear end date when checkbox is unchecked - // dateController2 - // .clear(); - // } - // }), - // ), - // ), - // ); - // }), - // sizedBoxWidth(8.w), - // text10400white("Present") - // ], - // ), - // ], - // ), - // ) - // ], - // ), - // text16400white("Ability"), - // sizedBoxHeight(15.h), - // // CustomDropDownCheckBoxTimeline( - // // header: 'Select ability', - // // title: '', - // // listData: _abilitydrop, - // // onItemSelected: getCatIdFromName, - // // initiallySelected: abilitiesIds - // // .map((id) => id.toString()) - // // .toList(), - // // ), - // CustomDropDownCheckBoxTimeline( - // header: 'Select ability', - // title: '', - // listData: listData, - // // _abilityMap.map((ability) => ability["name"]).toList(), - // onItemSelected: getCatIdFromName, - // // (selectedNames) { - // // // Convert selected names back to IDs if needed - // // List selectedIds = []; - // // for (String name in selectedNames) { - // // for (Map ability - // // in _abilityMap) { - // // if (ability["name"] == name) { - // // selectedIds.add(ability["id"]); - // // break; - // // } - // // } - // // } - // // // Use selectedIds as needed - // // print(selectedIds); - // // }, - // initiallySelected: getSelectedNames( - // abilitiesIds), // Pass initially selected names - // ), - // sizedBoxHeight(80.h), - // Padding( - // padding: - // EdgeInsets.symmetric(horizontal: 20.w), - // child: CustomButton( - // text: "Add timeline", - // onPressed: () { - // if (clubNameController.text.isBlank! || - // rollnameController.text.isBlank! || - // teamnameController.text.isBlank! || - // dateController.text.isBlank! || - // dateController2.text.isBlank! || - // selectedabilityid.isEmpty) { - // utils.showToast( - // 'Please fill all fields'); - // } else { - // print(selectedabilityid.toString()); - - // EdituploadData(); - // } - // }, - // ), - // ), - // ]), - // ) - // ]) - // ]); - // }, - // ) - // : Obx(() // { => @@ -819,8 +491,8 @@ class _AddTimelineState extends State { // // Use selectedIds as needed // print(selectedIds); // }, - initiallySelected: getSelectedNames( - abilitiesIds), // Pass initially selected names + initiallySelected: + seelctedNameList, // Pass initially selected names ), sizedBoxHeight(80.h), Padding( @@ -846,7 +518,7 @@ class _AddTimelineState extends State { print(selectedabilityid .toString()); - EdituploadData(); + // EdituploadData(); } }, ), @@ -1164,9 +836,155 @@ class _CustomDropDownCheckBoxTimelineState .addAll(widget.initiallySelected); // Initialize selectedValues } + // List> _buildDropdownMenuItems() { + // List> items = + // widget.listData.asMap().entries.map((entry) { + // int index = entry.key; + // String item = entry.value; + // return DropdownMenuItem( + // value: item, + // child: InkWell( + // onTap: () { + // setState(() { + // if (selectedValues.contains(item)) { + // selectedValues.remove(item); + // } else { + // selectedValues.add(item); + // } + // _textController.clear(); + // widget.onItemSelected( + // selectedValues.toList()); // Convert RxList to List + // }); + // }, + // child: Column( + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // Row( + // children: [ + // Obx(() { + // return Checkbox( + // value: selectedValues.contains(item), + // activeColor: Colors.white, + // checkColor: const Color(0xFFD90B2E), + // onChanged: (bool? value) { + // setState(() { + // if (value == true) { + // selectedValues.add(item); + // } else { + // selectedValues.remove(item); + // } + // _textController.clear(); + // widget.onItemSelected(selectedValues.toList()); + // }); + // }, + // ); + // }), + // const SizedBox(width: 8), + // Text( + // item, + // style: const TextStyle( + // color: Colors.white, + // fontSize: 16, + // fontFamily: 'Helvetica', + // fontWeight: FontWeight.w500, + // ), + // overflow: TextOverflow.ellipsis, + // ), + // ], + // ), + // if (index != widget.listData.length - 1) + // const Divider(thickness: 1, color: Color(0xFF434A53)), + // ], + // ), + // ), + // ); + // }).toList(); + + // if (widget.showOtherOption) { + // items.add( + // DropdownMenuItem( + // value: _textController.text, + // child: Column( + // children: [ + // const Divider(thickness: 1, color: Color(0xFF434A53)), + // Row( + // children: [ + // Obx(() { + // return Checkbox( + // value: selectedValues.contains(_textController.text), + // activeColor: Colors.white, + // onChanged: (bool? value) { + // setState(() { + // if (value == true && + // _textController.text.trim().isNotEmpty) { + // selectedValues.add(_textController.text); + // } else { + // selectedValues.remove(_textController.text); + // } + // widget.onItemSelected(selectedValues.toList()); + // }); + // }, + // ); + // }), + // const SizedBox(width: 8), + // const Text( + // "Other: ", + // style: TextStyle( + // color: Colors.white, + // fontSize: 16, + // fontFamily: 'Helvetica', + // fontWeight: FontWeight.w500, + // ), + // overflow: TextOverflow.ellipsis, + // ), + // Expanded( + // child: TextField( + // controller: _textController, + // style: const TextStyle( + // color: Colors.white, + // fontSize: 16, + // fontFamily: 'Helvetica', + // fontWeight: FontWeight.w500, + // ), + // decoration: const InputDecoration( + // hintText: '', + // hintStyle: TextStyle(color: Colors.white70), + // border: UnderlineInputBorder(), + // ), + // ), + // ), + // TextButton( + // onPressed: () { + // setState(() { + // if (_textController.text.trim().isNotEmpty) { + // selectedValues.add(_textController.text); + // widget.onItemSelected(selectedValues.toList()); + // } + // }); + // }, + // child: const Text( + // 'OK', + // style: TextStyle( + // color: Colors.white, + // fontSize: 16, + // fontFamily: 'Helvetica', + // fontWeight: FontWeight.w500, + // ), + // ), + // ), + // ], + // ), + // SizedBox(height: 10), + // ], + // ), + // ), + // ); + // } + // return items; + // } + List> _buildDropdownMenuItems() { - List> items = - widget.listData.asMap().entries.map((entry) { + return widget.listData.asMap().entries.map((entry) { int index = entry.key; String item = entry.value; return DropdownMenuItem( @@ -1180,8 +998,7 @@ class _CustomDropDownCheckBoxTimelineState selectedValues.add(item); } _textController.clear(); - widget.onItemSelected( - selectedValues.toList()); // Convert RxList to List + widget.onItemSelected(selectedValues.toList()); }); }, child: Column( @@ -1208,15 +1025,18 @@ class _CustomDropDownCheckBoxTimelineState ); }), const SizedBox(width: 8), - Text( - item, - style: const TextStyle( - color: Colors.white, - fontSize: 16, - fontFamily: 'Helvetica', - fontWeight: FontWeight.w500, + Expanded( + child: Text( + item, + style: const TextStyle( + color: Colors.white, + fontSize: 16, + fontFamily: 'Helvetica', + fontWeight: FontWeight.w500, + ), + maxLines: 1, // Adjust as needed + overflow: TextOverflow.ellipsis, ), - overflow: TextOverflow.ellipsis, ), ], ), @@ -1227,88 +1047,6 @@ class _CustomDropDownCheckBoxTimelineState ), ); }).toList(); - - if (widget.showOtherOption) { - items.add( - DropdownMenuItem( - value: _textController.text, - child: Column( - children: [ - const Divider(thickness: 1, color: Color(0xFF434A53)), - Row( - children: [ - Obx(() { - return Checkbox( - value: selectedValues.contains(_textController.text), - activeColor: Colors.white, - onChanged: (bool? value) { - setState(() { - if (value == true && - _textController.text.trim().isNotEmpty) { - selectedValues.add(_textController.text); - } else { - selectedValues.remove(_textController.text); - } - widget.onItemSelected(selectedValues.toList()); - }); - }, - ); - }), - const SizedBox(width: 8), - const Text( - "Other: ", - style: TextStyle( - color: Colors.white, - fontSize: 16, - fontFamily: 'Helvetica', - fontWeight: FontWeight.w500, - ), - overflow: TextOverflow.ellipsis, - ), - Expanded( - child: TextField( - controller: _textController, - style: const TextStyle( - color: Colors.white, - fontSize: 16, - fontFamily: 'Helvetica', - fontWeight: FontWeight.w500, - ), - decoration: const InputDecoration( - hintText: '', - hintStyle: TextStyle(color: Colors.white70), - border: UnderlineInputBorder(), - ), - ), - ), - TextButton( - onPressed: () { - setState(() { - if (_textController.text.trim().isNotEmpty) { - selectedValues.add(_textController.text); - widget.onItemSelected(selectedValues.toList()); - } - }); - }, - child: const Text( - 'OK', - style: TextStyle( - color: Colors.white, - fontSize: 16, - fontFamily: 'Helvetica', - fontWeight: FontWeight.w500, - ), - ), - ), - ], - ), - SizedBox(height: 10), - ], - ), - ), - ); - } - return items; } @override @@ -1355,15 +1093,19 @@ class _CustomDropDownCheckBoxTimelineState ? SizedBox() : widget.leadingImage!, const SizedBox(width: 12), - Text( - selectedValues.isEmpty - ? widget.header - : selectedValues.join(', '), - style: TextStyle( + Expanded( + child: Text( + selectedValues.isEmpty + ? widget.header + : selectedValues.join(', '), + style: TextStyle( color: Colors.white, fontSize: 16, fontFamily: 'Helvetica', - fontWeight: FontWeight.w400), + fontWeight: FontWeight.w400, + ), + overflow: TextOverflow.ellipsis, + ), ), const Spacer(), onDropTap.value diff --git a/lib/Feed Module/Main_Screens/ProfileTab/view_model/profileGetmethod.dart b/lib/Feed Module/Main_Screens/ProfileTab/view_model/profileGetmethod.dart index 58f48e3..e60ef28 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/view_model/profileGetmethod.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/view_model/profileGetmethod.dart @@ -4,6 +4,7 @@ import 'dart:developer'; 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/Model/accountSessionModel.dart'; import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/editTimelineModel.dart'; import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/faqModel.dart'; import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/followersModel.dart'; @@ -18,6 +19,7 @@ TermsConditionsModel? termsobj; FollowersModel? followersobj; FollowingModel? followingobj; GetEditTimelineModel? edittimelineobj; +GetAccountSessionsModel? accountsessionobj; class Profilegetmethod { @@ -93,4 +95,16 @@ class Profilegetmethod { } return response; } + + Future> getAccountSessions() async { + final response = await NetworkApiServices().getApi( + ApiUrls.getaccountsessions, + // optionalpar: false + ); + if (response.status == ResponseStatus.SUCCESS) { + accountsessionobj = GetAccountSessionsModel.fromJson(response.data); + log(accountsessionobj!.data.toString()); + } + return response; + } } diff --git a/lib/Feed Module/Main_Screens/ProfileTab/view_model/profilePostmethod.dart b/lib/Feed Module/Main_Screens/ProfileTab/view_model/profilePostmethod.dart index 526fe47..2e3e64d 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/view_model/profilePostmethod.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/view_model/profilePostmethod.dart @@ -217,5 +217,27 @@ class Profilepostmethod { print("response message is ${response.message}"); return response; } + + Future> postRemoveCertification(updata) async { + print("updata is $updata"); + final response = await NetworkApiServices().postApi( + updata, + ApiUrls.postremovecertification, + ); + print("response is ${response.data}"); + print("response message is ${response.message}"); + return response; + } + + Future> postCertification(updata) async { + print("updata is $updata"); + final response = await NetworkApiServices().postApi( + updata, + ApiUrls.postcertification, + ); + print("response is ${response.data}"); + print("response message is ${response.message}"); + return response; + } } diff --git a/lib/Utils/Common/CommonDropdown.dart b/lib/Utils/Common/CommonDropdown.dart index c902f45..bea237a 100644 --- a/lib/Utils/Common/CommonDropdown.dart +++ b/lib/Utils/Common/CommonDropdown.dart @@ -74,12 +74,9 @@ class _CustomDropDownWidgetSignupState // 'assets/images/png/user.png', // ), - widget.leadingImage == null - ? - SizedBox() - : - widget.leadingImage! - , + widget.leadingImage == null + ? SizedBox() + : widget.leadingImage!, SizedBox(width: 16.w), Text( @@ -933,15 +930,76 @@ class _CustomDropDownChexkBoxState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ + // GestureDetector( + // onTap: () { + // onDropTap.value = !onDropTap.value; + // }, + // child: Container( + // width: double.infinity, + // // height: 50, + // padding: + // EdgeInsets.only(right: 22, left: 12, top: 14, bottom: 14), + // decoration: BoxDecoration( + // color: const Color(0xFFFFFFFF).withOpacity(0.10), + // borderRadius: onDropTap.value + // ? const BorderRadius.vertical( + // top: Radius.circular(30), + // ) + // : const BorderRadius.all(Radius.circular(30)), + // gradient: LinearGradient( + // begin: Alignment.topLeft, + // end: Alignment.bottomRight, + // colors: [ + // const Color(0xFFffffff).withOpacity(0.50), + // const Color(0xFFFFFFFF).withOpacity(0.50), + // ], + // ), + // border: Border.all(color: const Color(0xFF434A53)), + // ), + // child: Center( + // child: Row( + // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // // if (widget.leadingImage != null) widget.leadingImage!, + // widget.leadingImage == null + // ? + // SizedBox() + // : + // widget.leadingImage!, + // const SizedBox(width: 12), + // Expanded( + // child: Text( + // selectedValues.isEmpty + // ? widget.header + // : selectedValues.join(', '), + // style: TextStyle( + // color: Colors.white, + // fontSize: 16, + // fontFamily: 'Helvetica', + // fontWeight: FontWeight.w400), + // ), + // ), + // const Spacer(), + // onDropTap.value + // ? Image.asset('assets/images/png/arrowup.png') + // : Image.asset('assets/images/png/arrowdown.png'), + // ], + // ), + // ), + // ), + // ), GestureDetector( onTap: () { onDropTap.value = !onDropTap.value; }, child: Container( width: double.infinity, - // height: 50, - padding: - EdgeInsets.only(right: 22, left: 12, top: 14, bottom: 14), + height: 50, + padding: EdgeInsets.only( + right: 22, + left: 12, + ), decoration: BoxDecoration( color: const Color(0xFFFFFFFF).withOpacity(0.10), borderRadius: onDropTap.value @@ -964,12 +1022,9 @@ class _CustomDropDownChexkBoxState extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ - // if (widget.leadingImage != null) widget.leadingImage!, - widget.leadingImage == null - ? - SizedBox() - : - widget.leadingImage!, + widget.leadingImage == null + ? SizedBox() + : widget.leadingImage!, const SizedBox(width: 12), Expanded( child: Text( @@ -977,10 +1032,12 @@ class _CustomDropDownChexkBoxState extends State { ? widget.header : selectedValues.join(', '), style: TextStyle( - color: Colors.white, - fontSize: 16, - fontFamily: 'Helvetica', - fontWeight: FontWeight.w400), + color: Colors.white, + fontSize: 16, + fontFamily: 'Helvetica', + fontWeight: FontWeight.w400, + ), + overflow: TextOverflow.ellipsis, ), ), const Spacer(), diff --git a/lib/onboarding/Signup/view_model/postmethod.dart b/lib/onboarding/Signup/view_model/postmethod.dart index e4396d9..ff9a2c8 100644 --- a/lib/onboarding/Signup/view_model/postmethod.dart +++ b/lib/onboarding/Signup/view_model/postmethod.dart @@ -124,4 +124,15 @@ class Onboard { print("response message is ${response.message}"); return response; } + + Future> postUserdevice(updata) async { + print("updata is $updata"); + final response = await NetworkApiServices().postApi( + updata, + ApiUrls.postuserdevice, + ); + print("response is ${response.data}"); + print("response message is ${response.message}"); + return response; + } } diff --git a/lib/onboarding/SplashScreen.dart b/lib/onboarding/SplashScreen.dart index 99c4a71..ea8aab3 100644 --- a/lib/onboarding/SplashScreen.dart +++ b/lib/onboarding/SplashScreen.dart @@ -1,15 +1,20 @@ import 'dart:async'; import 'dart:developer'; +import 'dart:io'; import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:device_info_plus/device_info_plus.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/svg.dart'; import 'package:get/get.dart'; +import 'package:regroup/Common/base_manager.dart'; import 'package:regroup/Global.dart'; import 'package:regroup/Utils/Common/NoInternet.dart'; +import 'package:regroup/Utils/dialogs.dart'; import 'package:regroup/onboarding/Signup/view_model/getUserprofile.dart'; +import 'package:regroup/onboarding/Signup/view_model/postmethod.dart'; import 'package:regroup/resources/routes/route_name.dart'; import 'package:shared_preferences/shared_preferences.dart'; // import 'package:shared_preferences/shared_preferences.dart'; @@ -26,7 +31,37 @@ class _SplashScreenState extends State { void initState() { super.initState(); - Future.delayed(const Duration(seconds: 2), () async { + // Future.delayed(const Duration(seconds: 2), () async { + // SharedPreferences prefs = await SharedPreferences.getInstance(); + // token = prefs.getString('access-token'); + // emailid = prefs.getString('email'); + // myusername = prefs.getString('username'); + // fullname = prefs.getString('fullname'); + // phonenumber = prefs.getString('phone'); + + // if (token == null || token!.isEmpty) { + // Get.toNamed(RouteName.onboarding1); + // } else { + // await Getuserdetails().Getuser().then((value) { + // if (getuserobj?.data?.userData?.isProfileUpdated == 0) { + // String? accountype = + // getuserobj?.data?.userData?.principalTypeXid.toString(); + + // if (accountype == "1") { + // Get.toNamed(RouteName.tellusindividualscreen, + // arguments: {'pageroute': "mainscreen"}); + // } else if (accountype == "2") { + // Get.toNamed(RouteName.tellusbusinessscreen, + // arguments: {'pageroute': "mainscreen"}); + // } + // } else { + // Get.toNamed(RouteName.mainscreen); + // } + // }); + // } + // }); + + Future.delayed(const Duration(seconds: 2), () async { SharedPreferences prefs = await SharedPreferences.getInstance(); token = prefs.getString('access-token'); emailid = prefs.getString('email'); @@ -34,9 +69,14 @@ class _SplashScreenState extends State { fullname = prefs.getString('fullname'); phonenumber = prefs.getString('phone'); + String deviceName = await getDeviceName(); + print('Device Name: $deviceName'); + + if (token == null || token!.isEmpty) { Get.toNamed(RouteName.onboarding1); } else { + await Uploadata(deviceName); await Getuserdetails().Getuser().then((value) { if (getuserobj?.data?.userData?.isProfileUpdated == 0) { String? accountype = @@ -57,6 +97,37 @@ class _SplashScreenState extends State { }); } + Future getDeviceName() async { + final deviceInfo = DeviceInfoPlugin(); + String deviceName = ''; + + if (Platform.isAndroid) { + final androidInfo = await deviceInfo.androidInfo; + deviceName = androidInfo.model; + } else if (Platform.isIOS) { + final iosInfo = await deviceInfo.iosInfo; + deviceName = iosInfo.model; + } else { + deviceName = 'Unknown Device'; + } + + return deviceName; +} + +Uploadata(String devicename) async { + Map updata = { + "device_name": devicename, + }; + final data = await Onboard().postUserdevice(updata); + if (data.status == ResponseStatus.SUCCESS) { + + return utils.showToast(data.message); + } else { + print("device details not done"); + return utils.showToast(data.message); + } + } + @override Widget build(BuildContext context) { return Scaffold( diff --git a/lib/resources/routes/route_name.dart b/lib/resources/routes/route_name.dart index 7a6dd1d..49dfdfd 100644 --- a/lib/resources/routes/route_name.dart +++ b/lib/resources/routes/route_name.dart @@ -131,4 +131,7 @@ class RouteName { static const String profiletabbusguest = '/profiletabbusguest'; + static const String addcertificate = '/addusercertificate'; + + } diff --git a/lib/resources/routes/routes.dart b/lib/resources/routes/routes.dart index b0e2143..12a47a7 100644 --- a/lib/resources/routes/routes.dart +++ b/lib/resources/routes/routes.dart @@ -32,6 +32,7 @@ import 'package:regroup/Feed%20Module/Main_Screens/GroupTab/View/SubGroup/SubGro import 'package:regroup/Feed%20Module/Main_Screens/GroupTab/View/SubGroup/SubgroupSetting.dart'; import 'package:regroup/Feed%20Module/Main_Screens/GroupTab/View/SubGroup/Subgroups.dart'; import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Badges/Badges.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Certificate/AddCertificate.dart'; import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Certificate/Certificate.dart'; import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Clubs/Clubs.dart'; import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/EditProfile/View/BusEditProfile.dart'; @@ -523,5 +524,11 @@ class AppRoutes { name: RouteName.mynetwork, page: () => MyNetwork(), ), + GetPage( + name: RouteName.addcertificate, + page: () => AddCertificate(), + ), + + ]; }