sprint 2 tasks completed

This commit is contained in:
Shubhamshirva
2024-07-23 19:19:39 +05:30
parent 43f4e2ddfc
commit 417d3e6a63
17 changed files with 2037 additions and 1117 deletions

View File

@@ -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";

View File

@@ -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<AddCertificate> createState() => _AddCertificateState();
}
class _AddCertificateState extends State<AddCertificate> {
final GlobalKey<FormState> _formkey = GlobalKey<FormState>();
TextEditingController certicationname = TextEditingController();
TextEditingController certificationreason = TextEditingController();
TextEditingController datecontroller = TextEditingController();
TextEditingController querycontroller = TextEditingController();
DateTime? _selectedDate;
Future<void> _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<File?> filePath = [];
bool isImageAdded = false;
UploadData() async {
utils.loader();
List<MultipartFile> 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")
]),
),
))
])),
);
}
}

View File

@@ -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<Certificate> {
@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,
),
),
),
],
);
}),
)
])))
]));
),
],
);
}),
)
])))
]);
}
}

View File

@@ -29,7 +29,8 @@ class Data {
int? id;
String? userName;
String? fullName;
String? profileImage;
// String? profileImage;
String? profilePhoto;
String? gender;
String? dateOfBirth;
List<Interest>? interest;
@@ -43,13 +44,16 @@ class Data {
List<Timelines>? timelines;
int? accountVisibility;
List<MyJoinedSubgroups>? myJoinedSubgroups;
List<Certifications>? 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<String, dynamic> 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 = <Certifications>[];
json['certifications'].forEach((v) {
certifications!.add(new Certifications.fromJson(v));
});
}
daysBeforeJoined = json['days_before_joined'];
}
Map<String, dynamic> 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<String, dynamic> json) {
id = json['id'];
certificationName = json['certification_name'];
certificationImage = json['certification_image'];
certificationReason = json['certification_reason'];
certificationDate = json['certification_date'];
iamPrincipalXid = json['iam_principal_xid'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['certification_name'] = this.certificationName;
data['certification_image'] = this.certificationImage;
data['certification_reason'] = this.certificationReason;
data['certification_date'] = this.certificationDate;
data['iam_principal_xid'] = this.iamPrincipalXid;
return data;
}
}

View File

@@ -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<ProfileTab> {
int? timelineremoveid;
int? certificationsremoveid;
RemoveTimelineUploadata() async {
utils.loader();
Map<String, dynamic> updata = {
@@ -169,6 +173,23 @@ class _ProfileTabState extends State<ProfileTab> {
}
}
RemoveCertificationUploadata() async {
utils.loader();
Map<String, dynamic> 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(
@@ -265,13 +286,13 @@ class _ProfileTabState extends State<ProfileTab> {
'@${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),
@@ -405,7 +426,6 @@ class _ProfileTabState extends State<ProfileTab> {
],
),
sizedBoxHeight(20.h),
getEditProfileIndi!.data!.timelines!.isEmpty
? Center(
child:
@@ -445,15 +465,15 @@ class _ProfileTabState extends State<ProfileTab> {
getEditProfileIndi!.data!
.timelines![index];
List<Map<String, dynamic>>
abilities =
timeline.abilities!
.map((ability) => {
'id': ability.id,
'name':
ability.name,
})
.toList();
// List<Map<String, dynamic>>
// abilities =
// timeline.abilities!
// .map((ability) => {
// 'id': ability.id,
// 'name':
// ability.name,
// })
// .toList();
return
// commonTimelineCard(
// imagePath: getEditProfileIndi
@@ -547,9 +567,9 @@ class _ProfileTabState extends State<ProfileTab> {
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
@@ -557,40 +577,59 @@ class _ProfileTabState extends State<ProfileTab> {
: 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();
// });
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,
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: {
'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,
),
),
)
],
)
],
),
@@ -630,33 +669,59 @@ class _ProfileTabState extends State<ProfileTab> {
.teamName!),
sizedBoxHeight(
10.h),
startToEnd
.isEmpty
startToEnd
.isEmpty
? text12400white(
'No date')
: text12400white(
startToEnd),
sizedBoxHeight(
10.h),
abilities
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
@@ -667,18 +732,14 @@ class _ProfileTabState extends State<ProfileTab> {
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<String> abilityName = getEditProfileIndi!.data!.timelines![index].abilities![innerIndex].name!.split('pattern');
return Padding(
padding: EdgeInsets.only(right: 8.w),
child: text10400whiteblur(abilityName.toString()),
);
},
),
),
@@ -695,12 +756,215 @@ class _ProfileTabState extends State<ProfileTab> {
},
)),
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(
mainAxisAlignment: MainAxisAlignment.start,
children: [
@@ -716,15 +980,12 @@ class _ProfileTabState extends State<ProfileTab> {
shrinkWrap: true,
scrollDirection: Axis.horizontal,
padding: EdgeInsets.only(left: 16.w),
itemCount: getEditProfileIndi!
.data!.myJoinedSubgroups!.length,
itemBuilder: (context, index) {
return Padding(
padding: EdgeInsets.only(right: 20.w),
child: profilecardtile(
imagePath: getEditProfileIndi!
.data!
.myJoinedSubgroups![index]
@@ -744,7 +1005,6 @@ class _ProfileTabState extends State<ProfileTab> {
},
),
),
normalcardtile(
profileImg: 'assets/images/png/Ellipse 48.png',
title: 'Jocelyn Dokidis',
@@ -1176,7 +1436,6 @@ class _ProfileTabState extends State<ProfileTab> {
);
}
Widget commonTimelineCard({
required String? imagePath,
required String? title,
@@ -1186,7 +1445,6 @@ class _ProfileTabState extends State<ProfileTab> {
required int? id,
required List<Map<String, dynamic>>? abilities,
}) {
return Row(
children: [
Container(

View File

@@ -0,0 +1,89 @@
class GetAccountSessionsModel {
String? status;
int? statusCode;
String? message;
List<Data>? data;
GetAccountSessionsModel(
{this.status, this.statusCode, this.message, this.data});
GetAccountSessionsModel.fromJson(Map<String, dynamic> json) {
status = json['status'];
statusCode = json['status_code'];
message = json['message'];
if (json['data'] != null) {
data = <Data>[];
json['data'].forEach((v) {
data!.add(new Data.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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<String, dynamic> 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<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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;
}
}

View File

@@ -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<AccountSession> {
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<AccountSession> {
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<AccountSession> {
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<AccountSession> {
color: Colors.white,
),
sizedBoxWidth(6.w),
text144005DFD63("192.158.1.38")
text144005DFD63(ipaddress.toString())
],
)
],

View File

@@ -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<AddTimeline> {
// late Future myfuture;
FutureGroup futureGroup = FutureGroup();
RxBool isloading = true.obs;
List<String> seelctedNameList = [];
@override
void initState() {
// TODO: implement initState
@@ -101,44 +100,40 @@ class _AddTimelineState extends State<AddTimeline> {
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<AddTimeline> {
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<AddTimeline> {
List<String> listData = [];
// Function to get names from selected IDs
List<String> getSelectedNames(List<int> selectedIds) {
Future<List<String>> getSelectedNames(List<int> selectedIds) async {
List<String> selectedNames = [];
for (int id in selectedIds) {
for (Map<String, dynamic> ability in _abilityMap) {
@@ -219,6 +207,7 @@ class _AddTimelineState extends State<AddTimeline> {
_abilitydrop =
_abilityMap.map((ability) => ability["name"] as String).toList();
}
return selectedNames;
}
@@ -235,323 +224,6 @@ class _AddTimelineState extends State<AddTimeline> {
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<int> 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<int> selectedIds = [];
// // for (String name in selectedNames) {
// // for (Map<String, dynamic> 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<AddTimeline> {
// // 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<AddTimeline> {
print(selectedabilityid
.toString());
EdituploadData();
// EdituploadData();
}
},
),
@@ -1164,9 +836,155 @@ class _CustomDropDownCheckBoxTimelineState
.addAll(widget.initiallySelected); // Initialize selectedValues
}
// List<DropdownMenuItem<String>> _buildDropdownMenuItems() {
// List<DropdownMenuItem<String>> items =
// widget.listData.asMap().entries.map((entry) {
// int index = entry.key;
// String item = entry.value;
// return DropdownMenuItem<String>(
// 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<String>(
// 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<DropdownMenuItem<String>> _buildDropdownMenuItems() {
List<DropdownMenuItem<String>> items =
widget.listData.asMap().entries.map((entry) {
return widget.listData.asMap().entries.map((entry) {
int index = entry.key;
String item = entry.value;
return DropdownMenuItem<String>(
@@ -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<String>(
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

View File

@@ -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<ResponseData<dynamic>> 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;
}
}

View File

@@ -217,5 +217,27 @@ class Profilepostmethod {
print("response message is ${response.message}");
return response;
}
Future<ResponseData<dynamic>> 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<ResponseData<dynamic>> 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;
}
}

View File

@@ -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<CustomDropDownChexkBox> {
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<CustomDropDownChexkBox> {
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<CustomDropDownChexkBox> {
? 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(),

View File

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

View File

@@ -124,4 +124,15 @@ class Onboard {
print("response message is ${response.message}");
return response;
}
Future<ResponseData<dynamic>> 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;
}
}

View File

@@ -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<SplashScreen> {
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<SplashScreen> {
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<SplashScreen> {
});
}
Future<String> 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<String, dynamic> 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(

View File

@@ -131,4 +131,7 @@ class RouteName {
static const String profiletabbusguest = '/profiletabbusguest';
static const String addcertificate = '/addusercertificate';
}

View File

@@ -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(),
),
];
}