Conflict resolved

This commit is contained in:
cj201199
2024-07-22 20:32:39 +05:30
18 changed files with 3302 additions and 736 deletions

View File

@@ -29,6 +29,7 @@ class Data {
int? id;
String? userName;
String? fullName;
String? profileImage;
String? gender;
String? dateOfBirth;
List<Interest>? interest;
@@ -39,11 +40,16 @@ class Data {
String? weight;
String? battingAverage;
Follows? follows;
List<Timelines>? timelines;
int? accountVisibility;
List<MyJoinedSubgroups>? myJoinedSubgroups;
Data(
{this.id,
this.userName,
this.fullName,
this.profileImage,
this.gender,
this.dateOfBirth,
this.interest,
@@ -53,12 +59,17 @@ class Data {
this.height,
this.weight,
this.battingAverage,
this.follows});
this.follows,
this.timelines,
this.accountVisibility,
this.myJoinedSubgroups
});
Data.fromJson(Map<String, dynamic> json) {
id = json['id'];
userName = json['user_name'];
fullName = json['full_name'];
profileImage = json['profile_image'];
gender = json['gender'];
dateOfBirth = json['date_of_birth'];
if (json['interest'] != null) {
@@ -75,6 +86,19 @@ class Data {
battingAverage = json['batting_average'];
follows =
json['follows'] != null ? new Follows.fromJson(json['follows']) : null;
if (json['timelines'] != null) {
timelines = <Timelines>[];
json['timelines'].forEach((v) {
timelines!.add(new Timelines.fromJson(v));
});
}
accountVisibility = json['account_visibility'];
if (json['my_joined_subgroups'] != null) {
myJoinedSubgroups = <MyJoinedSubgroups>[];
json['my_joined_subgroups'].forEach((v) {
myJoinedSubgroups!.add(new MyJoinedSubgroups.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
@@ -82,6 +106,7 @@ class Data {
data['id'] = this.id;
data['user_name'] = this.userName;
data['full_name'] = this.fullName;
data['profile_image'] = this.profileImage;
data['gender'] = this.gender;
data['date_of_birth'] = this.dateOfBirth;
if (this.interest != null) {
@@ -95,6 +120,14 @@ class Data {
data['batting_average'] = this.battingAverage;
if (this.follows != null) {
data['follows'] = this.follows!.toJson();
}
if (this.timelines != null) {
data['timelines'] = this.timelines!.map((v) => v.toJson()).toList();
}
data['account_visibility'] = this.accountVisibility;
if (this.myJoinedSubgroups != null) {
data['my_joined_subgroups'] =
this.myJoinedSubgroups!.map((v) => v.toJson()).toList();
}
return data;
}
@@ -119,6 +152,77 @@ class Interest {
}
}
class Timelines {
int? id;
String? clubName;
String? roleName;
String? teamName;
String? startDate;
String? endDate;
String? abilitiesXids;
List<Abilities>? abilities;
Timelines(
{this.id,
this.clubName,
this.roleName,
this.teamName,
this.startDate,
this.endDate,
this.abilitiesXids,
this.abilities});
Timelines.fromJson(Map<String, dynamic> json) {
id = json['id'];
clubName = json['club_name'];
roleName = json['role_name'];
teamName = json['team_name'];
startDate = json['start_date'];
endDate = json['end_date'];
abilitiesXids = json['abilities_xids'];
if (json['abilities'] != null) {
abilities = <Abilities>[];
json['abilities'].forEach((v) {
abilities!.add(new Abilities.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['club_name'] = this.clubName;
data['role_name'] = this.roleName;
data['team_name'] = this.teamName;
data['start_date'] = this.startDate;
data['end_date'] = this.endDate;
data['abilities_xids'] = this.abilitiesXids;
if (this.abilities != null) {
data['abilities'] = this.abilities!.map((v) => v.toJson()).toList();
}
return data;
}
}
class Abilities {
int? id;
String? name;
Abilities({this.id, this.name});
Abilities.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}
class Follows {
int? following;
int? followers;
@@ -137,3 +241,62 @@ class Follows {
return data;
}
}
class MyJoinedSubgroups {
int? id;
int? iamPrincipalXid;
int? manageGroupXid;
int? manageSubGroupXid;
SubGroupData? subGroupData;
MyJoinedSubgroups(
{this.id,
this.iamPrincipalXid,
this.manageGroupXid,
this.manageSubGroupXid,
this.subGroupData});
MyJoinedSubgroups.fromJson(Map<String, dynamic> json) {
id = json['id'];
iamPrincipalXid = json['iam_principal_xid'];
manageGroupXid = json['manage_group_xid'];
manageSubGroupXid = json['manage_sub_group_xid'];
subGroupData = json['sub_group_data'] != null
? new SubGroupData.fromJson(json['sub_group_data'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['iam_principal_xid'] = this.iamPrincipalXid;
data['manage_group_xid'] = this.manageGroupXid;
data['manage_sub_group_xid'] = this.manageSubGroupXid;
if (this.subGroupData != null) {
data['sub_group_data'] = this.subGroupData!.toJson();
}
return data;
}
}
class SubGroupData {
int? id;
String? title;
String? subGroupImage;
SubGroupData({this.id, this.title, this.subGroupImage});
SubGroupData.fromJson(Map<String, dynamic> json) {
id = json['id'];
title = json['title'];
subGroupImage = json['sub_group_image'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['title'] = this.title;
data['sub_group_image'] = this.subGroupImage;
return data;
}
}

View File

@@ -5,12 +5,19 @@ import 'package:get/get.dart';
import 'package:regroup/Common/CommonBottomNavigationBar.dart';
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/ViewModel/EditProfileApi.dart';
import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/view_model/profilePostmethod.dart';
import 'package:regroup/Utils/Common/blureffect.dart';
import 'package:regroup/Utils/Common/sized_box.dart';
import 'package:regroup/Utils/dialogs.dart';
import 'package:regroup/Utils/texts.dart';
import 'package:regroup/resources/routes/route_name.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:intl/intl.dart';
class ProfileTab extends StatefulWidget {
const ProfileTab({super.key});
@@ -143,6 +150,25 @@ class _ProfileTabState extends State<ProfileTab> {
}
}
int? timelineremoveid;
RemoveTimelineUploadata() async {
utils.loader();
Map<String, dynamic> updata = {
"timeline_id": timelineremoveid,
};
final data = await Profilepostmethod().postRemoveTimeline(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(
@@ -368,7 +394,11 @@ class _ProfileTabState extends State<ProfileTab> {
Spacer(),
InkWell(
onTap: () {
Get.toNamed(RouteName.addtimeline);
Get.toNamed(RouteName.addtimeline,
arguments: {
'id': 0,
'edit': false,
});
},
child: Image.asset(
"assets/images/png/iconamoon_edit-thin.png",
@@ -379,91 +409,346 @@ class _ProfileTabState extends State<ProfileTab> {
],
),
sizedBoxHeight(20.h),
SizedBox(
height: 300.h,
child: ListView.builder(
shrinkWrap: true,
itemCount: timeline.length,
itemBuilder: (context, index) {
return commonTimelineCard(
imagePath: timeline[index]
["imagePath"],
title: timeline[index]
["title"]);
},
)),
getEditProfileIndi!.data!.timelines!.isEmpty
? Center(
child:
text18w700white("Add timeline"))
: SizedBox(
height: 200.h,
child: ListView.builder(
shrinkWrap: true,
itemCount: getEditProfileIndi!
.data!.timelines!.length,
itemBuilder: (context, index) {
DateTime startDate =
DateTime.parse(
getEditProfileIndi!
.data!
.timelines![index]
.startDate!);
DateTime endDate =
DateTime.parse(
getEditProfileIndi!
.data!
.timelines![index]
.endDate!);
String formattedStartDate =
DateFormat('dd MMMM yyyy')
.format(startDate);
String formattedEndDate =
DateFormat('dd MMMM yyyy')
.format(endDate);
// Combine formatted dates
String startToEnd =
'$formattedStartDate - $formattedEndDate';
var timeline =
getEditProfileIndi!.data!
.timelines![index];
List<Map<String, dynamic>>
abilities =
timeline.abilities!
.map((ability) => {
'id': ability.id,
'name':
ability.name,
})
.toList();
return
// commonTimelineCard(
// imagePath: getEditProfileIndi
// ?.data
// ?.profileImage ??
// '',
// title: getEditProfileIndi!
// .data!
// .timelines![index]
// .clubName!,
// role: getEditProfileIndi!
// .data!
// .timelines![index]
// .roleName!,
// teamname: getEditProfileIndi!
// .data!
// .timelines![index]
// .teamName!,
// abilities: abilities,
// id: getEditProfileIndi!.data!
// .timelines![index].id,
// starttoend: startToEnd,
// );
Row(
children: [
Container(
width: 10,
height: 170.h,
child: Stack(
clipBehavior: Clip.none,
children: [
Positioned(
top: 50.h,
child: Container(
height: 11.h,
width: 11.w,
decoration: BoxDecoration(
color: Colors
.white,
shape: BoxShape
.circle)),
),
Positioned(
right: 3.w,
child: Container(
width: 1.w,
height: 170.h,
decoration:
BoxDecoration(
color: Colors
.white),
),
),
],
),
),
sizedBoxWidth(20.w),
Expanded(
child: Column(
children: [
commonGlassUI(
width:
double.infinity,
height: 155.h,
borderRadius:
BorderRadius
.circular(
10.r),
customWidget:
Padding(
padding: EdgeInsets
.only(
left:
16.w,
right:
16.w,
top:
10.h),
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
mainAxisAlignment:
MainAxisAlignment
.center,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Row(
children: [
getEditProfileIndi?.data?.profileImage == null || getEditProfileIndi!.data!.profileImage!.isEmpty
? CircleAvatar(radius: 10.r, backgroundImage: AssetImage('assets/images/png/cimg1.png'))
: CircleAvatar(radius: 10.r, backgroundImage: NetworkImage(getEditProfileIndi!.data!.profileImage!)),
sizedBoxWidth(
8.w),
getEditProfileIndi!.data!.timelines![index].clubName == null || getEditProfileIndi!.data!.timelines![index].clubName!.isEmpty
? text14700white('Regroup')
: 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,
),
),
)
],
),
sizedBoxHeight(
10.h),
getEditProfileIndi!.data!.timelines![index].roleName ==
null ||
getEditProfileIndi!
.data!
.timelines![
index]
.roleName!
.isEmpty
? text12700white(
'regroup')
: text12700white(getEditProfileIndi!
.data!
.timelines![
index]
.roleName!),
sizedBoxHeight(
10.h),
getEditProfileIndi!.data!.timelines![index].teamName ==
null ||
getEditProfileIndi!
.data!
.timelines![
index]
.teamName!
.isEmpty
? text12700white(
'regroup')
: text12700white(getEditProfileIndi!
.data!
.timelines![
index]
.teamName!),
sizedBoxHeight(
10.h),
startToEnd
.isEmpty
? text12400white(
'No date')
: text12400white(
startToEnd),
sizedBoxHeight(
10.h),
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:
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();
}
},
),
),
],
),
),
// border: 1
),
],
),
),
],
);
},
)),
sizedBoxHeight(30.h),
]),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
sizedBoxHeight(30.h),
Row(
children: [
text16w700white(
"Certifications/Qualifications"),
Spacer(),
InkWell(
onTap: () {
Get.toNamed(RouteName.certificate);
},
child: text12400white("View more")),
],
),
sizedBoxHeight(20.h),
SizedBox(
height: 85.h,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: certificationData.length,
itemBuilder: (context, index) {
return Padding(
padding: EdgeInsets.only(right: 20.w),
child: certificationCardTile(
imagePath:
certificationData[index]
["imagePath"],
title: certificationData[index]
["title"],
subtitle: certificationData[index]
["subtitle"],
date: certificationData[index]
["date"]),
);
},
),
),
sizedBoxHeight(30.h),
text18w400white("Subgroups"),
sizedBoxHeight(20.h),
text18w700white("Subgroups"),
],
),
),
sizedBoxHeight(20.h),
SizedBox(
height: 190.h,
width: double.infinity,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
padding: EdgeInsets.only(left: 16.w),
itemCount: cardtile.length,
itemCount: getEditProfileIndi!
.data!.myJoinedSubgroups!.length,
itemBuilder: (context, index) {
return Padding(
padding: EdgeInsets.only(right: 20.w),
child: profilecardtile(
imagePath: cardtile[index]["imagePath"],
title: cardtile[index]["title"]),
imagePath: getEditProfileIndi!
.data!
.myJoinedSubgroups![index]
.subGroupData!
.subGroupImage ??
'',
// cardtile[index]["imagePath"],
title: getEditProfileIndi!
.data!
.myJoinedSubgroups![index]
.subGroupData!
.title!
// cardtile[index]["title"]
),
);
},
),
),
sizedBoxHeight(30.h),
Padding(
padding: EdgeInsets.only(left: 16.w),
child: text18w700white("Activity"),
),
normalcardtile(
profileImg: 'assets/images/png/Ellipse 48.png',
title: 'Jocelyn Dokidis',
@@ -905,52 +1190,17 @@ class _ProfileTabState extends State<ProfileTab> {
);
}
Widget certificationCardTile({
required String imagePath,
required String title,
required String subtitle,
required String date,
}) {
return commonGlassUI(
width: 270.w,
height: 70.h,
borderRadius: BorderRadius.circular(10.r),
customWidget: Padding(
padding: EdgeInsets.symmetric(horizontal: 12.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
height: 40.h,
width: 57.w,
child: Image.asset(
imagePath,
fit: BoxFit.cover,
),
),
sizedBoxWidth(10.w),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
text12400white(title),
sizedBoxHeight(5.h),
text9400white(subtitle),
sizedBoxHeight(5.h),
text9400white(date)
],
),
),
],
),
),
// border: 1
);
}
Widget commonTimelineCard(
{required String imagePath, required String title}) {
Widget commonTimelineCard({
required String? imagePath,
required String? title,
required String? role,
required String? teamname,
required String? starttoend,
required int? id,
required List<Map<String, dynamic>>? abilities,
}) {
return Row(
children: [
Container(
@@ -984,31 +1234,104 @@ class _ProfileTabState extends State<ProfileTab> {
children: [
commonGlassUI(
width: double.infinity,
height: 145.h,
height: 155.h,
borderRadius: BorderRadius.circular(10.r),
customWidget: Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 10.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CircleAvatar(
radius: 10.r,
backgroundImage: AssetImage(imagePath),
Row(
children: [
imagePath == null || imagePath.isEmpty
? CircleAvatar(
radius: 10.r,
backgroundImage: AssetImage(
'assets/images/png/cimg1.png'))
: CircleAvatar(
radius: 10.r,
backgroundImage: NetworkImage(imagePath)),
sizedBoxWidth(8.w),
title == null || title.isEmpty
? text14700white('Regroup')
: text14700white(title)
],
),
sizedBoxWidth(8.w),
text14700white(title)
InkWell(
onTap: () {
setState(() {
timelineremoveid = id;
});
// Get.toNamed(RouteName.addtimeline, arguments: {
// 'id': 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,
),
),
)
],
),
sizedBoxHeight(10.h),
text12700white("Team captain"),
sizedBoxHeight(8.h),
text12400white("April 2023 - May 2024"),
role == null || role.isEmpty
? text12700white('regroup')
: text12700white(role),
sizedBoxHeight(10.h),
text10400whiteblur(
"Lorem Ipsum is simply dummy text of the printing and typesetting industry.")
teamname == null || teamname.isEmpty
? text12700white('regroup')
: text12700white(teamname),
sizedBoxHeight(10.h),
starttoend == null || starttoend.isEmpty
? text12400white('No date')
: text12400white(starttoend),
sizedBoxHeight(10.h),
abilities == null || 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: 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();
}
},
),
),
],
),
),
@@ -1385,19 +1708,24 @@ class _ProfileTabState extends State<ProfileTab> {
));
}
Widget profilecardtile({required String imagePath, required String title}) {
Widget profilecardtile({required String? imagePath, required String? title}) {
return Column(
children: [
Container(
height: 109.h,
width: 100.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.r),
),
child: Image.asset(imagePath),
),
height: 109.h,
width: 100.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.r),
),
child: imagePath == null || imagePath.isEmpty
? Image.asset('assets/images/png/Rectangle 29ss.png')
: Image.network(imagePath)),
sizedBoxHeight(10.h),
SizedBox(width: 100.w, child: text12w700_FCFCFC(title)),
SizedBox(
width: 100.w,
child: title == null || title.isEmpty
? text12w700_FCFCFC('Reegroup')
: text12w700_FCFCFC(title)),
],
);
}

View File

@@ -8,6 +8,8 @@ import 'package:shared_preferences/shared_preferences.dart';
GetEditProfileIndi? getEditProfileIndi;
GetEditProfileBus? getEditProfileBus;
bool accountvisibility = true;
class EditProfileApi {
EditProfileApi();
@@ -34,6 +36,12 @@ class EditProfileApi {
if (response.status == ResponseStatus.SUCCESS) {
if (response.data["status"] == "success") {
print("Success---->");
if (getEditProfileIndi!.data!.accountVisibility == 1) {
accountvisibility = true;
} else {
accountvisibility = false;
}
print(accountvisibility.toString());
return ResponseData<dynamic>(
response.data['message'], ResponseStatus.SUCCESS,
data: response.data);

View File

@@ -0,0 +1,116 @@
class GetEditTimelineModel {
String? status;
int? statusCode;
String? message;
Data? data;
GetEditTimelineModel({this.status, this.statusCode, this.message, this.data});
GetEditTimelineModel.fromJson(Map<String, dynamic> json) {
status = json['status'];
statusCode = json['status_code'];
message = json['message'];
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
}
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!.toJson();
}
return data;
}
}
class Data {
List<Abilities>? abilities;
TimelineData? timelineData;
Data({this.abilities, this.timelineData});
Data.fromJson(Map<String, dynamic> json) {
if (json['abilities'] != null) {
abilities = <Abilities>[];
json['abilities'].forEach((v) {
abilities!.add(new Abilities.fromJson(v));
});
}
timelineData = json['timeline_data'] != null
? new TimelineData.fromJson(json['timeline_data'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.abilities != null) {
data['abilities'] = this.abilities!.map((v) => v.toJson()).toList();
}
if (this.timelineData != null) {
data['timeline_data'] = this.timelineData!.toJson();
}
return data;
}
}
class Abilities {
int? id;
String? name;
Abilities({this.id, this.name});
Abilities.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}
class TimelineData {
int? id;
String? clubName;
String? roleName;
String? teamName;
String? startDate;
String? endDate;
String? abilitiesXids;
TimelineData(
{this.id,
this.clubName,
this.roleName,
this.teamName,
this.startDate,
this.endDate,
this.abilitiesXids});
TimelineData.fromJson(Map<String, dynamic> json) {
id = json['id'];
clubName = json['club_name'];
roleName = json['role_name'];
teamName = json['team_name'];
startDate = json['start_date'];
endDate = json['end_date'];
abilitiesXids = json['abilities_xids'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['club_name'] = this.clubName;
data['role_name'] = this.roleName;
data['team_name'] = this.teamName;
data['start_date'] = this.startDate;
data['end_date'] = this.endDate;
data['abilities_xids'] = this.abilitiesXids;
return data;
}
}

View File

@@ -0,0 +1,51 @@
class TimelineAbilityListModel {
String? status;
int? statusCode;
String? message;
List<Data>? data;
TimelineAbilityListModel(
{this.status, this.statusCode, this.message, this.data});
TimelineAbilityListModel.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? name;
Data({this.id, this.name});
Data.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}

View File

@@ -3,11 +3,16 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.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/view_model/profilePostmethod.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/dialogs.dart';
import 'package:regroup/Utils/texts.dart';
import 'package:regroup/resources/routes/route_name.dart';
import 'package:shared_preferences/shared_preferences.dart';
class AccountSettings extends StatefulWidget {
const AccountSettings({super.key});
@@ -17,7 +22,46 @@ class AccountSettings extends StatefulWidget {
}
class _AccountSettingsState extends State<AccountSettings> {
bool swichvalue = false;
// bool swichvalue = false;
Future<void> UploadData() async {
print("upload data called");
SharedPreferences prefs = await SharedPreferences.getInstance();
int? accountype ;
if (accountvisibility == false) {
accountype = 0;
}
else if (accountvisibility == true) {
accountype = 1;
}
Map<String, dynamic> updata = {
"is_account_visibility": accountype,
};
final data = await Profilepostmethod().postAccountvisibility(updata);
if (data.status == ResponseStatus.SUCCESS) {
String? accountype;
accountype = prefs.getString('accountTypefromLogin');
if (accountype == "1") {
EditProfileApi()
.getEditProfileIndividual();
}
else if (accountype == "2") {
EditProfileApi()
.getEditProfileBusiness();
}
return utils.showToast(data.message);
} else {
return utils.showToast(data.message);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -62,12 +106,15 @@ class _AccountSettingsState extends State<AccountSettings> {
Transform.scale(
scale: 0.9,
child: CupertinoSwitch(
value: swichvalue,
value: accountvisibility,
trackColor: Colors.white.withOpacity(0.4),
activeColor: Color(0xFF34C759),
onChanged: (bool? value) {
onChanged: (bool value) {
setState(() {
swichvalue = value ?? false;
accountvisibility = value;
UploadData();
// swichvalue = value ?? false;
});
}))
]),

View File

@@ -1,11 +1,20 @@
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';
import 'package:regroup/Common/CommonButton.dart';
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/CustomTextformfield.dart';
import 'package:regroup/Utils/Common/blureffect.dart';
import 'package:regroup/Utils/Common/sized_box.dart';
import 'package:regroup/Utils/dialogs.dart';
import 'package:regroup/Utils/texts.dart';
import 'package:regroup/resources/routes/route_name.dart';
import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart';
import 'package:shared_preferences/shared_preferences.dart';
class DeleteAccount extends StatefulWidget {
const DeleteAccount({super.key});
@@ -15,54 +24,113 @@ class DeleteAccount extends StatefulWidget {
}
class _DeleteAccountState extends State<DeleteAccount> {
TextEditingController leavingcontroller = TextEditingController();
Uploadata() async {
utils.loader();
Map<String, dynamic> updata = {
"reason": leavingcontroller.text,
};
final data = await Profilepostmethod().postDeleteaccount(updata);
if (data.status == ResponseStatus.SUCCESS) {
Get.back();
print("delete done");
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.remove('access-token');
await prefs.remove('fullname');
await prefs.remove('username');
await prefs.remove('email');
await prefs.remove('phone');
await prefs.remove('accountTypefromLogin');
await prefs.remove('principal_xid');
await prefs.remove('accountTypeValue');
await prefs.clear();
Get.offNamed(RouteName.loginScreen);
return utils.showToast(data.message);
} else {
Get.back();
print("delete not done");
return utils.showToast(data.message);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
// key: _scaffoldKey1,
resizeToAvoidBottomInset: false,
backgroundColor: Color(0xFF222935),
extendBody: true,
appBar: CommonAppbar(
titleTxt: "",
),
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: Color(0xFF222935),
extendBody: true,
appBar: CommonAppbar(
titleTxt: "",
),
SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(children: [
sizedBoxHeight(25.h),
text20400white("Sad to see you go"),
sizedBoxHeight(16.h),
Image.asset(
"assets/images/png/Frame 1.png",
height: 119.h,
width: 119.w,
),
sizedBoxHeight(20.h),
SizedBox(
width: 311.w,
child: text16400white(
"Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type ",
textAlign: TextAlign.center),
),
sizedBoxHeight(30.h),
text18w400white("Tell us why you are leaving ?"),
sizedBoxHeight(10.h),
CustomTextFormField2(
maxlines: 3,
),
sizedBoxHeight(20.h),
CommonBtn(text: "I dont want to delete"),
sizedBoxHeight(18.h),
text16400white("Yes I am ready to delete my account"),
]),
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),
text20400white("Sad to see you go"),
sizedBoxHeight(16.h),
Image.asset(
"assets/images/png/Frame 1.png",
height: 119.h,
width: 119.w,
),
sizedBoxHeight(20.h),
SizedBox(
width: 311.w,
child: text16400white(
"Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type ",
textAlign: TextAlign.center),
),
sizedBoxHeight(30.h),
text18w400white("Tell us why you are leaving ?"),
sizedBoxHeight(10.h),
CustomTextFormField2(
maxlines: 3,
hintText: "Enter why are you leaving",
validator: (value) {
if (value!.isEmpty) {
return 'Enter your full name ';
}
return null;
},
inputFormatters: [
// LengthLimitingTextInputFormatter(20),
RemoveEmojiInputFormatter(),
FilteringTextInputFormatter.allow(RegExp('[a-zA-Z ]'))
],
textEditingController: leavingcontroller,
),
sizedBoxHeight(20.h),
CommonBtn(text: "I dont want to delete"),
sizedBoxHeight(18.h),
GestureDetector(
onTap: () {
if (leavingcontroller.text.isBlank!) {
utils.showToast('Please tell us why are you leaving');
} else {
Uploadata();
}
},
child: text16400white(
"Yes I am ready to delete my account")),
]),
),
)
])),
);
}
}

View File

@@ -5,9 +5,12 @@ import 'package:get/get.dart';
import 'package:glassmorphism/glassmorphism.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/view_model/profilePostmethod.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/dialogs.dart';
import 'package:regroup/Utils/texts.dart';
import 'package:regroup/resources/routes/route_name.dart';
import 'package:shared_preferences/shared_preferences.dart';
@@ -20,6 +23,36 @@ class Settings extends StatefulWidget {
}
class _SettingsState extends State<Settings> {
Uploadata() async {
utils.loader();
final data = await Profilepostmethod().postLogoutaccount();
if (data.status == ResponseStatus.SUCCESS) {
Get.back();
print("delete done");
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.remove('access-token');
await prefs.remove('fullname');
await prefs.remove('username');
await prefs.remove('email');
await prefs.remove('phone');
await prefs.remove('accountTypefromLogin');
await prefs.remove('principal_xid');
await prefs.remove('accountTypeValue');
await prefs.clear();
Get.offNamed(RouteName.loginScreen);
return utils.showToast(data.message);
} else {
Get.back();
print("delete not done");
return utils.showToast(data.message);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -160,10 +193,11 @@ class _SettingsState extends State<Settings> {
children: [
GestureDetector(
onTap: () async {
SharedPreferences prefs =
await SharedPreferences.getInstance();
await prefs.clear();
Get.offAllNamed(RouteName.loginScreen);
// SharedPreferences prefs =
// await SharedPreferences.getInstance();
// await prefs.clear();
// Get.offAllNamed(RouteName.loginScreen);
Uploadata();
},
child: commonGlassContainer(
width: 130.w,

View File

@@ -1,3 +1,6 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -5,11 +8,13 @@ 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/Settings/Model/FetchBlockUser.dart';
import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Settings/ViewModel/BlockedUserApi.dart';
import 'package:regroup/Utils/Common/CommonAppbar.dart';
import 'package:regroup/Utils/Common/CustomTextformfield.dart';
import 'package:regroup/Utils/Common/sized_box.dart';
import 'package:regroup/Utils/texts.dart';
import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart';
import 'package:shared_preferences/shared_preferences.dart';
class BlockedUsers extends StatefulWidget {
@@ -57,13 +62,16 @@ class _BlockedUsersState extends State<BlockedUsers> {
"subtitle": "Lorem ipsum dummy text",
},
];
late Future myfuture;
// late Future myfuture;
double? blockedXid;
StreamController<FetchBlockedUser> searchcontroller = StreamController();
unblockDone(int index) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setInt('blockedprincipalxid',
fetchblockuser!.data![index].blockedIamPrincipalXid!);
fetchblockuserobj!.data![index].blockedIamPrincipalXid!);
blockedXid = prefs.getInt('blockedprincipalxid')!.toDouble();
Map<String, String> updata = {
"blocked_iam_principal_xid": blockedXid.toString(),
@@ -83,7 +91,7 @@ class _BlockedUsersState extends State<BlockedUsers> {
// utils.showToast('Unblock user successfully');
setState(() {
fetchblockuser!.data!.removeAt(index);
fetchblockuserobj!.data!.removeAt(index);
});
print('success');
} else {
@@ -104,11 +112,19 @@ class _BlockedUsersState extends State<BlockedUsers> {
@override
void initState() {
myfuture = BlockUserAPI().fetchBlockUser();
var updata = "";
// myfuture = BlockUserAPI().fetchBlockUser();
BlockUserAPI().getBlockedusers(updata, streamController: searchcontroller);
// TODO: implement initState
super.initState();
}
@override
void dispose() {
searchcontroller.close();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -119,96 +135,301 @@ class _BlockedUsersState extends State<BlockedUsers> {
appBar: CommonAppbar(
titleTxt: "Blocked users",
),
body: FutureBuilder(
future: myfuture,
builder: (ctx, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
child: CircularProgressIndicator(
color: Colors.blue,
body: Stack(children: [
Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/png/Ellipse 1496.png"),
fit: BoxFit.fill)),
),
SingleChildScrollView(
child:
Column(crossAxisAlignment: CrossAxisAlignment.start, 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!);
BlockUserAPI().getBlockedusers(value,
streamController: searchcontroller);
},
),
),
sizedBoxHeight(25.h),
if (snapshot.hasError) {
return Center(
child: Text(
'${snapshot.error} occurred',
style: TextStyle(fontSize: 18.spMin),
),
);
}
if (snapshot.connectionState == ConnectionState.done &&
snapshot.hasData) {
print("Data fetched-->");
return Stack(children: [
Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
"assets/images/png/Ellipse 1496.png"),
fit: BoxFit.fill)),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
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",
),
),
sizedBoxHeight(25.h),
Expanded(
child: ListView.builder(
// Expanded(
// child: ListView.builder(
// shrinkWrap: true,
// itemCount: fetchblockuser!.data!.length,
// itemBuilder: (context, index) {
// return Column(
// children: [
// blockedUser(
// imagePath: fetchblockuser!.data![index]
// .blockedProfile!.profilePhoto ??
// '',
// title: fetchblockuser!.data![index]
// .blockedProfile!.fullName ??
// '',
// subtitle: fetchblockuser!.data![index]
// .blockedProfile!.userName ??
// '',
// index: index),
// // blockedUser(
// // imagePath: blockedUserData[index]
// // ["imagePath"],
// // title: blockedUserData[index]["title"],
// // subtitle: blockedUserData[index]
// // ["subtitle"]),
// if (index != fetchblockuser!.data!.length - 1)
// commonDivider(),
// ],
// );
// },
// ),
// ),
StreamBuilder<FetchBlockedUser>(
stream: searchcontroller.stream,
builder: (ctx, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
// Display shimmer effect while waiting for data
return Center(child: CircularProgressIndicator());
} else if (snapshot.hasError) {
// Handle error state
return Center(
child: Text(
'${snapshot.error} occurred',
style: TextStyle(fontSize: 18),
),
);
} else {
// Data has been loaded, show actual UI
return fetchblockuserobj!.data!.isEmpty
? _buildNoDataBody(context)
: ListView.separated(
physics: ScrollPhysics(),
shrinkWrap: true,
itemCount: fetchblockuser!.data!.length,
itemCount: fetchblockuserobj!.data!.length,
separatorBuilder:
(BuildContext context, int index) {
return commonDivider();
},
itemBuilder: (context, index) {
return Column(
children: [
blockedUser(
imagePath: fetchblockuser!.data![index]
imagePath: fetchblockuserobj!.data![index]
.blockedProfile!.profilePhoto ??
'',
title: fetchblockuser!.data![index]
title: fetchblockuserobj!.data![index]
.blockedProfile!.fullName ??
'',
subtitle: fetchblockuser!.data![index]
subtitle: fetchblockuserobj!.data![index]
.blockedProfile!.userName ??
'',
index: index),
// blockedUser(
// imagePath: blockedUserData[index]
// ["imagePath"],
// title: blockedUserData[index]["title"],
// subtitle: blockedUserData[index]
// ["subtitle"]),
if (index != fetchblockuser!.data!.length - 1)
commonDivider(),
],
);
// Column(
// children: [
// Padding(
// padding: EdgeInsets.symmetric(
// vertical: 16.h, horizontal: 16.w),
// child: Row(
// children: [
// followingobj!.data![index].following!
// .profilePhoto ==
// null ||
// followingobj!
// .data![index]
// .following!
// .profilePhoto!
// .isEmpty
// ? CircleAvatar(
// backgroundImage: AssetImage(
// 'assets/images/png/Ellipse 43.png'),
// radius: 25.r,
// )
// : CircleAvatar(
// backgroundImage: NetworkImage(
// followingobj!
// .data![index]
// .following!
// .profilePhoto!),
// radius: 25.r,
// ),
// sizedBoxWidth(10.w),
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// followingobj!
// .data![index]
// .following!
// .fullName ==
// null ||
// followingobj!
// .data![index]
// .following!
// .fullName!
// .isEmpty
// ? text16w400_FCFCFC("Regroup")
// : text16w400_FCFCFC(
// followingobj!.data![index]
// .following!.fullName!),
// sizedBoxHeight(4.h),
// followingobj!
// .data![index]
// .following!
// .userName ==
// null ||
// followingobj!
// .data![index]
// .following!
// .userName!
// .isEmpty
// ? text12w400_FCFCFC_blur(
// "regroup")
// : text12w400_FCFCFC_blur(
// followingobj!.data![index]
// .following!.userName!)
// ],
// ),
// Spacer(),
// PopupMenuButton(
// surfaceTintColor: Color(0xFF222935),
// constraints:
// BoxConstraints.tightFor(
// width: 176.w),
// offset: Offset(0, 20),
// color: Color(0xFF222935),
// tooltip: "",
// itemBuilder: (BuildContext
// context) =>
// <PopupMenuEntry>[
// PopupMenuItem(
// onTap: () async {
// setState(() {
// unfollowid =
// followingobj!
// .data![
// index]
// .following!
// .id ??
// 0;
// // followingobj!.data!.removeAt(index);
// followingobj!.data!
// .removeWhere((item) =>
// item.following!
// .id ==
// unfollowid);
// Uploadata();
// });
// },
// child: Padding(
// padding:
// EdgeInsets.symmetric(
// horizontal: 12.w),
// child: Row(
// children: [
// text14400white(
// "Unfollow user"),
// Spacer(),
// Image.asset(
// "assets/images/png/Black1323e.png",
// height: 20.h,
// width: 20.w,
// )
// ],
// ),
// ),
// ),
// PopupMenuDivider(),
// PopupMenuItem(
// onTap: () {},
// child: Padding(
// padding:
// EdgeInsets.symmetric(
// horizontal: 12.w),
// child: Row(
// children: [
// text14400white(
// "Message user"),
// Spacer(),
// Image.asset(
// "assets/images/png/fluent_chat-20-22.png",
// height: 20.h,
// width: 20.w,
// )
// ],
// ),
// ),
// ),
// ],
// child: Container(
// height: 20,
// width: 20,
// child: Center(
// child: Image.asset(
// "assets/images/png/Group 1000004071.png",
// height: 22.h,
// width: 4.w,
// ),
// ),
// )),
// ],
// ),
// ),
// ],
// );
},
),
),
sizedBoxHeight(20.h)
])
]);
}
return Container();
}));
);
}
},
),
sizedBoxHeight(20.h)
]),
)
]));
}
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),
)
],
),
);
}
dialogwidget({required int index}) {
@@ -273,28 +494,39 @@ class _BlockedUsersState extends State<BlockedUsers> {
}
Widget blockedUser({
required String imagePath,
required String title,
required String subtitle,
required String? imagePath,
required String? title,
required String? subtitle,
required int index,
}) {
return Padding(
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 16.w),
child: Row(
children: [
CircleAvatar(
backgroundImage: NetworkImage(imagePath),
imagePath == null || imagePath.isEmpty
? CircleAvatar(
backgroundImage: AssetImage("assets/images/png/cimg3.png"),
// AssetImage(imagePath),
radius: 25.r,
),
// AssetImage(imagePath),
radius: 25.r,
)
: CircleAvatar(
backgroundImage: NetworkImage(imagePath),
// AssetImage(imagePath),
radius: 25.r,
),
sizedBoxWidth(10.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text16w400_FCFCFC(title),
title == null || title.isEmpty
? text16w400_FCFCFC("Regroup")
: text16w400_FCFCFC(title),
sizedBoxHeight(4.h),
text12w400_FCFCFC_blur(subtitle),
subtitle == null || subtitle.isEmpty
? text12w400_FCFCFC_blur('regroup')
: text12w400_FCFCFC_blur(subtitle),
],
),
Spacer(),

View File

@@ -1,32 +1,34 @@
import 'dart:async';
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/Settings/Model/FetchBlockUser.dart';
FetchBlockedUser? fetchblockuser;
FetchBlockedUser? fetchblockuserobj;
class BlockUserAPI {
BlockUserAPI();
Future<ResponseData<dynamic>> fetchBlockUser() async {
final response = await NetworkApiServices().getApi(
ApiUrls.getblockuser,
);
fetchblockuser = FetchBlockedUser.fromJson(response.data);
if (response.status == ResponseStatus.SUCCESS) {
if (response.data["status"] == "success") {
print("Success---->");
return ResponseData<dynamic>(
response.data['message'], ResponseStatus.SUCCESS,
data: response.data);
} else {
return ResponseData<dynamic>(
response.data['message'], ResponseStatus.FAILED);
}
}
// Future<ResponseData<dynamic>> fetchBlockUser() async {
// final response = await NetworkApiServices().getApi(
// ApiUrls.getblockuser,
// );
// fetchblockuser = FetchBlockedUser.fromJson(response.data);
// if (response.status == ResponseStatus.SUCCESS) {
// if (response.data["status"] == "success") {
// print("Success---->");
// return ResponseData<dynamic>(
// response.data['message'], ResponseStatus.SUCCESS,
// data: response.data);
// } else {
// return ResponseData<dynamic>(
// response.data['message'], ResponseStatus.FAILED);
// }
// }
return response;
}
// return response;
// }
Future<ResponseData<dynamic>> postBlockApi(var data) async {
final response = await NetworkApiServices().postApi(
@@ -50,4 +52,19 @@ class BlockUserAPI {
return response;
}
Future<ResponseData<dynamic>> getBlockedusers(updata,
{required StreamController<FetchBlockedUser> streamController}) async {
final response =
await NetworkApiServices().getApi(
"${ApiUrls.getblockuser}?search=$updata",
);
if (response.status == ResponseStatus.SUCCESS) {
fetchblockuserobj = FetchBlockedUser.fromJson(response.data);
if (!streamController.isClosed) streamController.sink.add(fetchblockuserobj!);
}
return response;
}
}

View File

@@ -0,0 +1,32 @@
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/timelineabilityModel.dart';
class TimelineAbilityListApi {
TimelineAbilityListApi();
var data = "";
Future<ResponseData<dynamic>> getAbilitylistApi() async {
final response = await NetworkApiServices().getApi(
ApiUrls.gettimelineabilitylist,
);
if (response.status == ResponseStatus.SUCCESS) {
Map<String, dynamic> responseData =
Map<String, dynamic>.from(response.data);
if (responseData['status'] == "success") {
print("success");
TimelineAbilityListModel timelineabilitylistobj =
TimelineAbilityListModel.fromJson(responseData);
} else {
// return ResponseData<dynamic>(
// responseData['message'], ResponseStatus.FAILED);
}
}
return response;
}
}

View File

@@ -4,19 +4,24 @@ 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/editTimelineModel.dart';
import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/faqModel.dart';
import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/followersModel.dart';
import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/followingModel.dart';
import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/privacyPolicyModel.dart';
import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/termsconditionsModel.dart';
// import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/timelineabilityModel.dart';
FaqModel? faqobj;
PrivacypolicyModel? privacyobj;
TermsConditionsModel? termsobj;
FollowersModel? followersobj;
FollowingModel? followingobj;
GetEditTimelineModel? edittimelineobj;
class Profilegetmethod {
// Profilegetmethod();
Future<ResponseData<dynamic>> getFaqs() async {
final response = await NetworkApiServices().getApi(
ApiUrls.getfaqs,
@@ -78,4 +83,14 @@ class Profilegetmethod {
}
return response;
}
Future<ResponseData<dynamic>> getEditTimeline(int data) async {
final response = await NetworkApiServices().getApi(ApiUrls.getedittimeline + "/?timeline_id=${data}");
if (response.status == ResponseStatus.SUCCESS) {
edittimelineobj = GetEditTimelineModel.fromJson(response.data);
log(edittimelineobj!.data.toString());
}
return response;
}
}

View File

@@ -1,9 +1,20 @@
import 'dart:convert';
import 'dart:developer';
import 'package:dio/dio.dart';
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:shared_preferences/shared_preferences.dart';
class Profilepostmethod {
Profilepostmethod();
Dio dio = Dio();
String basicAuth = 'Basic ' +
base64.encode(
utf8.encode('RegroupUserName:71%@L%es^bUX94`J9XT*@bh,._WWM{\$%^^&&'));
Future<ResponseData<dynamic>> postContactus(updata) async {
print("updata is $updata");
@@ -81,4 +92,130 @@ class Profilepostmethod {
print("response message is ${response.message}");
return response;
}
Future<ResponseData<dynamic>> postTimeline(updata) async {
print("updata is $updata");
final response = await NetworkApiServices().postApi(
updata,
ApiUrls.posttimeline,
);
print("response is ${response.data}");
print("response message is ${response.message}");
return response;
}
Future<ResponseData<dynamic>> postAccountvisibility(updata) async {
print("updata is $updata");
final response = await NetworkApiServices().postApi(
updata,
ApiUrls.postaccountvisibility,
);
print("response is ${response.data}");
print("response message is ${response.message}");
return response;
}
Future<ResponseData<dynamic>> postDeleteaccount(updata) async {
print("updata is $updata");
final response = await NetworkApiServices().postApi(
updata,
ApiUrls.postdeleteaccount,
);
print("response is ${response.data}");
print("response message is ${response.message}");
return response;
}
Future<ResponseData<dynamic>> postLogoutaccount() async {
Response response;
SharedPreferences prefs = await SharedPreferences.getInstance();
String? token = prefs.getString('access-token');
try {
response = await dio.post(
ApiUrls.postlogoutaccount,
options:
Options(
headers: {'authorization': basicAuth, 'access-token': token},
),
);
log(response.toString());
} on Exception catch (e) {
if (e is DioException) {
log(e.response.toString());
if (e.response == null) {
return ResponseData<dynamic>(
'Oops something Went Wrong, Please try again!',
ResponseStatus.FAILED,
);
}
if (e.response!.statusCode == 401) {
prefs.remove('token');
prefs.remove('refreshToken');
// Get.toNamed(RouteName.login);
return ResponseData<dynamic>(
'Oops something Went Wrong, Please try again!',
ResponseStatus.FAILED,
);
}
if (e.response!.statusCode == 403) {
if (e.response!.data['message'] is List) {
return ResponseData<dynamic>(
e.response!.data['message'][0]!, ResponseStatus.FAILED,
data: e.response!.data);
} else {
return ResponseData<dynamic>(
e.response!.data['message'], ResponseStatus.FAILED,
data: e.response!.data);
}
}
}
return ResponseData<dynamic>(
'Oops something Went Wrong',
ResponseStatus.FAILED,
);
}
if (response.statusCode == 200 || response.statusCode == 201) {
return ResponseData<dynamic>("success", ResponseStatus.SUCCESS,
data: response.data);
} else if (response.statusCode == 203) {
print(response.data);
return ResponseData<dynamic>("success", ResponseStatus.PRIVATE,
data: response.data);
} else {
try {
return ResponseData<dynamic>(
response.data['message'].toString(), ResponseStatus.FAILED);
} catch (_) {
return ResponseData<dynamic>(
response.statusMessage!, ResponseStatus.FAILED);
}
}
}
Future<ResponseData<dynamic>> postEditTimeline(updata) async {
print("updata is $updata");
final response = await NetworkApiServices().postApi(
updata,
ApiUrls.posttimeline,
);
print("response is ${response.data}");
print("response message is ${response.message}");
return response;
}
Future<ResponseData<dynamic>> postRemoveTimeline(updata) async {
print("updata is $updata");
final response = await NetworkApiServices().postApi(
updata,
ApiUrls.postremovetimeline,
);
print("response is ${response.data}");
print("response message is ${response.message}");
return response;
}
}