Merge pull request #67 from WDI-Ideas/profilecon

conflicts solved for guest user business for follow and following and…
This commit is contained in:
Shubham Shetty
2024-07-26 16:44:41 +05:30
committed by GitHub
12 changed files with 506 additions and 134 deletions

View File

@@ -114,10 +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');
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
@@ -132,10 +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');
print('account tupe login is $accounTypeLogin');
print('account tupe value is $accountTypeValue');
// foodItemDropdownController.selectedFooddynamic.clear();
// foodItemDropdownController.foodItemQControllerList.clear();
// foodItemDropdownController.OtherFoodIngredientList.clear();
@@ -201,8 +201,7 @@ class _ProfileTabState extends State<ProfileTab> {
backgroundColor: const Color(0xFF222935),
extendBody: true,
// accountTypeValue == '1' ||
body: accounTypeLogin == '1'
// || accountTypeValue == '1'
body: accounTypeLogin == '1' || accountTypeValue == '1'
? FutureBuilder(
future: individualfuture,
builder: (ctx, snapshot) {
@@ -460,7 +459,7 @@ class _ProfileTabState extends State<ProfileTab> {
getEditProfileIndi!.data!.timelines!.isEmpty
? Center(
child:
text18w700white("Add timeline"))
text16400white("Add timeline"))
: SizedBox(
height: 200.h,
child: ListView.builder(
@@ -771,11 +770,11 @@ class _ProfileTabState extends State<ProfileTab> {
getEditProfileIndi!.data!.timelines![index].abilities!.length,
itemBuilder:
(context, innerIndex) {
String abilityName = getEditProfileIndi!.data!.timelines![index].abilities![innerIndex].name!;
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(', ');
String formattedNames = abilityNames.join(', ');
print(formattedNames);
return Padding(
padding: EdgeInsets.only(right: 8.w),
@@ -811,12 +810,11 @@ class _ProfileTabState extends State<ProfileTab> {
const Spacer(),
InkWell(
onTap: () {
Get.toNamed(
RouteName.certificate,
arguments: {
'id': getEditProfileIndi!.data!.id,
}
);
Get.toNamed(RouteName.certificate,
arguments: {
'id': getEditProfileIndi!
.data!.id,
});
},
child: text16400white('View more'))
],
@@ -1017,50 +1015,53 @@ class _ProfileTabState extends State<ProfileTab> {
text18w700white("Groups"),
InkWell(
onTap: () {
Get.toNamed(
RouteName.group,
arguments: {
'id': getEditProfileIndi!.data!.id,
}
);
Get.toNamed(RouteName.group,
arguments: {
'id':
getEditProfileIndi!.data!.id,
});
},
child: text16400white('View more'))
],
),
),
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: getEditProfileIndi!
.data!.myJoinedGroups!.length,
itemBuilder: (context, index) {
return Padding(
padding: EdgeInsets.only(right: 20.w),
child: profilecardtile(
imagePath: getEditProfileIndi!
.data!
.myJoinedGroups![index]
.groupData!
.groupImage ??
'',
// cardtile[index]["imagePath"],
title: getEditProfileIndi!
.data!
.myJoinedGroups![index]
.groupData!
.title!
getEditProfileIndi!.data!.myJoinedGroups!.isEmpty
? Center(
child:
text16400white("No groups available"))
: SizedBox(
height: 190.h,
width: double.infinity,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
padding: EdgeInsets.only(left: 16.w),
itemCount: getEditProfileIndi!
.data!.myJoinedGroups!.length,
itemBuilder: (context, index) {
return Padding(
padding: EdgeInsets.only(right: 20.w),
child: profilecardtile(
imagePath: getEditProfileIndi!
.data!
.myJoinedGroups![index]
.groupData!
.groupImage ??
'',
// cardtile[index]["imagePath"],
title: getEditProfileIndi!
.data!
.myJoinedGroups![index]
.groupData!
.title!
// cardtile[index]["title"]
),
);
},
),
),
// cardtile[index]["title"]
),
);
},
),
),
normalcardtile(
profileImg: 'assets/images/png/Ellipse 48.png',
title: 'Jocelyn Dokidis',

View File

@@ -28,9 +28,11 @@ class GuestGetProfileDataBus {
class Data {
int? id;
int? iamPrincipalXid;
int? businessTypeXid;
String? businessOwnerName;
String? businessName;
String? businessUsername;
String? businessLocation;
String? businessContactNumber;
String? businessEmail;
@@ -40,14 +42,20 @@ class Data {
String? businessLogo;
String? tags;
String? bannerImage;
String? businessProfileImage;
String? bio;
Follows? follows;
int? isIamFollowingToGuestUser;
BusinessType? businessType;
IamPrincipalData? iamPrincipalData;
Data(
{this.id,
this.iamPrincipalXid,
this.businessTypeXid,
this.businessOwnerName,
this.businessName,
this.businessUsername,
this.businessLocation,
this.businessContactNumber,
this.businessEmail,
@@ -57,14 +65,20 @@ class Data {
this.businessLogo,
this.tags,
this.bannerImage,
this.businessProfileImage,
this.bio,
this.follows,
this.businessType});
this.isIamFollowingToGuestUser,
this.businessType,
this.iamPrincipalData});
Data.fromJson(Map<String, dynamic> json) {
id = json['id'];
iamPrincipalXid = json['iam_principal_xid'];
businessTypeXid = json['business_type_xid'];
businessOwnerName = json['business_owner_name'];
businessName = json['business_name'];
businessUsername = json['business_username'];
businessLocation = json['business_location'];
businessContactNumber = json['business_contact_number'];
businessEmail = json['business_email'];
@@ -74,19 +88,27 @@ class Data {
businessLogo = json['business_logo'];
tags = json['tags'];
bannerImage = json['banner_image'];
businessProfileImage = json['business_profile_image'];
bio = json['bio'];
follows =
json['follows'] != null ? new Follows.fromJson(json['follows']) : null;
isIamFollowingToGuestUser = json['is_iam_following_to_guest_user'];
businessType = json['business_type'] != null
? new BusinessType.fromJson(json['business_type'])
: null;
iamPrincipalData = json['iam_principal_data'] != null
? new IamPrincipalData.fromJson(json['iam_principal_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['business_type_xid'] = this.businessTypeXid;
data['business_owner_name'] = this.businessOwnerName;
data['business_name'] = this.businessName;
data['business_username'] = this.businessUsername;
data['business_location'] = this.businessLocation;
data['business_contact_number'] = this.businessContactNumber;
data['business_email'] = this.businessEmail;
@@ -96,12 +118,18 @@ class Data {
data['business_logo'] = this.businessLogo;
data['tags'] = this.tags;
data['banner_image'] = this.bannerImage;
data['business_profile_image'] = this.businessProfileImage;
data['bio'] = this.bio;
if (this.follows != null) {
data['follows'] = this.follows!.toJson();
}
data['is_iam_following_to_guest_user'] = this.isIamFollowingToGuestUser;
if (this.businessType != null) {
data['business_type'] = this.businessType!.toJson();
}
if (this.iamPrincipalData != null) {
data['iam_principal_data'] = this.iamPrincipalData!.toJson();
}
return data;
}
}
@@ -177,3 +205,208 @@ class BusinessType {
return data;
}
}
class IamPrincipalData {
int? id;
int? principalTypeXid;
int? principalSourceXid;
String? oneSignalPlayerId;
String? googleId;
String? appleId;
String? facebookId;
String? microsoftId;
String? userName;
String? pin;
String? fullName;
String? gender;
String? dateOfBirth;
String? phoneNumber;
String? otherPhoneNumber;
String? emailAddress;
String? addressLine1;
String? addressLine2;
String? cityXid;
String? stateXid;
String? countryXid;
String? postCode;
String? lastLoginDatetime;
String? profilePhoto;
String? referralCode;
String? description;
String? about;
String? position;
String? trainingScores;
String? height;
String? weight;
String? battingAverage;
int? isProfileUpdated;
String? isActive;
int? groupNotification;
int? communityNotification;
int? followerNotification;
int? newFollowerNotification;
int? directMessageNotification;
int? isAccountVisibility;
int? isDeleted;
String? reason;
String? createdBy;
String? modifiedBy;
String? deletedAt;
String? createdAt;
String? updatedAt;
String? profileImage;
IamPrincipalData(
{this.id,
this.principalTypeXid,
this.principalSourceXid,
this.oneSignalPlayerId,
this.googleId,
this.appleId,
this.facebookId,
this.microsoftId,
this.userName,
this.pin,
this.fullName,
this.gender,
this.dateOfBirth,
this.phoneNumber,
this.otherPhoneNumber,
this.emailAddress,
this.addressLine1,
this.addressLine2,
this.cityXid,
this.stateXid,
this.countryXid,
this.postCode,
this.lastLoginDatetime,
this.profilePhoto,
this.referralCode,
this.description,
this.about,
this.position,
this.trainingScores,
this.height,
this.weight,
this.battingAverage,
this.isProfileUpdated,
this.isActive,
this.groupNotification,
this.communityNotification,
this.followerNotification,
this.newFollowerNotification,
this.directMessageNotification,
this.isAccountVisibility,
this.isDeleted,
this.reason,
this.createdBy,
this.modifiedBy,
this.deletedAt,
this.createdAt,
this.updatedAt,
this.profileImage});
IamPrincipalData.fromJson(Map<String, dynamic> json) {
id = json['id'];
principalTypeXid = json['principal_type_xid'];
principalSourceXid = json['principal_source_xid'];
oneSignalPlayerId = json['one_signal_player_id'];
googleId = json['google_id'];
appleId = json['apple_id'];
facebookId = json['facebook_id'];
microsoftId = json['microsoft_id'];
userName = json['user_name'];
pin = json['pin'];
fullName = json['full_name'];
gender = json['gender'];
dateOfBirth = json['date_of_birth'];
phoneNumber = json['phone_number'];
otherPhoneNumber = json['other_phone_number'];
emailAddress = json['email_address'];
addressLine1 = json['address_line1'];
addressLine2 = json['address_line2'];
cityXid = json['city_xid'];
stateXid = json['state_xid'];
countryXid = json['country_xid'];
postCode = json['post_code'];
lastLoginDatetime = json['last_login_datetime'];
profilePhoto = json['profile_photo'];
referralCode = json['referral_code'];
description = json['description'];
about = json['about'];
position = json['position'];
trainingScores = json['training_scores'];
height = json['height'];
weight = json['weight'];
battingAverage = json['batting_average'];
isProfileUpdated = json['is_profile_updated'];
isActive = json['is_active'];
groupNotification = json['group_notification'];
communityNotification = json['community_notification'];
followerNotification = json['follower_notification'];
newFollowerNotification = json['new_follower_notification'];
directMessageNotification = json['direct_message_notification'];
isAccountVisibility = json['is_account_visibility'];
isDeleted = json['is_deleted'];
reason = json['reason'];
createdBy = json['created_by'];
modifiedBy = json['modified_by'];
deletedAt = json['deleted_at'];
createdAt = json['created_at'];
updatedAt = json['updated_at'];
profileImage = json['profile_image'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['principal_type_xid'] = this.principalTypeXid;
data['principal_source_xid'] = this.principalSourceXid;
data['one_signal_player_id'] = this.oneSignalPlayerId;
data['google_id'] = this.googleId;
data['apple_id'] = this.appleId;
data['facebook_id'] = this.facebookId;
data['microsoft_id'] = this.microsoftId;
data['user_name'] = this.userName;
data['pin'] = this.pin;
data['full_name'] = this.fullName;
data['gender'] = this.gender;
data['date_of_birth'] = this.dateOfBirth;
data['phone_number'] = this.phoneNumber;
data['other_phone_number'] = this.otherPhoneNumber;
data['email_address'] = this.emailAddress;
data['address_line1'] = this.addressLine1;
data['address_line2'] = this.addressLine2;
data['city_xid'] = this.cityXid;
data['state_xid'] = this.stateXid;
data['country_xid'] = this.countryXid;
data['post_code'] = this.postCode;
data['last_login_datetime'] = this.lastLoginDatetime;
data['profile_photo'] = this.profilePhoto;
data['referral_code'] = this.referralCode;
data['description'] = this.description;
data['about'] = this.about;
data['position'] = this.position;
data['training_scores'] = this.trainingScores;
data['height'] = this.height;
data['weight'] = this.weight;
data['batting_average'] = this.battingAverage;
data['is_profile_updated'] = this.isProfileUpdated;
data['is_active'] = this.isActive;
data['group_notification'] = this.groupNotification;
data['community_notification'] = this.communityNotification;
data['follower_notification'] = this.followerNotification;
data['new_follower_notification'] = this.newFollowerNotification;
data['direct_message_notification'] = this.directMessageNotification;
data['is_account_visibility'] = this.isAccountVisibility;
data['is_deleted'] = this.isDeleted;
data['reason'] = this.reason;
data['created_by'] = this.createdBy;
data['modified_by'] = this.modifiedBy;
data['deleted_at'] = this.deletedAt;
data['created_at'] = this.createdAt;
data['updated_at'] = this.updatedAt;
data['profile_image'] = this.profileImage;
return data;
}
}

View File

@@ -4,10 +4,13 @@ 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/ShimmerCommon.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';
@@ -34,6 +37,49 @@ class _profiletabBusGestState extends State<profiletabBusGest> {
super.initState();
}
int? followunfollowid;
int? blockid;
FollowUnfollowUploadata() async {
utils.loader();
Map<String, dynamic> newupdata = {
"following_iam_principal_xid": followunfollowid,
};
final data = await Profilepostmethod().postunfollowuser(newupdata);
if (data.status == ResponseStatus.SUCCESS) {
Get.back();
updata = Get.arguments?['FolloweridIndex'] ??
Get.arguments?['FollowingidIndex'] ??
"64";
guestBusfuture = GuestProfileApi().getGuestProfileBus(updata);
// return utils.showToast(data.message);
} else {
Get.back();
print("unfollow not done");
return utils.showToast(data.message);
}
}
BlockUploadata() async {
utils.loader();
Map<String, dynamic> updata = {
"blocked_iam_principal_xid": blockid,
};
final data = await Profilepostmethod().postBlockuser(updata);
if (data.status == ResponseStatus.SUCCESS) {
Get.back();
// Get.back();
Get.toNamed(RouteName.mainscreen, arguments: 4);
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(
@@ -82,7 +128,8 @@ class _profiletabBusGestState extends State<profiletabBusGest> {
children: [
Stack(
children: [
guestGetProfileBus!.data!.bannerImage != null
guestGetProfileBus!.data!.businessProfileImage !=
null
? Container(
width: double.infinity,
height: 484.h,
@@ -90,8 +137,8 @@ class _profiletabBusGestState extends State<profiletabBusGest> {
image: DecorationImage(
image: Image(
image: NetworkImage(
guestGetProfileBus!
.data!.bannerImage ??
guestGetProfileBus!.data!
.businessProfileImage ??
''),
).image,
fit: BoxFit.cover,
@@ -205,7 +252,10 @@ class _profiletabBusGestState extends State<profiletabBusGest> {
updata,
});
},
child: Column(
child:
// guestGetProfileBus.data.
Column(
children: [
text16400white(
guestGetProfileBus!
@@ -244,18 +294,38 @@ class _profiletabBusGestState extends State<profiletabBusGest> {
GestureDetector(
onTap: () {
// Get.toNamed(RouteName.buseditprofile);
followunfollowid =
guestGetProfileBus!.data!.id;
FollowUnfollowUploadata();
print(followunfollowid);
},
child: Container(
height: 40.h,
width: 170.w,
decoration: BoxDecoration(
color: Color(0xFFD90B2E),
borderRadius:
BorderRadius.circular(30.r),
),
child: Center(
child: text16w400_FCFCFC("Follow")),
),
child: guestGetProfileBus!.data!
.isIamFollowingToGuestUser ==
0
? Container(
height: 40.h,
width: 170.w,
decoration: BoxDecoration(
color: Color(0xFFD90B2E),
borderRadius:
BorderRadius.circular(30.r),
),
child: Center(
child: text16w400_FCFCFC(
"Follow")),
)
: Container(
height: 40.h,
width: 170.w,
decoration: BoxDecoration(
color: Color(0xFFD90B2E),
borderRadius:
BorderRadius.circular(30.r),
),
child: Center(
child: text16w400_FCFCFC(
"Unfollow")),
),
),
GestureDetector(
onTap: () {
@@ -509,7 +579,14 @@ class _profiletabBusGestState extends State<profiletabBusGest> {
),
const PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
onTap: () async {
setState(() {
blockid =
guestGetProfileBus!.data!.id ?? 0;
BlockUploadata();
});
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 12.w),

View File

@@ -102,15 +102,24 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
}
int? followunfollowid;
int? blockid;
FollowUnfollowUploadata() async {
utils.loader();
Map<String, dynamic> updata = {
Map<String, dynamic> newupdata = {
"following_iam_principal_xid": followunfollowid,
};
final data = await Profilepostmethod().postunfollowuser(updata);
final data = await Profilepostmethod().postunfollowuser(newupdata);
if (data.status == ResponseStatus.SUCCESS) {
Get.back();
updata = Get.arguments?['FolloweridIndex'] ??
Get.arguments?['FollowingidIndex'] ??
"56";
GuestProfileApi().getGuestProfileInd(updata).then((value) {
setState(() {});
});
// return utils.showToast(data.message);
} else {
Get.back();
@@ -119,19 +128,25 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
}
}
// 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');
// }
// }
BlockUploadata() async {
utils.loader();
Map<String, dynamic> updata = {
"blocked_iam_principal_xid": blockid,
};
final data = await Profilepostmethod().postBlockuser(updata);
if (data.status == ResponseStatus.SUCCESS) {
Get.back();
// Get.back();
Get.toNamed(RouteName.mainscreen, arguments: 4);
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) {
@@ -163,7 +178,13 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
if (snapshot.connectionState == ConnectionState.done &&
snapshot.hasData) {
print("Data fetched-->");
return Stack(clipBehavior: Clip.none, children: [
return
// guestGetProfileInd!.data!.isBlank!
// ?
// _buildNoDataBody(context)
// :
Stack(clipBehavior: Clip.none, children: [
Container(
decoration: const BoxDecoration(
image: DecorationImage(
@@ -1169,7 +1190,17 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
),
const PopupMenuDivider(),
PopupMenuItem(
onTap: () {},
onTap: ()async {
setState(() {
blockid = guestGetProfileInd!.data!.id ?? 0;
BlockUploadata();
});
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 12.w),
@@ -1214,6 +1245,24 @@ class _ProfileTabIndGuestState extends State<ProfileTabIndGuest> {
return Container();
}));
}
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 commonTimelineCard(
{required String imagePath,

View File

@@ -436,6 +436,24 @@ class _FollowersTabState extends State<FollowersTab> {
],
);
}
Widget _buildNoDataBody(context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"No Data Found",
style: TextStyle(
color: Colors.white,
fontSize: 16.sp,
fontWeight: FontWeight.w600),
)
],
);
}
}
class FollowingTab extends StatefulWidget {
@@ -765,44 +783,19 @@ class _FollowingTabState extends State<FollowingTab> {
]);
}
// Widget _buildNoDataBody(context) {
// return Expanded(
// child: Center(
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Text(
// "No Data Found",
// style: TextStyle(
// color: Colors.white,
// fontSize: 16.sp,
// fontWeight: FontWeight.w600),
// )
// ],
// ),
// ),
// );
// }
}
Widget _buildNoDataBody(context) {
return Expanded(
child: Padding(
padding: EdgeInsets.only(bottom: 40.h),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"No Data Found",
style: TextStyle(
color: Colors.white,
fontSize: 16.sp,
fontWeight: FontWeight.w600),
)
],
),
),
);
Widget _buildNoDataBody(context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"No Data Found",
style: TextStyle(
color: Colors.white,
fontSize: 16.sp,
fontWeight: FontWeight.w600),
)
],
);
}
}

View File

@@ -39,7 +39,7 @@ class _AccountSettingsState extends State<AccountSettings> {
setState(() {
accounTypeLogin = prefs.getString('accountTypefromLogin');
print('account type login is $accounTypeLogin');
// accountTypeValue = prefs.getString('accountTypeValue');
accountTypeValue = prefs.getString('accountTypeValue');
// print('account type value is $accountTypeValue');
});
}

View File

@@ -32,7 +32,7 @@ class _HelpAndSupportState extends State<HelpAndSupport> {
setState(() {
accounTypeLogin = prefs.getString('accountTypefromLogin');
print('account type login is $accounTypeLogin');
// accountTypeValue = prefs.getString('accountTypeValue');
accountTypeValue = prefs.getString('accountTypeValue');
// print('account type value is $accountTypeValue');
});
}

View File

@@ -38,8 +38,8 @@ class _SettingsState extends State<Settings> {
setState(() {
accounTypeLogin = prefs.getString('accountTypefromLogin');
print('account type login is $accounTypeLogin');
// accountTypeValue = prefs.getString('accountTypeValue');
// print('account type value is $accountTypeValue');
accountTypeValue = prefs.getString('accountTypeValue');
print('account type value is $accountTypeValue');
});
}
@@ -57,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();

View File

@@ -72,7 +72,7 @@ class _LoginScreenState extends State<LoginScreen> {
snackStyle: SnackStyle.FLOATING,
snackPosition: SnackPosition.BOTTOM,
);
Get.toNamed(RouteName.mainscreen);
Get.toNamed(RouteName.mainscreen,arguments: 0);
logger.d("go to login");
}
} else {

View File

@@ -16,6 +16,7 @@ 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 Verifygoogleandapple extends StatefulWidget {
Verifygoogleandapple({
@@ -51,6 +52,11 @@ class _VerifygoogleandappleState extends State<Verifygoogleandapple> {
}
}
final Map<String, int> _accountTypeMap = {
'Individual': 1,
'Business': 2,
};
_createAccountWithOAuth() async {
var updata = {
"principal_type_xid": getIdFromAccountType(),
@@ -59,8 +65,16 @@ class _VerifygoogleandappleState extends State<Verifygoogleandapple> {
final resp = await LoginAPI()
.storeUserDetailsWhenComingFromGoogleAppleSignin(updata);
SharedPreferences prefs = await SharedPreferences.getInstance();
if (resp.status == ResponseStatus.SUCCESS) {
int accountTypeValue = _accountTypeMap[_selectedAccountType] ?? 0;
await prefs.setString('accountTypefromLogin',
accountTypeValue.toString());
await prefs.setString('accountTypeValue',
accountTypeValue.toString());
if (_selectedAccountType == 'Individual') {
Get.toNamed(RouteName.tellusindividualscreen);
} else {

View File

@@ -35,6 +35,8 @@ class LoginAPI {
phonenumber = loginObj.data?.userData?.phoneNumber;
await prefs.setString('accountTypefromLogin',
loginObj.data?.userData?.principalTypeXid.toString() ?? "");
await prefs.setString('accountTypeValue',
loginObj.data?.userData?.principalTypeXid.toString() ?? "");
print("token is ${loginObj.data!.accessToken!}");
if (loginObj.data?.userData?.isProfileUpdated == 0) {

View File

@@ -163,6 +163,9 @@ class _SignupScreenState extends State<SignupScreen> {
});
await prefs.setString(
'accountTypeValue', accountTypeValue.toString() ?? "");
await prefs.setString(
'accountTypefromLogin', accountTypeValue.toString() ?? "");
return utils.showToast(data.message);
} else {
Get.back();