Merge pull request #63 from WDI-Ideas/sprint2profile

some bugs resolved in guest view and profile view
This commit is contained in:
Shubham Shetty
2024-07-25 15:41:30 +05:30
committed by GitHub
21 changed files with 2319 additions and 1050 deletions

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:regroup/Common/CommonGlassmorphism.dart';
import 'package:regroup/Utils/Common/sized_box.dart';
@@ -265,6 +266,73 @@ Widget stackContainers({
);
}
Widget stackContainersGroups({
required String number,
required List<String> containerImages,
}) {
// Define the maximum number of images to display
const maxImagesToShow = 3;
// Calculate the number of images to show and the remaining count
final remainingCount = containerImages.length - maxImagesToShow;
final imagesToShow = containerImages.take(maxImagesToShow).toList();
return Row(
children: [
Stack(
clipBehavior: Clip.none,
children: [
Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFFD90B2E),
border: Border.all(color: Color(0xFF2C3742), width: 1),
),
child: Center(
child: Text(
remainingCount > 0 ? '+$remainingCount' : '',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w400,
fontSize: 8,
),
),
),
),
Positioned(
left: 22.w,
child: SizedBox(
height: 30,
width: 30 * maxImagesToShow.toDouble(),
child: Stack(
clipBehavior: Clip.none,
children: List.generate(imagesToShow.length, (index) {
return Positioned(
left: index * 22.0,
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color: Color(0xFF2C3742), width: 1),
),
child: CircleAvatar(
backgroundImage: NetworkImage(imagesToShow[index]),
),
),
);
}),
),
),
),
],
),
],
);
}
Widget stackContainers2({
required List<String> containerImages,
}) {

View File

@@ -34,7 +34,6 @@ class ApiUrls {
static const getuserdetails = "${baseUrl}get-auth-user-data";
static const getfaqs = "${baseUrl}fetch-faqs";
static const getprivacypolicy = "${baseUrl}fetch-privacy-policy";
@@ -83,11 +82,9 @@ class ApiUrls {
static const postuserdevice = "${baseUrl}store-account-session";
static const getmyjoinedgroups = "${baseUrl}my-joined-groups";
static const getusercertificates = "${baseUrl}my-certificates";
static const postnotification = "${baseUrl}update-notification-settings";
static const getnotification = "${baseUrl}fetch-notification-settings";
@@ -95,7 +92,6 @@ class ApiUrls {
static const getblockuser = "${baseUrl}fetch-blocked-profile";
static const postblockuser = "${baseUrl}block-profile";
// Individual
static const posteditprofile = "${baseUrl}update-profile";
static const geteditprofile = "${baseUrl}fetch-profile";
@@ -106,13 +102,11 @@ class ApiUrls {
//Guest
static const getGuestProfileInd = "${baseUrl}get-guest-view-of-individual-user-profile";
static const getGuestProfileBus = "${baseUrl}get-guest-view-of-business-user-profile";
static const getGuestProfileInd =
"${baseUrl}get-guest-view-of-individual-user-profile";
static const getGuestProfileBus =
"${baseUrl}get-guest-view-of-business-user-profile";
static const getGuestfollowers = "${baseUrl}get-guest-user-followers";
static const getGuestfollowing = "${baseUrl}get-guest-user-following";
}

View File

@@ -15,6 +15,7 @@ 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:regroup/resources/routes/route_name.dart';
import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart';
import 'package:path/path.dart' as path;
@@ -115,7 +116,8 @@ class _AddCertificateState extends State<AddCertificate> {
final data = await Profilepostmethod().postCertification(formdata);
if (data.status == ResponseStatus.SUCCESS) {
Get.back();
Get.back();
// Get.back();
Get.toNamed(RouteName.mainscreen, arguments: 4);
return utils.showToast(data.message);
} else {
Get.back();

View File

@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/EditProfile/ViewModel/EditProfileApi.dart';
import 'package:get/get.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/sized_box.dart';
import 'package:regroup/Utils/texts.dart';
@@ -40,6 +41,17 @@ class _CertificateState extends State<Certificate> {
},
];
late Future myfuture;
int id = Get.arguments["id"];
@override
void initState() {
// TODO: implement initState
myfuture = Profilegetmethod().getUserCertificates(id);
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -51,7 +63,7 @@ class _CertificateState extends State<Certificate> {
),
resizeToAvoidBottomInset: false,
body: FutureBuilder(
future: EditProfileApi().getEditProfileIndividual(),
future: myfuture,
builder: (ctx, snapshot) {
if (snapshot.data == null) {
return const Column(
@@ -76,7 +88,7 @@ class _CertificateState extends State<Certificate> {
);
}
}
return getEditProfileIndi!.data!.certifications!.isEmpty
return certificateobj!.data!.isEmpty
? _buildNoDataBody(context)
: _buildBody(context);
},
@@ -126,51 +138,43 @@ class _CertificateState extends State<Certificate> {
crossAxisSpacing: 8,
childAspectRatio: 0.65,
),
itemCount:
getEditProfileIndi!.data!.certifications!.length,
itemCount: certificateobj!.data!.length,
itemBuilder: (context, index) {
return Column(
// mainAxisAlignment: MainAxisAlignment.start,
children: [
getEditProfileIndi!.data!.certifications![index]
.certificationImage ==
certificateobj!.data![index].certificationImage ==
null ||
getEditProfileIndi!
.data!
.certifications![index]
.certificationImage!
.isEmpty
certificateobj!.data![index]
.certificationImage!.isEmpty
? Image.asset(
CertificateData[index]["imagePath"],
height: 100.h,
width: 105.w,
)
: Image.network(
getEditProfileIndi!
.data!
.certifications![index]
.certificationImage!,
certificateobj!
.data![index].certificationImage!,
height: 100.h,
width: 105.w,
),
errorBuilder: (context, error, stackTrace) {
// Error handling when image fails to load
return Image.asset(
CertificateData[index]["imagePath"],
fit: BoxFit.cover,
);
}),
Expanded(
child: Center(
child: text14w400_FCFCFC(
getEditProfileIndi!
.data!
.certifications![index]
certificateobj!.data![index]
.certificationName ==
null ||
getEditProfileIndi!
.data!
.certifications![index]
.certificationName!
.isEmpty
certificateobj!.data![index]
.certificationName!.isEmpty
? CertificateData[index]["text"]
: getEditProfileIndi!
.data!
.certifications![index]
.certificationName,
: certificateobj!
.data![index].certificationName,
textAlign: TextAlign.center,
),
),

View File

@@ -114,8 +114,10 @@ class _ProfileTabState extends State<ProfileTab> {
setValues() async {
if (isOnce) {
SharedPreferences prefs = await SharedPreferences.getInstance();
accountTypeValue = prefs.getString('accountTypeValue');
// accountTypeValue = prefs.getString('accountTypeValue');
accounTypeLogin = prefs.getString('accountTypefromLogin');
print('account tupe login is $accounTypeLogin');
// print('account tupe value is $accountTypeValue');
if (getEditProfileIndi!.data!.interest != null) {
// Join all interest names with a comma separator
@@ -130,8 +132,10 @@ class _ProfileTabState extends State<ProfileTab> {
setValues2() async {
if (isOnce) {
SharedPreferences prefs = await SharedPreferences.getInstance();
accountTypeValue = prefs.getString('accountTypeValue');
// accountTypeValue = prefs.getString('accountTypeValue');
accounTypeLogin = prefs.getString('accountTypefromLogin');
print('account tupe login is $accounTypeLogin');
// print('account tupe value is $accountTypeValue');
// foodItemDropdownController.selectedFooddynamic.clear();
// foodItemDropdownController.foodItemQControllerList.clear();
// foodItemDropdownController.OtherFoodIngredientList.clear();
@@ -197,18 +201,20 @@ class _ProfileTabState extends State<ProfileTab> {
backgroundColor: Color(0xFF222935),
extendBody: true,
// accountTypeValue == '1' ||
body: accounTypeLogin == '1' || accountTypeValue == '1'
body: accounTypeLogin == '1'
// || accountTypeValue == '1'
? FutureBuilder(
future: individualfuture,
builder: (ctx, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return ShimmerCommon();
return
// ShimmerCommon();
// Center(
// child: CircularProgressIndicator(
// color: Colors.blue,
// ),
// );
Center(
child: CircularProgressIndicator(
color: Colors.blue,
),
);
}
if (snapshot.hasError) {
@@ -239,13 +245,30 @@ class _ProfileTabState extends State<ProfileTab> {
Stack(
children: [
Container(
height: 484.h,
width: double.infinity,
child: Image.asset(
"assets/images/png/profileimg.png",
fit: BoxFit.cover,
),
),
height: 484.h,
width: double.infinity,
child: getEditProfileIndi!
.data!.profilePhoto ==
null ||
getEditProfileIndi!
.data!.profilePhoto!.isEmpty
? Image.asset(
"assets/images/png/profileimg.png",
fit: BoxFit.cover,
)
: Image.network(
getEditProfileIndi!
.data!.profilePhoto!,
fit: BoxFit.cover,
errorBuilder:
(context, error, stackTrace) {
// Error handling when image fails to load
return Image.asset(
"assets/images/png/profileimg.png",
fit: BoxFit.cover,
);
},
)),
Positioned.fill(
child: Container(
decoration: BoxDecoration(
@@ -746,10 +769,15 @@ class _ProfileTabState extends State<ProfileTab> {
getEditProfileIndi!.data!.timelines![index].abilities!.length,
itemBuilder:
(context, innerIndex) {
List<String> abilityName = getEditProfileIndi!.data!.timelines![index].abilities![innerIndex].name!.split('pattern');
String abilityName = getEditProfileIndi!.data!.timelines![index].abilities![innerIndex].name!;
// List<String> abilityName = getEditProfileIndi!.data!.timelines![index].abilities![innerIndex].name!.split(',');
// String formattedNames = abilityName.join(', ');
List<String> abilityNames = abilityName.split(',').map((e) => e.trim()).toList();
String formattedNames = abilityNames.join(', ');
print(formattedNames);
return Padding(
padding: EdgeInsets.only(right: 8.w),
child: text10400whiteblur(abilityName.toString()),
child: text10400whiteblur(formattedNames),
);
},
),
@@ -783,6 +811,9 @@ class _ProfileTabState extends State<ProfileTab> {
onTap: () {
Get.toNamed(
RouteName.certificate,
arguments: {
'id': getEditProfileIndi!.data!.id,
}
);
},
child: text16400white('View more'))
@@ -969,17 +1000,28 @@ class _ProfileTabState extends State<ProfileTab> {
},
child: Align(
alignment: Alignment.centerRight,
child: text16400white(
child: text18w400white(
'Add certificate'))),
sizedBoxHeight(10.h),
sizedBoxHeight(25.h),
]),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
text18w700white("Groups"),
InkWell(
onTap: () {
Get.toNamed(
RouteName.group,
arguments: {
'id': getEditProfileIndi!.data!.id,
}
);
},
child: text16400white('View more'))
],
),
),
@@ -1078,7 +1120,13 @@ class _ProfileTabState extends State<ProfileTab> {
future: businessfuture,
builder: (ctx, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return ShimmerCommon();
return
// ShimmerCommon();
Center(
child: CircularProgressIndicator(
color: Colors.blue,
),
);
}
if (snapshot.hasError) {
@@ -1973,14 +2021,25 @@ class _ProfileTabState extends State<ProfileTab> {
return Column(
children: [
Container(
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)),
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,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) {
// Error handling when image fails to load
return Image.asset(
'assets/images/png/Rectangle 29ss.png',
fit: BoxFit.cover,
);
},
),
),
sizedBoxHeight(10.h),
SizedBox(
width: 100.w,

View File

@@ -88,4 +88,6 @@ class EditProfileApi {
return response;
}
}

View File

@@ -47,6 +47,7 @@ class Data {
// List<MyJoinedSubgroups>? myJoinedSubgroups;
List<Certifications>? certifications;
int? daysBeforeJoined;
int? isIamFollowingToGuestUser;
Data(
{this.id,
@@ -68,7 +69,9 @@ class Data {
this.myJoinedGroups,
// this.myJoinedSubgroups,
this.certifications,
this.daysBeforeJoined});
this.daysBeforeJoined,
this.isIamFollowingToGuestUser,
});
Data.fromJson(Map<String, dynamic> json) {
id = json['id'];
@@ -117,6 +120,7 @@ class Data {
});
}
daysBeforeJoined = json['days_before_joined'];
isIamFollowingToGuestUser = json['is_iam_following_to_guest_user'];
}
Map<String, dynamic> toJson() {
@@ -156,6 +160,7 @@ class Data {
this.certifications!.map((v) => v.toJson()).toList();
}
data['days_before_joined'] = this.daysBeforeJoined;
data['is_iam_following_to_guest_user'] = this.isIamFollowingToGuestUser;
return data;
}
}

View File

@@ -5,11 +5,15 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
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/Guest%20User/ViewModel/GuestProfileApi.dart';
import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/view_model/profilePostmethod.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:intl/intl.dart';
class ProfileTabIndGuest extends StatefulWidget {
const ProfileTabIndGuest({super.key});
@@ -97,6 +101,38 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
super.initState();
}
int? followunfollowid;
FollowUnfollowUploadata() async {
utils.loader();
Map<String, dynamic> updata = {
"following_iam_principal_xid": followunfollowid,
};
final data = await Profilepostmethod().postunfollowuser(updata);
if (data.status == ResponseStatus.SUCCESS) {
Get.back();
// return utils.showToast(data.message);
} else {
Get.back();
print("unfollow not done");
return utils.showToast(data.message);
}
}
// void _handleFollowButton(id) async {
// try {
// var resp = await Profilepostmethod().guestFollowuser(id ?? "");
// if (resp) {
// setState(() {
// // isFollow = !isFollow!;
// });
// }
// } catch (e) {
// // Handle error here
// print('Error Following user: $e');
// }
// }
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -221,11 +257,10 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
children: [
text16400white(
guestGetProfileInd!
.data!
.follows!
.followers
.toString() ??
"254"),
.data!
.follows!
.followers
.toString()),
sizedBoxHeight(6.h),
text12400whiteblur(
"Followers")
@@ -264,11 +299,10 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
children: [
text16400white(
guestGetProfileInd!
.data!
.follows!
.following
.toString() ??
"254"),
.data!
.follows!
.following
.toString()),
sizedBoxHeight(6.h),
text12400whiteblur(
"Following")
@@ -329,19 +363,40 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
children: [
GestureDetector(
onTap: () {
Get.toNamed(RouteName.editProfile);
// Get.toNamed(RouteName.editProfile);
followunfollowid =
guestGetProfileInd!.data!.id;
FollowUnfollowUploadata();
print(followunfollowid);
// _handleFollowButton(followunfollowid);
},
child: Container(
height: 40.h,
width: 170.w,
decoration: BoxDecoration(
color: const Color(0xFFD90B2E),
borderRadius:
BorderRadius.circular(30.r),
),
child: Center(
child: text16w400_FCFCFC("Follow")),
),
child: guestGetProfileInd!.data!
.isIamFollowingToGuestUser ==
0
? Container(
height: 40.h,
width: 170.w,
decoration: BoxDecoration(
color: const Color(0xFFD90B2E),
borderRadius:
BorderRadius.circular(30.r),
),
child: Center(
child: text16w400_FCFCFC(
"Follow")),
)
: Container(
height: 40.h,
width: 170.w,
decoration: BoxDecoration(
color: const Color(0xFFD90B2E),
borderRadius:
BorderRadius.circular(30.r),
),
child: Center(
child: text16w400_FCFCFC(
"Unfollow")),
),
),
GestureDetector(
onTap: () {
@@ -367,8 +422,11 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
sizedBoxHeight(30.h),
text18w700white("About"),
sizedBoxHeight(10.h),
text14400white(
"Lorem Ipsum has been the industry's standard dummy text ever since the 1500s."),
guestGetProfileInd!.data!.about == null ||
guestGetProfileInd!.data!.about!.isEmpty
? text14400white("No about added")
: text14400white(
guestGetProfileInd!.data!.about!),
sizedBoxHeight(25.h),
Row(
children: [
@@ -412,7 +470,7 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
text14400whiteblur(
'Rowing, Football, Swimming'),
// interestText
// text14400whiteblur(getEditProfileIndi!
// text14400whiteblur(guestGetProfileInd!
// .data!.interest!
// .join(', ')),
// text14400whiteblur(
@@ -485,16 +543,16 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
children: [
text18w700white("Timeline"),
const Spacer(),
InkWell(
onTap: () {
Get.toNamed(RouteName.addtimeline);
},
child: Image.asset(
"assets/images/png/iconamoon_edit-thin.png",
height: 20.h,
width: 20.w,
),
)
// InkWell(
// onTap: () {
// Get.toNamed(RouteName.addtimeline);
// },
// child: Image.asset(
// "assets/images/png/iconamoon_edit-thin.png",
// height: 20.h,
// width: 20.w,
// ),
// )
],
),
sizedBoxHeight(20.h),
@@ -507,39 +565,262 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
"No Timeline Found")),
)
: SizedBox(
height: 300.h,
height: 200.h,
child: ListView.builder(
shrinkWrap: true,
itemCount: guestGetProfileInd!
.data!.timelines!.length,
itemBuilder: (context, index) {
var abilities;
abilities = guestGetProfileInd!
.data!
.timelines![index]
.abilities!
.map((e) => e.name)
.join(', ');
return commonTimelineCard(
imagePath: timeline[index]
["imagePath"],
title: guestGetProfileInd!
.data!
.timelines![index]
.teamName ??
'',
teamName: guestGetProfileInd!
.data!
.timelines![index]
.teamName ??
'',
abilities: abilities,
startendDate:
"${guestGetProfileInd!.data!.timelines![index].startDate} - ${guestGetProfileInd!.data!.timelines![index].endDate} " ??
'',
DateTime startDate =
DateTime.parse(
guestGetProfileInd!
.data!
.timelines![index]
.startDate!);
DateTime endDate = DateTime.parse(
guestGetProfileInd!
.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 = guestGetProfileInd!
.data!.timelines![index];
// List<Map<String, dynamic>>
// abilities =
// timeline.abilities!
// .map((ability) => {
// 'id': ability.id,
// 'name':
// ability.name,
// })
// .toList();
return 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: [
guestGetProfileInd?.data?.profilePhoto == null ||
guestGetProfileInd!.data!.profilePhoto!.isEmpty
? CircleAvatar(radius: 10.r, backgroundImage: AssetImage('assets/images/png/cimg1.png'))
: CircleAvatar(radius: 10.r, backgroundImage: NetworkImage(guestGetProfileInd!.data!.profilePhoto!)),
sizedBoxWidth(
8.w),
guestGetProfileInd!.data!.timelines![index].clubName == null ||
guestGetProfileInd!.data!.timelines![index].clubName!.isEmpty
? text14700white('Regroup')
: text14700white(guestGetProfileInd!.data!.timelines![index].clubName!)
],
),
],
),
sizedBoxHeight(
10.h),
guestGetProfileInd!.data!.timelines![index].roleName ==
null ||
guestGetProfileInd!
.data!
.timelines![
index]
.roleName!
.isEmpty
? text12700white(
'regroup')
: text12700white(guestGetProfileInd!
.data!
.timelines![
index]
.roleName!),
sizedBoxHeight(
10.h),
guestGetProfileInd!.data!.timelines![index].teamName ==
null ||
guestGetProfileInd!
.data!
.timelines![
index]
.teamName!
.isEmpty
? text12700white(
'regroup')
: text12700white(guestGetProfileInd!
.data!
.timelines![
index]
.teamName!),
sizedBoxHeight(
10.h),
startToEnd
.isEmpty
? text12400white(
'No date')
: text12400white(
startToEnd),
sizedBoxHeight(
10.h),
guestGetProfileInd!.data!.timelines![index].abilities ==
null ||
guestGetProfileInd!
.data!
.timelines![
index]
.abilities!
.isEmpty
? text10400whiteblur(
'No data')
: Container(
height:
30.h, // Adjust the height as needed
child: ListView
.builder(
shrinkWrap:
true,
scrollDirection:
Axis.horizontal,
itemCount: guestGetProfileInd!
.data!
.timelines![index]
.abilities!
.length,
itemBuilder:
(context, innerIndex) {
String
abilityName =
guestGetProfileInd!.data!.timelines![index].abilities![innerIndex].name!;
// List<String> abilityName = guestGetProfileInd!.data!.timelines![index].abilities![innerIndex].name!.split(',');
// String formattedNames = abilityName.join(', ');
List<String>
abilityNames =
abilityName.split(',').map((e) => e.trim()).toList();
String
formattedNames =
abilityNames.join(', ');
print(formattedNames);
return Padding(
padding: EdgeInsets.only(right: 8.w),
child: text10400whiteblur(formattedNames),
);
},
),
),
],
),
),
// border: 1
),
],
),
),
],
);
},
)),
)
// ListView.builder(
// shrinkWrap: true,
// itemCount: guestGetProfileInd!
// .data!.timelines!.length,
// itemBuilder: (context, index) {
// var abilities;
// abilities = guestGetProfileInd!
// .data!
// .timelines![index]
// .abilities!
// .map((e) => e.name)
// .join(', ');
// return commonTimelineCard(
// imagePath: timeline[index]
// ["imagePath"],
// title: guestGetProfileInd!
// .data!
// .timelines![index]
// .teamName ??
// '',
// teamName: guestGetProfileInd!
// .data!
// .timelines![index]
// .teamName ??
// '',
// abilities: abilities,
// startendDate:
// "${guestGetProfileInd!.data!.timelines![index].startDate} - ${guestGetProfileInd!.data!.timelines![index].endDate} " ??
// '',
// );
// },
// )
),
sizedBoxHeight(30.h),
Row(
children: [
@@ -548,7 +829,11 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
const Spacer(),
InkWell(
onTap: () {
Get.toNamed(RouteName.certificate);
Get.toNamed(RouteName.certificate,
arguments: {
'id': guestGetProfileInd!
.data!.id,
});
},
child: text12400white("View more")),
],
@@ -564,44 +849,161 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
"No Certifications Found")),
)
: SizedBox(
height: 85.h,
height: 100.h,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: guestGetProfileInd!.data!
.certifications!.length ??
certificationData.length,
// padding:
// EdgeInsets.only(left: 16.w),
physics: ScrollPhysics(),
itemCount: guestGetProfileInd!
.data!.certifications!.length,
itemBuilder: (context, index) {
var certifiData =
guestGetProfileInd!.data!
.certifications![index];
return Padding(
padding: EdgeInsets.only(
right: 20.w),
child: certificationCardTile(
imagePath: certifiData
.certificationImage ??
certificationData[index]
["imagePath"],
title: certifiData
.certificationName ??
certificationData[index]
["title"],
subtitle: certifiData
.certificationReason ??
certificationData[index]
["subtitle"],
date:
("Issued ${certifiData.certificationDate}") ??
(certificationData[
index]
["date"])),
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: [
guestGetProfileInd!
.data!
.certifications![
index]
.certificationImage ==
null ||
guestGetProfileInd!
.data!
.certifications![
index]
.certificationImage!
.isEmpty
? Image.asset(
'assets/images/png/image 17.png',
width: 57.w,
height:
40.h,
)
: Image.network(
guestGetProfileInd!
.data!
.certifications![
index]
.certificationImage!,
width: 77.w,
height:
100.h,
),
sizedBoxWidth(20.w),
Column(
crossAxisAlignment:
CrossAxisAlignment
.center,
mainAxisAlignment:
MainAxisAlignment
.center,
children: [
guestGetProfileInd!.data!.certifications![index].certificationName ==
null ||
guestGetProfileInd!
.data!
.certifications![
index]
.certificationName!
.isEmpty
? text12400white(
'Regroup')
: text12400white(guestGetProfileInd!
.data!
.certifications![
index]
.certificationName!),
sizedBoxHeight(
4.h),
guestGetProfileInd!.data!.certifications![index].certificationReason ==
null ||
guestGetProfileInd!
.data!
.certifications![
index]
.certificationReason!
.isEmpty
? text9400white(
'Regroup')
: text9400white(guestGetProfileInd!
.data!
.certifications![
index]
.certificationName!),
sizedBoxHeight(
4.h),
guestGetProfileInd!.data!.certifications![index].certificationDate ==
null ||
guestGetProfileInd!
.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(guestGetProfileInd!.data!.certifications![index].certificationDate!))}',
style: TextStyle(
fontSize:
9.sp,
fontWeight: FontWeight.w400,
color: Color(0xffFFFFFF).withOpacity(0.70),
fontFamily: 'Helvetica'),
)
],
),
],
),
)),
sizedBoxWidth(20.w),
],
);
},
),
),
)),
sizedBoxHeight(30.h),
text18w400white("Groups"),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
text18w700white("Groups"),
InkWell(
onTap: () {
Get.toNamed(RouteName.group,
arguments: {
'id': guestGetProfileInd!
.data!.id,
});
},
child: text12400white('View more'))
],
),
]),
),
sizedBoxHeight(20.h),
@@ -609,11 +1011,12 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
? Padding(
padding: EdgeInsets.symmetric(vertical: 30.h),
child: Center(
child: text18w700white(
"No groups Found")),
child:
text18w700white("No groups Found")),
)
: SizedBox(
height: 190.h,
width: double.infinity,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
@@ -621,18 +1024,24 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
itemCount: guestGetProfileInd!
.data!.myJoinedGroups!.length,
itemBuilder: (context, index) {
var subGroupData = guestGetProfileInd!
.data!
.myJoinedGroups![index]
.groupData!;
return Padding(
padding: EdgeInsets.only(right: 20.w),
child: profilecardtile(
imagePath: subGroupData
imagePath: guestGetProfileInd!
.data!
.myJoinedGroups![index]
.groupData!
.groupImage ??
cardtile[index]["imagePath"],
title: subGroupData.title ??
cardtile[index]["title"]),
'',
// cardtile[index]["imagePath"],
title: guestGetProfileInd!
.data!
.myJoinedGroups![index]
.groupData!
.title!
// cardtile[index]["title"]
),
);
},
),
@@ -1304,34 +1713,35 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
));
}
Widget profilecardtile({required String imagePath, required String title}) {
Widget profilecardtile({required String? imagePath, required String? title}) {
return Column(
children: [
guestGetProfileInd!.data!.myJoinedGroups!.isNotEmpty
? Container(
width: 100.w,
height: 109.h,
decoration: ShapeDecoration(
image: DecorationImage(
image: Image(
image: NetworkImage(imagePath),
).image,
fit: BoxFit.cover,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.r)),
Container(
height: 109.h,
width: 100.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.r),
),
child: imagePath == null || imagePath.isEmpty
? Image.asset('assets/images/png/Rectangle 29ss.png')
: Image.network(
imagePath,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) {
// Error handling when image fails to load
return Image.asset(
'assets/images/png/Rectangle 29ss.png',
fit: BoxFit.cover,
);
},
),
)
: Container(
height: 109.h,
width: 100.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.r),
),
child: Image.asset(imagePath),
),
),
sizedBoxHeight(10.h),
SizedBox(width: 100.w, child: text12w700_FCFCFC(title)),
SizedBox(
width: 100.w,
child: title == null || title.isEmpty
? text12w700_FCFCFC('Reegroup')
: text12w700_FCFCFC(title)),
],
);
}

View File

@@ -0,0 +1,68 @@
class CertificateuserModel {
String? status;
int? statusCode;
String? message;
List<Data>? data;
CertificateuserModel({this.status, this.statusCode, this.message, this.data});
CertificateuserModel.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? certificationName;
String? certificationImage;
String? certificationReason;
String? certificationDate;
int? iamPrincipalXid;
Data(
{this.id,
this.certificationName,
this.certificationImage,
this.certificationReason,
this.certificationDate,
this.iamPrincipalXid});
Data.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

@@ -24,6 +24,26 @@ class AccountSettings extends StatefulWidget {
class _AccountSettingsState extends State<AccountSettings> {
// bool swichvalue = false;
String? accountTypeValue;
String? accounTypeLogin;
@override
void initState() {
setValues();
super.initState();
}
setValues() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
// Update state variables and trigger UI update with setState
setState(() {
accounTypeLogin = prefs.getString('accountTypefromLogin');
print('account type login is $accounTypeLogin');
// accountTypeValue = prefs.getString('accountTypeValue');
// print('account type value is $accountTypeValue');
});
}
Future<void> UploadData() async {
print("upload data called");
SharedPreferences prefs = await SharedPreferences.getInstance();
@@ -91,35 +111,43 @@ else if (accountype == "2") {
child: text18w700_FCFCFC("Sign in & security"),
),
sizedBoxHeight(20.h),
Padding(
padding:
EdgeInsets.symmetric(horizontal: 16.w, vertical: 20.h),
child: Row(children: [
Image.asset(
"assets/images/png/eyeIcon.png",
height: 21.h,
width: 21.w,
),
sizedBoxWidth(12.w),
text16w400_FCFCFC("Account visibility"),
Spacer(),
Transform.scale(
scale: 0.9,
child: CupertinoSwitch(
value: accountvisibility,
trackColor: Colors.white.withOpacity(0.4),
activeColor: Color(0xFF34C759),
onChanged: (bool value) {
setState(() {
accountvisibility = value;
UploadData();
accounTypeLogin == '1'
?
// swichvalue = value ?? false;
});
}))
]),
),
Column(
children: [
Padding(
padding:
EdgeInsets.symmetric(horizontal: 16.w, vertical: 20.h),
child: Row(children: [
Image.asset(
"assets/images/png/eyeIcon.png",
height: 21.h,
width: 21.w,
),
sizedBoxWidth(12.w),
text16w400_FCFCFC("Account visibility"),
Spacer(),
Transform.scale(
scale: 0.9,
child: CupertinoSwitch(
value: accountvisibility,
trackColor: Colors.white.withOpacity(0.4),
activeColor: Color(0xFF34C759),
onChanged: (bool value) {
setState(() {
accountvisibility = value;
UploadData();
// swichvalue = value ?? false;
});
}))
]),
),
commonDivider(),
],
)
: SizedBox(),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.changepassword);

View File

@@ -7,6 +7,7 @@ import 'package:regroup/Utils/Common/blureffect.dart';
import 'package:regroup/Utils/Common/sized_box.dart';
import 'package:regroup/Utils/texts.dart';
import 'package:regroup/resources/routes/route_name.dart';
import 'package:shared_preferences/shared_preferences.dart';
class HelpAndSupport extends StatefulWidget {
const HelpAndSupport({super.key});
@@ -16,6 +17,26 @@ class HelpAndSupport extends StatefulWidget {
}
class _HelpAndSupportState extends State<HelpAndSupport> {
String? accountTypeValue;
String? accounTypeLogin;
@override
void initState() {
setValues();
super.initState();
}
setValues() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
// Update state variables and trigger UI update with setState
setState(() {
accounTypeLogin = prefs.getString('accountTypefromLogin');
print('account type login is $accounTypeLogin');
// accountTypeValue = prefs.getString('accountTypeValue');
// print('account type value is $accountTypeValue');
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -30,44 +51,51 @@ class _HelpAndSupportState extends State<HelpAndSupport> {
Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/png/Ellipse 1496.png"), fit: BoxFit.fill)),
image: AssetImage("assets/images/png/Ellipse 1496.png"),
fit: BoxFit.fill)),
),
SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
sizedBoxHeight(20.h),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.faqscreen);
},
child: rowTile(
imagePath: "assets/images/png/Vectorftt.png",
text: "FAQ",
),
crossAxisAlignment: CrossAxisAlignment.start,
children: [
sizedBoxHeight(20.h),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.faqscreen);
},
child: rowTile(
imagePath: "assets/images/png/Vectorftt.png",
text: "FAQ",
),
commonDivider(),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.contactUs);
},
child: rowTile(
imagePath:
"assets/images/png/fluent_person-support-20-regular.png",
text: "Contact us",
),
),
commonDivider(),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.contactUs);
},
child: rowTile(
imagePath:
"assets/images/png/fluent_person-support-20-regular.png",
text: "Contact us",
),
commonDivider(),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.reportabug);
},
child: rowTile(
imagePath: "assets/images/png/codicon_bug.png",
text: "Report a bug",
),
),
]))
),
accounTypeLogin == '1'
? Column(
children: [
commonDivider(),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.reportabug);
},
child: rowTile(
imagePath: "assets/images/png/codicon_bug.png",
text: "Report a bug",
),
),
])
: SizedBox(),
],
))
]));
}

View File

@@ -23,6 +23,25 @@ class Settings extends StatefulWidget {
}
class _SettingsState extends State<Settings> {
String? accountTypeValue;
String? accounTypeLogin;
@override
void initState() {
setValues();
super.initState();
}
setValues() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
// Update state variables and trigger UI update with setState
setState(() {
accounTypeLogin = prefs.getString('accountTypefromLogin');
print('account type login is $accounTypeLogin');
// accountTypeValue = prefs.getString('accountTypeValue');
// print('account type value is $accountTypeValue');
});
}
Uploadata() async {
utils.loader();
@@ -38,7 +57,7 @@ class _SettingsState extends State<Settings> {
await prefs.remove('phone');
await prefs.remove('accountTypefromLogin');
await prefs.remove('principal_xid');
await prefs.remove('accountTypeValue');
// await prefs.remove('accountTypeValue');
await prefs.clear();
@@ -52,7 +71,6 @@ class _SettingsState extends State<Settings> {
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -91,16 +109,22 @@ class _SettingsState extends State<Settings> {
),
),
commonDivider(),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.editProfile);
},
child: rowTile(
imagePath: "assets/images/png/edit 1.png",
text: "Edit profile",
),
),
commonDivider(),
accounTypeLogin == '1'
? Column(
children: [
GestureDetector(
onTap: () {
Get.toNamed(RouteName.editProfile);
},
child: rowTile(
imagePath: "assets/images/png/edit 1.png",
text: "Edit profile",
),
),
commonDivider(),
],
)
: SizedBox(),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.helpandsupport);
@@ -132,6 +156,22 @@ class _SettingsState extends State<Settings> {
),
),
commonDivider(),
accounTypeLogin == '1'
? SizedBox()
: Column(
children: [
GestureDetector(
onTap: () {
Get.toNamed(RouteName.reportabug);
},
child: rowTile(
imagePath: "assets/images/png/codicon_bug.png",
text: "Report a bug",
),
),
commonDivider(),
],
),
GestureDetector(
onTap: () {
dialogwidget();

View File

@@ -5,6 +5,7 @@ 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/certificateModel.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';
@@ -20,6 +21,8 @@ FollowersModel? followersobj;
FollowingModel? followingobj;
GetEditTimelineModel? edittimelineobj;
GetAccountSessionsModel? accountsessionobj;
CertificateuserModel? certificateobj;
class Profilegetmethod {
@@ -107,4 +110,18 @@ class Profilegetmethod {
}
return response;
}
Future<ResponseData<dynamic>> getUserCertificates(updata) async {
final response =
await NetworkApiServices().getApi(
"${ApiUrls.getusercertificates}?user_id=$updata",
);
if (response.status == ResponseStatus.SUCCESS) {
certificateobj = CertificateuserModel.fromJson(response.data);
log(certificateobj!.data.toString());
}
return response;
}
}

View File

@@ -6,16 +6,16 @@ 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';
import 'package:http/http.dart' as http;
class Profilepostmethod {
Profilepostmethod();
Dio dio = Dio();
String basicAuth = 'Basic ' +
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");
final response = await NetworkApiServices().postApi(
@@ -38,7 +38,7 @@ class Profilepostmethod {
return response;
}
Future<ResponseData<dynamic>> postBlockuser(updata) async {
Future<ResponseData<dynamic>> postBlockuser(updata) async {
print("updata is $updata");
final response = await NetworkApiServices().postApi(
updata,
@@ -49,7 +49,7 @@ class Profilepostmethod {
return response;
}
Future<ResponseData<dynamic>> postunfollowuser(updata) async {
Future<ResponseData<dynamic>> postunfollowuser(updata) async {
print("updata is $updata");
final response = await NetworkApiServices().postApi(
updata,
@@ -60,7 +60,7 @@ class Profilepostmethod {
return response;
}
Future<ResponseData<dynamic>> postRemoveuser(updata) async {
Future<ResponseData<dynamic>> postRemoveuser(updata) async {
print("updata is $updata");
final response = await NetworkApiServices().postApi(
updata,
@@ -71,7 +71,7 @@ class Profilepostmethod {
return response;
}
Future<ResponseData<dynamic>> postChangepassword(updata) async {
Future<ResponseData<dynamic>> postChangepassword(updata) async {
print("updata is $updata");
final response = await NetworkApiServices().postApi(
updata,
@@ -82,7 +82,7 @@ class Profilepostmethod {
return response;
}
Future<ResponseData<dynamic>> postChangepassverifyotp(updata) async {
Future<ResponseData<dynamic>> postChangepassverifyotp(updata) async {
print("updata is $updata");
final response = await NetworkApiServices().postApi(
updata,
@@ -93,7 +93,7 @@ class Profilepostmethod {
return response;
}
Future<ResponseData<dynamic>> postTimeline(updata) async {
Future<ResponseData<dynamic>> postTimeline(updata) async {
print("updata is $updata");
final response = await NetworkApiServices().postApi(
updata,
@@ -104,7 +104,7 @@ class Profilepostmethod {
return response;
}
Future<ResponseData<dynamic>> postAccountvisibility(updata) async {
Future<ResponseData<dynamic>> postAccountvisibility(updata) async {
print("updata is $updata");
final response = await NetworkApiServices().postApi(
updata,
@@ -115,7 +115,7 @@ class Profilepostmethod {
return response;
}
Future<ResponseData<dynamic>> postDeleteaccount(updata) async {
Future<ResponseData<dynamic>> postDeleteaccount(updata) async {
print("updata is $updata");
final response = await NetworkApiServices().postApi(
updata,
@@ -126,19 +126,17 @@ class Profilepostmethod {
return response;
}
Future<ResponseData<dynamic>> postLogoutaccount() async {
Future<ResponseData<dynamic>> postLogoutaccount() async {
Response response;
SharedPreferences prefs = await SharedPreferences.getInstance();
String? token = prefs.getString('access-token');
try {
try {
response = await dio.post(
ApiUrls.postlogoutaccount,
options:
Options(
headers: {'authorization': basicAuth, 'access-token': token},
),
options: Options(
headers: {'authorization': basicAuth, 'access-token': token},
),
);
log(response.toString());
} on Exception catch (e) {
@@ -193,14 +191,13 @@ class Profilepostmethod {
response.statusMessage!, ResponseStatus.FAILED);
}
}
}
Future<ResponseData<dynamic>> postEditTimeline(updata) async {
Future<ResponseData<dynamic>> postEditTimeline(updata) async {
print("updata is $updata");
final response = await NetworkApiServices().postApi(
updata,
ApiUrls.posttimeline,
ApiUrls.postedittimeline,
);
print("response is ${response.data}");
print("response message is ${response.message}");
@@ -218,7 +215,7 @@ class Profilepostmethod {
return response;
}
Future<ResponseData<dynamic>> postRemoveCertification(updata) async {
Future<ResponseData<dynamic>> postRemoveCertification(updata) async {
print("updata is $updata");
final response = await NetworkApiServices().postApi(
updata,
@@ -229,7 +226,7 @@ class Profilepostmethod {
return response;
}
Future<ResponseData<dynamic>> postCertification(updata) async {
Future<ResponseData<dynamic>> postCertification(updata) async {
print("updata is $updata");
final response = await NetworkApiServices().postApi(
updata,
@@ -239,5 +236,39 @@ class Profilepostmethod {
print("response message is ${response.message}");
return response;
}
// Future guestFollowuser(int userId) async {
// print("followRecipe");
// final apiUrl = ApiUrls.postunfollow;
// // final body = {"following_iam_principal_xid": userId};
// Map<String, dynamic> updata = {
// "following_iam_principal_xid": userId,
// };
// SharedPreferences prefs = await SharedPreferences.getInstance();
// String? token = prefs.getString('access-token');
// Response response;
// try {
// response = await dio.post(
// apiUrl,
// data: updata,
// options:
// Options(
// headers: {'authorization': basicAuth, 'access-token': token},
// ),
// );
// log(response.toString());
// if (response.statusCode == 200) {
// final jsonResponse = json.decode(response.data);
// print("resp from api ${jsonResponse["message"]}");
// return jsonResponse["success"];
// } else {
// // API call failed
// throw Exception('Failed to follow user');
// }
// } catch (e) {
// // Error occurred while making the API call
// throw Exception('Error: $e');
// }
// }
}

View File

@@ -1,7 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:regroup/Common/CommonGlassmorphism.dart';
import 'package:regroup/Common/CommonWidget.dart';
import 'package:regroup/Feed%20Module/sidemenu/view_model/getmethod.dart';
import 'package:regroup/Utils/Common/CommonAppbar.dart';
import 'package:regroup/Utils/Common/blureffect.dart';
import 'package:regroup/Utils/Common/sized_box.dart';
@@ -36,215 +39,521 @@ class _GroupState extends State<Group> {
},
];
late Future myfuture;
int id = Get.arguments["id"];
@override
void initState() {
// TODO: implement initState
myfuture = Sidegetmethod().getJoinedusergroups(id);
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
// key: _scaffoldKey1,
backgroundColor: Color(0xFF222935),
extendBody: true,
appBar: CommonAppbar(
titleTxt: "Groups",
),
resizeToAvoidBottomInset: false,
body: Stack(children: [
Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/png/Ellipse 1496.png"),
fit: BoxFit.fill)),
), Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: SingleChildScrollView(
child: Column(
children: [
Column(
children: List.generate(GroupData.length, (index) {
return groupCard(
imagepath: GroupData[index]["imagepath"] ?? '',
title: GroupData[index]["title"] ?? '',
ontap: () {},
subtitle: GroupData[index]["subtitle"],
members: GroupData[index]["members"] ?? '');
}),
)
],
)))
]));
}
Widget groupCard({
required String imagepath,
required String title,
required void Function()? ontap,
required String members,
required String subtitle,
}) {
return Padding(
padding: EdgeInsets.only(bottom: 25.h),
child: GestureDetector(
onTap: ontap,
child: commonGlassContainer(
border: 0.9,
width: double.infinity,
height: 162.h,
borderradius: 10.r,
customWidget: Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h),
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: 65.h,
width: 65.h,
decoration: BoxDecoration(
shape: BoxShape.circle,
// color: Colors.amber,
),
child:
// Center(
// child: Image.asset(imagepath, fit: BoxFit.cover)),
CircleAvatar(
backgroundImage: AssetImage(
imagepath,
),
),
),
sizedBoxWidth(13.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text18w700_FCFCFC(title),
sizedBoxHeight(10.h),
Row(
children: [
Image.asset(
'assets/images/png/community 1 (traced).png',
width: 18.w,
height: 18.h,
),
sizedBoxWidth(4.w),
text14w400_FCFCFCblur(subtitle)
],
),
],
),
Spacer(),
PopupMenuButton(
surfaceTintColor: Color(0xFF222935),
constraints: BoxConstraints.tightFor(width: 200.w),
offset: Offset(0, 30),
color: Color(0xFF222935),
tooltip: "",
itemBuilder: (BuildContext context) =>
<PopupMenuEntry>[
PopupMenuItem(
onTap: () {},
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: 8.w),
child: Row(
children: [
text14w400_FCFCFC("Mute community"),
Spacer(),
Image.asset(
"assets/images/png/Black (1).png",
height: 18.h,
width: 18.w,
)
],
),
),
),
PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: 8.w),
child: Row(
children: [
text14w400_FCFCFC("Hide post"),
Spacer(),
Image.asset(
"assets/images/png/mingcute_eye-close-line.png",
height: 20.h,
width: 20.w,
)
],
),
),
),
PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: 8.w),
child: Row(
children: [
text14w400_FCFCFC("Pin"),
Spacer(),
Image.asset(
"assets/images/png/f7_pin-fill (2).png",
height: 25.h,
width: 25.w,
)
],
),
),
),
PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: 8.w),
child: Row(
children: [
text14w400_FCFCFC("Leave community"),
Spacer(),
Image.asset(
"assets/images/png/logout 1 (traced).png",
height: 18.h,
width: 18.w,
)
],
),
),
),
],
child: Image.asset(
"assets/images/png/Group 1000004071.png",
height: 13.h,
width: 3.w,
)),
],
// key: _scaffoldKey1,
backgroundColor: Color(0xFF222935),
extendBody: true,
appBar: CommonAppbar(
titleTxt: "Groups",
),
resizeToAvoidBottomInset: false,
body: FutureBuilder(
future: myfuture,
builder: (ctx, snapshot) {
if (snapshot.data == null) {
return const Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Center(
child: CircularProgressIndicator(
color: Color(0xFFC18948),
),
sizedBoxHeight(16.h),
commonDivider(),
sizedBoxHeight(10.h),
Row(
children: [
stackContainers(
number: "+2",
containerImages: [
"assets/images/png/cimg3.png",
"assets/images/png/cimg2.png",
"assets/images/png/cimg3.png",
"assets/images/png/cimg2.png",
],
),
sizedBoxWidth(95.w),
text12w400_FCFCFC_blur(members),
],
)
],
),
)),
)
],
);
}
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasError) {
return Center(
child: Text(
'${snapshot.error} occured',
style: TextStyle(fontSize: 18.spMin),
),
);
}
}
return joinedgroupsobj!.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(
image: AssetImage("assets/images/png/Ellipse 1496.png"),
fit: BoxFit.fill)),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: SingleChildScrollView(
child: Column(
children: [
ListView.builder(
shrinkWrap: true,
physics: ScrollPhysics(),
itemCount: joinedgroupsobj!.data!.length,
itemBuilder: (context, index) {
return Padding(
padding: EdgeInsets.only(bottom: 25.h),
child: GestureDetector(
onTap: () {},
child: commonGlassContainer(
border: 0.9,
width: double.infinity,
height: 162.h,
borderradius: 10.r,
customWidget: Padding(
padding: EdgeInsets.symmetric(
horizontal: 16.w, vertical: 16.h),
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: 65.h,
width: 65.h,
decoration: BoxDecoration(
shape: BoxShape.circle,
// color: Colors.amber,
),
child:
// Center(
// child: Image.asset(imagepath, fit: BoxFit.cover)),
joinedgroupsobj!
.data![index]
.groupData!
.groupImage ==
null ||
joinedgroupsobj!
.data![index]
.groupData!
.groupImage!
.isEmpty
? CircleAvatar(
backgroundImage: AssetImage(
'assets/images/png/img45.png',
),
)
: CircleAvatar(
backgroundImage:
NetworkImage(
joinedgroupsobj!
.data![index]
.groupData!
.groupImage!),
)),
sizedBoxWidth(13.w),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
// Container(
// // width: 250.w,
// // color: Colors.red,
// width: double.infinity,
// child:
joinedgroupsobj!.data![index].groupData!
.title ==
null ||
joinedgroupsobj!.data![index]
.groupData!.title!.isEmpty
? text18w700_FCFCFC('Regroup')
: SizedBox(
width: 200.w,
child: text18w700_FCFCFC(
joinedgroupsobj!
.data![index]
.groupData!
.title!),
),
// ),
sizedBoxHeight(10.h),
joinedgroupsobj!.data![index]
.myJoinedCommunityDetails ==
null ||
joinedgroupsobj!
.data![index]
.myJoinedCommunityDetails!
.communityData!
.communityName!
.isEmpty
? SizedBox()
: Row(
children: [
Image.asset(
'assets/images/png/community 1 (traced).png',
width: 18.w,
height: 18.h,
),
sizedBoxWidth(4.w),
text14w400_FCFCFCblur(
joinedgroupsobj!
.data![index]
.myJoinedCommunityDetails!
.communityData!
.communityName!)
],
),
],
),
Spacer(),
PopupMenuButton(
surfaceTintColor: Color(0xFF222935),
constraints: BoxConstraints.tightFor(
width: 200.w),
offset: Offset(0, 30),
color: Color(0xFF222935),
tooltip: "",
itemBuilder: (BuildContext context) =>
<PopupMenuEntry>[
PopupMenuItem(
onTap: () {},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 8.w),
child: Row(
children: [
text14w400_FCFCFC(
"Mute community"),
Spacer(),
Image.asset(
"assets/images/png/Black (1).png",
height: 18.h,
width: 18.w,
)
],
),
),
),
PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 8.w),
child: Row(
children: [
text14w400_FCFCFC(
"Hide post"),
Spacer(),
Image.asset(
"assets/images/png/mingcute_eye-close-line.png",
height: 20.h,
width: 20.w,
)
],
),
),
),
PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 8.w),
child: Row(
children: [
text14w400_FCFCFC("Pin"),
Spacer(),
Image.asset(
"assets/images/png/f7_pin-fill (2).png",
height: 25.h,
width: 25.w,
)
],
),
),
),
PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 8.w),
child: Row(
children: [
text14w400_FCFCFC(
"Leave community"),
Spacer(),
Image.asset(
"assets/images/png/logout 1 (traced).png",
height: 18.h,
width: 18.w,
)
],
),
),
),
],
child: Image.asset(
"assets/images/png/Group 1000004071.png",
height: 13.h,
width: 3.w,
)),
],
),
sizedBoxHeight(16.h),
commonDivider(),
sizedBoxHeight(10.h),
Row(
children: [
stackContainersGroups(
number: joinedgroupsobj!
.data![index].membersCount
.toString(),
containerImages: joinedgroupsobj!
.data![index].membersProfilePhotos!
.map((photo) => photo.profilePhoto!)
.toList(),
),
sizedBoxWidth(75.w),
joinedgroupsobj!.data![index]
.membersCount ==
null ||
joinedgroupsobj!.data![index]
.membersCount.isBlank!
? SizedBox()
: text16w400_FCFCFC_blur(
'${joinedgroupsobj!.data![index].membersCount} members',
),
],
)
],
),
)),
),
);
},
)
],
)))
]);
}
// Widget groupCard({
// required String? imagepath,
// required String? title,
// required void Function()? ontap,
// required String? members,
// required String? subtitle,
// }) {
// return Padding(
// padding: EdgeInsets.only(bottom: 25.h),
// child: GestureDetector(
// onTap: ontap,
// child: commonGlassContainer(
// border: 0.9,
// width: double.infinity,
// height: 162.h,
// borderradius: 10.r,
// customWidget: Padding(
// padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h),
// child: Column(
// children: [
// Row(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Container(
// height: 65.h,
// width: 65.h,
// decoration: BoxDecoration(
// shape: BoxShape.circle,
// // color: Colors.amber,
// ),
// child:
// // Center(
// // child: Image.asset(imagepath, fit: BoxFit.cover)),
// imagepath == null || imagepath.isEmpty
// ?
// CircleAvatar(
// backgroundImage: AssetImage(
// 'assets/images/png/img45.png',
// ),
// )
// :
// CircleAvatar(
// backgroundImage: NetworkImage(
// imagepath
// ),
// )
// ),
// sizedBoxWidth(13.w),
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// title == null || title.isEmpty
// ?
// text18w700_FCFCFC('Regroup')
// :
// text18w700_FCFCFC(title),
// sizedBoxHeight(10.h),
// Row(
// children: [
// Image.asset(
// 'assets/images/png/community 1 (traced).png',
// width: 18.w,
// height: 18.h,
// ),
// sizedBoxWidth(4.w),
// text14w400_FCFCFCblur(subtitle)
// ],
// ),
// ],
// ),
// Spacer(),
// PopupMenuButton(
// surfaceTintColor: Color(0xFF222935),
// constraints: BoxConstraints.tightFor(width: 200.w),
// offset: Offset(0, 30),
// color: Color(0xFF222935),
// tooltip: "",
// itemBuilder: (BuildContext context) =>
// <PopupMenuEntry>[
// PopupMenuItem(
// onTap: () {},
// child: Padding(
// padding:
// EdgeInsets.symmetric(horizontal: 8.w),
// child: Row(
// children: [
// text14w400_FCFCFC("Mute community"),
// Spacer(),
// Image.asset(
// "assets/images/png/Black (1).png",
// height: 18.h,
// width: 18.w,
// )
// ],
// ),
// ),
// ),
// PopupMenuDivider(),
// PopupMenuItem(
// onTap: () {},
// child: Padding(
// padding:
// EdgeInsets.symmetric(horizontal: 8.w),
// child: Row(
// children: [
// text14w400_FCFCFC("Hide post"),
// Spacer(),
// Image.asset(
// "assets/images/png/mingcute_eye-close-line.png",
// height: 20.h,
// width: 20.w,
// )
// ],
// ),
// ),
// ),
// PopupMenuDivider(),
// PopupMenuItem(
// onTap: () {},
// child: Padding(
// padding:
// EdgeInsets.symmetric(horizontal: 8.w),
// child: Row(
// children: [
// text14w400_FCFCFC("Pin"),
// Spacer(),
// Image.asset(
// "assets/images/png/f7_pin-fill (2).png",
// height: 25.h,
// width: 25.w,
// )
// ],
// ),
// ),
// ),
// PopupMenuDivider(),
// PopupMenuItem(
// onTap: () {},
// child: Padding(
// padding:
// EdgeInsets.symmetric(horizontal: 8.w),
// child: Row(
// children: [
// text14w400_FCFCFC("Leave community"),
// Spacer(),
// Image.asset(
// "assets/images/png/logout 1 (traced).png",
// height: 18.h,
// width: 18.w,
// )
// ],
// ),
// ),
// ),
// ],
// child: Image.asset(
// "assets/images/png/Group 1000004071.png",
// height: 13.h,
// width: 3.w,
// )),
// ],
// ),
// sizedBoxHeight(16.h),
// commonDivider(),
// sizedBoxHeight(10.h),
// Row(
// children: [
// stackContainers(
// number: "+2",
// containerImages: [
// "assets/images/png/cimg3.png",
// "assets/images/png/cimg2.png",
// "assets/images/png/cimg3.png",
// "assets/images/png/cimg2.png",
// ],
// ),
// sizedBoxWidth(95.w),
// text12w400_FCFCFC_blur(members),
// ],
// )
// ],
// ),
// )),
// ),
// );
// }
}

View File

@@ -0,0 +1,184 @@
class GetmyJoinedGroupsModel {
String? status;
int? statusCode;
String? message;
List<Data>? data;
GetmyJoinedGroupsModel(
{this.status, this.statusCode, this.message, this.data});
GetmyJoinedGroupsModel.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;
int? iamPrincipalXid;
int? manageGroupXid;
MyJoinedCommunityDetails? myJoinedCommunityDetails;
int? membersCount;
List<MembersProfilePhotos>? membersProfilePhotos;
GroupData? groupData;
Data(
{this.id,
this.iamPrincipalXid,
this.manageGroupXid,
this.myJoinedCommunityDetails,
this.membersCount,
this.membersProfilePhotos,
this.groupData});
Data.fromJson(Map<String, dynamic> json) {
id = json['id'];
iamPrincipalXid = json['iam_principal_xid'];
manageGroupXid = json['manage_group_xid'];
myJoinedCommunityDetails = json['my_joined_community_details'] != null
? new MyJoinedCommunityDetails.fromJson(
json['my_joined_community_details'])
: null;
membersCount = json['membersCount'];
if (json['members_profile_photos'] != null) {
membersProfilePhotos = <MembersProfilePhotos>[];
json['members_profile_photos'].forEach((v) {
membersProfilePhotos!.add(new MembersProfilePhotos.fromJson(v));
});
}
groupData = json['group_data'] != null
? new GroupData.fromJson(json['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;
if (this.myJoinedCommunityDetails != null) {
data['my_joined_community_details'] =
this.myJoinedCommunityDetails!.toJson();
}
data['membersCount'] = this.membersCount;
if (this.membersProfilePhotos != null) {
data['members_profile_photos'] =
this.membersProfilePhotos!.map((v) => v.toJson()).toList();
}
if (this.groupData != null) {
data['group_data'] = this.groupData!.toJson();
}
return data;
}
}
class MyJoinedCommunityDetails {
int? id;
int? manageGroupXid;
int? manageCommunityXid;
CommunityData? communityData;
MyJoinedCommunityDetails(
{this.id,
this.manageGroupXid,
this.manageCommunityXid,
this.communityData});
MyJoinedCommunityDetails.fromJson(Map<String, dynamic> json) {
id = json['id'];
manageGroupXid = json['manage_group_xid'];
manageCommunityXid = json['manage_community_xid'];
communityData = json['community_data'] != null
? new CommunityData.fromJson(json['community_data'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['manage_group_xid'] = this.manageGroupXid;
data['manage_community_xid'] = this.manageCommunityXid;
if (this.communityData != null) {
data['community_data'] = this.communityData!.toJson();
}
return data;
}
}
class CommunityData {
int? id;
String? communityName;
CommunityData({this.id, this.communityName});
CommunityData.fromJson(Map<String, dynamic> json) {
id = json['id'];
communityName = json['community_name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['community_name'] = this.communityName;
return data;
}
}
class MembersProfilePhotos {
int? id;
String? profilePhoto;
MembersProfilePhotos({this.id, this.profilePhoto});
MembersProfilePhotos.fromJson(Map<String, dynamic> json) {
id = json['id'];
profilePhoto = json['profile_photo'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['profile_photo'] = this.profilePhoto;
return data;
}
}
class GroupData {
int? id;
String? title;
String? groupImage;
GroupData({this.id, this.title, this.groupImage});
GroupData.fromJson(Map<String, dynamic> json) {
id = json['id'];
title = json['title'];
groupImage = json['group_image'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['title'] = this.title;
data['group_image'] = this.groupImage;
return data;
}
}

View File

@@ -0,0 +1,26 @@
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/sidemenu/Model/joineGroupsModel.dart';
GetmyJoinedGroupsModel? joinedgroupsobj;
class Sidegetmethod {
Future<ResponseData<dynamic>> getJoinedusergroups(updata) async {
final response = await NetworkApiServices().getApi(
"${ApiUrls.getmyjoinedgroups}?user_id=$updata",
// optionalpar: false
);
if (response.status == ResponseStatus.SUCCESS) {
joinedgroupsobj = GetmyJoinedGroupsModel.fromJson(response.data);
log(joinedgroupsobj!.data.toString());
}
return response;
}
}

View File

@@ -584,6 +584,17 @@ Widget text12w400_FCFCFC_blur(String text) {
);
}
Widget text16w400_FCFCFC_blur(String text) {
return Text(
text,
style: TextStyle(
fontSize: 16.sp,
color: Color(0xFFFCFCFC).withOpacity(0.8),
fontFamily: 'Helvetica',
fontWeight: FontWeight.w400),
);
}
Widget text10w400_FCFCFC_blur(String text) {
return Text(
text,

View File

@@ -31,6 +31,8 @@ class Getuserdetails {
await prefs.setString('username', getuserobj?.data?.userData?.userName ?? "");
await prefs.setString('email', getuserobj?.data?.userData?.emailAddress ?? "");
await prefs.setString('phone', getuserobj?.data?.userData?.phoneNumber ?? "");
await prefs.setString('accountTypefromLogin',
getuserobj?.data?.userData?.principalTypeXid.toString() ?? "");
emailid = prefs.getString('email');
myusername = prefs.getString('username');