@@ -13,16 +13,16 @@ class InterestModel {
|
||||
if (json['data'] != null) {
|
||||
data = <Data>[];
|
||||
json['data'].forEach((v) {
|
||||
data!.add(new Data.fromJson(v));
|
||||
data!.add(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;
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['status'] = status;
|
||||
data['status_code'] = statusCode;
|
||||
data['message'] = message;
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
@@ -33,7 +33,7 @@ class InterestModel {
|
||||
class Data {
|
||||
int? id;
|
||||
String? name;
|
||||
Null? image;
|
||||
String? image;
|
||||
|
||||
Data({this.id, this.name, this.image});
|
||||
|
||||
@@ -44,10 +44,10 @@ class Data {
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
data['image'] = this.image;
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['name'] = name;
|
||||
data['image'] = image;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,8 +45,6 @@ class _EditProfileState extends State<EditProfile> {
|
||||
TextEditingController weightController = TextEditingController();
|
||||
TextEditingController battingAvgController = TextEditingController();
|
||||
|
||||
// final InterestListApi interestcontroller = Get.put(InterestListApi());
|
||||
|
||||
String profilePicture = "";
|
||||
bool isImageAdded = false;
|
||||
|
||||
@@ -72,83 +70,15 @@ class _EditProfileState extends State<EditProfile> {
|
||||
});
|
||||
}
|
||||
|
||||
String _selectedsportType = '';
|
||||
List<String> _selectedSports = [];
|
||||
|
||||
void _onSportSelected(List<String> selectedValues) {
|
||||
setState(() {
|
||||
_selectedSports = selectedValues;
|
||||
_selectedsportType = _selectedSports.join(', ');
|
||||
});
|
||||
}
|
||||
|
||||
// List<int> getSelectedSportsIds() {
|
||||
// if (getEditProfileIndi == null ||
|
||||
// getEditProfileIndi!.data!.interest == null) {
|
||||
// print("No interests found.");
|
||||
// return [];
|
||||
// }
|
||||
|
||||
// print("Selected sports: $_selectedSports");
|
||||
|
||||
// List<int> selectedIds = _selectedSports
|
||||
// .map((sportName) {
|
||||
// var interest = getEditProfileIndi!.data!.interest!.firstWhere(
|
||||
// (interest) => interest.name == sportName,
|
||||
// orElse: () => Interest(id: -1, name: ''),
|
||||
// );
|
||||
|
||||
// if (interest.id == -1) {
|
||||
// print("No matching interest found for sport: $sportName");
|
||||
// } else {
|
||||
// print(
|
||||
// "Found interest for sport: $sportName with ID: ${interest.id}");
|
||||
// }
|
||||
|
||||
// return interest.id!;
|
||||
// })
|
||||
// .where((id) => id != -1)
|
||||
// .toList();
|
||||
|
||||
// print("Selected IDs: $selectedIds");
|
||||
// return selectedIds;
|
||||
// }
|
||||
|
||||
//interestList
|
||||
|
||||
// int id = Get.arguments["id"];
|
||||
// bool edited = Get.arguments["edit"];
|
||||
|
||||
interestlist.InterestModel? interestModel;
|
||||
List<interestlist.Data> interest = [];
|
||||
List<String> _interestdrop = [];
|
||||
List<int> selectedinterestid = [];
|
||||
List<String> selectedNameList = [];
|
||||
RxBool isloading = true.obs;
|
||||
|
||||
// Future<void> fetchInterestlist() async {
|
||||
// InterestListApi interestListAPI = InterestListApi();
|
||||
// ResponseData<dynamic> response = await interestListAPI.getinterestlistApi();
|
||||
|
||||
// if (response.status == ResponseStatus.SUCCESS) {
|
||||
// interestModel = await interestlist.InterestModel.fromJson(response.data!);
|
||||
// setState(() {
|
||||
// interest = interestModel!.data ?? [];
|
||||
// _interestdrop =
|
||||
// interest.map((platform) => platform.name.toString()).toList();
|
||||
// });
|
||||
// log(interest.toString());
|
||||
// } else {
|
||||
// print('Failed to fetch abilities');
|
||||
// }
|
||||
// }
|
||||
|
||||
void getCatIdFromName(List<String> selectedInterests) {
|
||||
selectedinterestid.clear();
|
||||
for (var name in selectedInterests) {
|
||||
for (var i = 0; i < interest.length; i++) {
|
||||
if (name == interest[i].name) {
|
||||
selectedinterestid.add(interest[i].id!);
|
||||
for (var i = 0; i < interestlistobj!.data!.length; i++) {
|
||||
if (name == interestlistobj!.data![i].name) {
|
||||
selectedinterestid.add(interestlistobj!.data![i].id!);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -157,9 +87,6 @@ class _EditProfileState extends State<EditProfile> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
// if (edited == true) {
|
||||
|
||||
myfuture = EditProfileApi()
|
||||
.getEditProfileIndividual()
|
||||
.then((value) => {setValues()});
|
||||
@@ -175,9 +102,7 @@ class _EditProfileState extends State<EditProfile> {
|
||||
|
||||
_selectedgenderType = getEditProfileIndi!.data!.gender ?? '';
|
||||
locationController.text = getEditProfileIndi!.data!.location ?? '';
|
||||
// _selectedSports =
|
||||
// getEditProfileIndi!.data!.interest!.map((e) => e.name!).toList();
|
||||
// _selectedsportType = _selectedSports.join(', ');
|
||||
|
||||
locationController.text = getEditProfileIndi!.data!.about ?? '';
|
||||
aboutController.text = getEditProfileIndi!.data!.about ?? '';
|
||||
positionController.text =
|
||||
@@ -191,48 +116,14 @@ class _EditProfileState extends State<EditProfile> {
|
||||
battingAvgController.text =
|
||||
getEditProfileIndi!.data!.battingAverage ?? '372';
|
||||
|
||||
log(_interestsMap.length.toString());
|
||||
setState(() {
|
||||
interest = interestlistobj!.data ?? [];
|
||||
_interestdrop =
|
||||
interest.map((platform) => platform.name.toString()).toList();
|
||||
});
|
||||
|
||||
String interestsXids =
|
||||
getEditProfileIndi!.data!.interest!.map((e) => e.id!).toString();
|
||||
interestsIds = interestsXids
|
||||
.split(',')
|
||||
.map((e) => int.tryParse(e.trim()) ?? 0)
|
||||
.toList();
|
||||
selectedinterestid = interestsIds;
|
||||
|
||||
print(selectedinterestid.toList());
|
||||
|
||||
for (int i = 0; i < _interestdrop.length; i++) {
|
||||
_interestsMap.add({
|
||||
"id": i + 1,
|
||||
"name": _interestdrop[i],
|
||||
});
|
||||
}
|
||||
getSelectedNames(selectedinterestid).then((value) {
|
||||
selectedNameList = value;
|
||||
});
|
||||
isOnce = false;
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
List<int> interestsIds = [];
|
||||
List<Map<String, dynamic>> _interestsMap = [];
|
||||
|
||||
void saveEditProfileInd() async {
|
||||
utils.loader();
|
||||
// List<int> selectedSportsIds = getSelectedSportsIds();
|
||||
// String interestsString = '[' +
|
||||
// selectedSportsIds.join(', ') +
|
||||
// ']';
|
||||
|
||||
// print("Interests String: $interestsString");
|
||||
FormData? updata;
|
||||
|
||||
var imageFile;
|
||||
@@ -278,9 +169,9 @@ class _EditProfileState extends State<EditProfile> {
|
||||
"date_of_birth": dateController.text,
|
||||
"gender": _selectedgenderType,
|
||||
// "interest": "selectedSportsIds",
|
||||
"interest":
|
||||
// '[1,2,3,4]',
|
||||
abilitiesIds,
|
||||
"interest":
|
||||
// '[1,2,3,4]',
|
||||
abilitiesIds,
|
||||
"about": aboutController.text,
|
||||
"position": positionController.text,
|
||||
"training_scores": trainingScoresController.text,
|
||||
@@ -325,19 +216,6 @@ class _EditProfileState extends State<EditProfile> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<String>> getSelectedNames(List<int> selectedIds) async {
|
||||
List<String> selectedNames = [];
|
||||
for (int id in selectedIds) {
|
||||
for (var interest in interest) {
|
||||
if (interest.id == id) {
|
||||
selectedNames.add(interest.name!);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return selectedNames;
|
||||
}
|
||||
|
||||
final UserIndiProfileImageController editProfileImage =
|
||||
Get.put(UserIndiProfileImageController());
|
||||
|
||||
@@ -346,7 +224,6 @@ class _EditProfileState extends State<EditProfile> {
|
||||
return GestureDetector(
|
||||
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
child: Scaffold(
|
||||
// key: _scaffoldKey1,
|
||||
backgroundColor: const Color(0xFF222935),
|
||||
extendBody: true,
|
||||
appBar: const CommonAppbar(
|
||||
@@ -390,55 +267,6 @@ class _EditProfileState extends State<EditProfile> {
|
||||
sizedBoxHeight(25.h),
|
||||
Stack(
|
||||
children: [
|
||||
// profilePicture != "" && isImageAdded
|
||||
// ? ClipOval(
|
||||
// child: SizedBox.fromSize(
|
||||
// size: Size.fromRadius(50.r),
|
||||
// child: Image.file(
|
||||
// File(profilePicture),
|
||||
// fit: BoxFit.cover,
|
||||
// width: double.infinity,
|
||||
// errorBuilder:
|
||||
// (BuildContext context,
|
||||
// Object exception,
|
||||
// StackTrace? stackTrace) {
|
||||
// return CircleAvatar(
|
||||
// backgroundImage: const AssetImage(
|
||||
// "assets/images/png/cimg3.png"),
|
||||
// radius: 50.r,
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// : getEditProfileIndi
|
||||
// ?.data?.profilePhoto !=
|
||||
// null &&
|
||||
// getEditProfileIndi!.data!
|
||||
// .profilePhoto!.isNotEmpty
|
||||
// ? Container(
|
||||
// width: 100.w,
|
||||
// height: 100.h,
|
||||
// decoration: ShapeDecoration(
|
||||
// image: DecorationImage(
|
||||
// image: NetworkImage(
|
||||
// getEditProfileIndi!
|
||||
// .data!.profilePhoto!,
|
||||
// ),
|
||||
// fit: BoxFit.cover,
|
||||
// // onError: (error, stackTrace) {
|
||||
// // // Fallback to default image in case of error
|
||||
// // return const AssetImage("assets/images/png/cimg3.png");
|
||||
// // },
|
||||
// ),
|
||||
// shape: const OvalBorder(),
|
||||
// ),
|
||||
// )
|
||||
// : CircleAvatar(
|
||||
// backgroundImage: const AssetImage(
|
||||
// "assets/images/png/cimg3.png"),
|
||||
// radius: 50.r,
|
||||
// ),
|
||||
Obx(
|
||||
() => editProfileImage
|
||||
.usserprofilePicPath.value !=
|
||||
@@ -621,7 +449,7 @@ class _EditProfileState extends State<EditProfile> {
|
||||
header: _selectedgenderType ?? "Male",
|
||||
title: "",
|
||||
showOtherOption: true,
|
||||
listData: [
|
||||
listData: const [
|
||||
"Male",
|
||||
"Female",
|
||||
"Prefer not to say"
|
||||
@@ -675,44 +503,22 @@ class _EditProfileState extends State<EditProfile> {
|
||||
],
|
||||
),
|
||||
sizedBoxHeight(16.h),
|
||||
// CustomDropDownChexkBox(
|
||||
// header: _selectedsportType ??
|
||||
// "Rowing, Rugby, Swimming",
|
||||
// title: "",
|
||||
// listData: [
|
||||
// "Rowing",
|
||||
// "Cycling",
|
||||
// "Running",
|
||||
// "Swimming",
|
||||
// "Triathlon",
|
||||
// "Hiking",
|
||||
// "Football",
|
||||
// "Rugby"
|
||||
// ],
|
||||
// onItemSelected: _onSportSelected,
|
||||
// leadingImage: Image.asset(
|
||||
// "assets/images/png/Vector (4).png",
|
||||
// width: 18.w,
|
||||
// height: 17.h,
|
||||
// ),
|
||||
// showOtherOption: true,
|
||||
// initiallySelected: _selectedSports,
|
||||
// ),
|
||||
|
||||
// Obx(() {
|
||||
// return CustomDropDownChexkBox(
|
||||
// header: 'Select interest',
|
||||
// title: "",
|
||||
// listData: _interestdrop,
|
||||
// onItemSelected: getCatIdFromName,
|
||||
// leadingImage: Image.asset(
|
||||
// "assets/images/png/Vector (4).png",
|
||||
// width: 18.w,
|
||||
// height: 17.h,
|
||||
// ),
|
||||
// // showOtherOption: true,
|
||||
// initiallySelected: selectedNameList,
|
||||
// );
|
||||
//Obx(() {
|
||||
//return
|
||||
CustomDropDownChexkBox(
|
||||
header: 'Select interest',
|
||||
title: "",
|
||||
listData: listofInterests,
|
||||
onItemSelected: getCatIdFromName,
|
||||
leadingImage: Image.asset(
|
||||
"assets/images/png/Vector (4).png",
|
||||
width: 18.w,
|
||||
height: 17.h,
|
||||
),
|
||||
// showOtherOption: true,
|
||||
initiallySelected: listofUserInterests,
|
||||
),
|
||||
// }),
|
||||
|
||||
sizedBoxHeight(20.h),
|
||||
@@ -779,7 +585,7 @@ class _EditProfileState extends State<EditProfile> {
|
||||
battingAvgController.text.isBlank!) {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Enter your credentials',
|
||||
'Please fill missing details',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
|
||||
@@ -11,6 +11,7 @@ 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/Global.dart';
|
||||
import 'package:regroup/Utils/Common/ShimmerCommon.dart';
|
||||
|
||||
import 'package:regroup/Utils/Common/sized_box.dart';
|
||||
@@ -99,9 +100,6 @@ class _ProfileTabState extends State<ProfileTab> {
|
||||
String? interestText;
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
setValues();
|
||||
|
||||
individualfuture = EditProfileApi()
|
||||
.getEditProfileIndividual()
|
||||
.then((value) => {setValues()});
|
||||
@@ -114,14 +112,7 @@ class _ProfileTabState extends State<ProfileTab> {
|
||||
|
||||
setValues() async {
|
||||
if (isOnce) {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
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
|
||||
interestText =
|
||||
getEditProfileIndi!.data!.interest!.map((e) => e.name).join(', ');
|
||||
}
|
||||
@@ -198,11 +189,9 @@ class _ProfileTabState extends State<ProfileTab> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
// key: _scaffoldKey1,
|
||||
backgroundColor: const Color(0xFF222935),
|
||||
extendBody: true,
|
||||
// accountTypeValue == '1' ||
|
||||
body: accounTypeLogin == '1' || accountTypeValue == '1'
|
||||
body: globalAccountType == '1'
|
||||
? FutureBuilder(
|
||||
future: individualfuture,
|
||||
builder: (ctx, snapshot) {
|
||||
@@ -210,7 +199,7 @@ class _ProfileTabState extends State<ProfileTab> {
|
||||
return
|
||||
// ShimmerCommon();
|
||||
|
||||
Center(
|
||||
const Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.blue,
|
||||
),
|
||||
@@ -1131,7 +1120,7 @@ class _ProfileTabState extends State<ProfileTab> {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return
|
||||
// ShimmerCommon();
|
||||
Center(
|
||||
const Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.blue,
|
||||
),
|
||||
@@ -1524,7 +1513,6 @@ class _ProfileTabState extends State<ProfileTab> {
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
|
||||
bottomNavigationBar: bottomnavigationbar(mainController),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,60 +13,13 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
GetEditProfileIndi? getEditProfileIndi;
|
||||
GetEditProfileBus? getEditProfileBus;
|
||||
List<String> listofUserInterests = [];
|
||||
|
||||
bool accountvisibility = true;
|
||||
|
||||
class EditProfileApi{
|
||||
class EditProfileApi {
|
||||
EditProfileApi();
|
||||
|
||||
// var interestModel = Rx<interestlist.InterestModel?>(null);
|
||||
// var interest = RxList<interestlist.Data>();
|
||||
// var interestdrop = RxList<String>();
|
||||
// var selectedinterestid = RxList<int>();
|
||||
// var selctedNameList = RxList<String>();
|
||||
// var isloading = true.obs;
|
||||
// var interestsIds = RxList<int>();
|
||||
// var interestsMap = RxList<Map<String, dynamic>>();
|
||||
|
||||
// Future<void> fetchInterestlist() async {
|
||||
// InterestListApi interestListAPI = InterestListApi();
|
||||
// ResponseData<dynamic> response = await interestListAPI.getinterestlistApi();
|
||||
|
||||
// if (response.status == ResponseStatus.SUCCESS) {
|
||||
// interestModel.value = interestlist.InterestModel.fromJson(response.data!);
|
||||
// interest.value = interestModel.value!.data ?? [];
|
||||
// interestdrop.value = interest.map((platform) => platform.name!).toList();
|
||||
// log(interest.toString());
|
||||
// } else {
|
||||
// print('Failed to fetch abilities');
|
||||
// }
|
||||
// }
|
||||
|
||||
// void getCatIdFromName(List<String> selectedInterests) {
|
||||
// selectedinterestid.clear();
|
||||
// for (var name in selectedInterests) {
|
||||
// for (var i = 0; i < interest.length; i++) {
|
||||
// if (name == interest[i].name) {
|
||||
// selectedinterestid.add(interest[i].id!);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// Future<List<String>> getSelectedNames(List<int> selectedIds) async {
|
||||
// List<String> selectedNames = [];
|
||||
// for (int id in selectedIds) {
|
||||
// for (var interest in interest) {
|
||||
// if (interest.id == id) {
|
||||
// selectedNames.add(interest.name!);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return selectedNames;
|
||||
// }
|
||||
|
||||
Future<ResponseData<dynamic>> postEditProfileIndividual(var data) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
final response =
|
||||
@@ -84,28 +37,12 @@ class EditProfileApi{
|
||||
|
||||
Future<ResponseData<dynamic>> getEditProfileIndividual() async {
|
||||
final response = await NetworkApiServices().getApi(ApiUrls.geteditprofile);
|
||||
getEditProfileIndi = GetEditProfileIndi.fromJson(response.data);
|
||||
|
||||
if (response.status == ResponseStatus.SUCCESS) {
|
||||
if (response.data["status"] == "success") {
|
||||
getEditProfileIndi = GetEditProfileIndi.fromJson(response.data);
|
||||
accountvisibility = getEditProfileIndi!.data!.accountVisibility == 1;
|
||||
// await fetchInterestlist();
|
||||
// String interestsXids =
|
||||
// getEditProfileIndi!.data!.interest!.map((e) => e.id!).join(',');
|
||||
// interestsIds.value = interestsXids
|
||||
// .split(',')
|
||||
// .map((e) => int.tryParse(e.trim()) ?? 0)
|
||||
// .toList();
|
||||
// selectedinterestid.value = interestsIds;
|
||||
|
||||
// for (var interest in interest) {
|
||||
// interestsMap.add({
|
||||
// "id": interest.id!,
|
||||
// "name": interest.name!,
|
||||
// });
|
||||
// }
|
||||
|
||||
// selctedNameList.value = await getSelectedNames(selectedinterestid);
|
||||
// }
|
||||
getUserIntersetFromResponse();
|
||||
}
|
||||
return ResponseData<dynamic>(
|
||||
response.data['message'], ResponseStatus.SUCCESS,
|
||||
@@ -116,6 +53,12 @@ class EditProfileApi{
|
||||
}
|
||||
}
|
||||
|
||||
getUserIntersetFromResponse() {
|
||||
for (var interests in getEditProfileIndi!.data!.interest!) {
|
||||
listofUserInterests.add(interests.name ?? "null");
|
||||
}
|
||||
}
|
||||
|
||||
Future<ResponseData<dynamic>> postEditProfileBusiness(var data) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
final response = await NetworkApiServices()
|
||||
@@ -135,8 +78,9 @@ class EditProfileApi{
|
||||
final response = await NetworkApiServices().getApi(
|
||||
ApiUrls.geteditprofilebusiness,
|
||||
);
|
||||
getEditProfileBus = GetEditProfileBus.fromJson(response.data);
|
||||
if (response.status == ResponseStatus.SUCCESS) {
|
||||
getEditProfileBus = GetEditProfileBus.fromJson(response.data);
|
||||
|
||||
if (response.data["status"] == "success") {
|
||||
print("Success---->");
|
||||
return ResponseData<dynamic>(
|
||||
|
||||
@@ -1,25 +1,12 @@
|
||||
import 'dart:ffi';
|
||||
|
||||
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/EditProfile/Model/InterestModel.dart';
|
||||
|
||||
// Future<void> fetchInterestlist() async {
|
||||
// InterestListApi interestListAPI = InterestListApi();
|
||||
// ResponseData<dynamic> response = await interestListAPI.getinterestlistApi();
|
||||
|
||||
// if (response.status == ResponseStatus.SUCCESS) {
|
||||
// interestModel = await interestlist.InterestModel.fromJson(response.data!);
|
||||
// setState(() {
|
||||
// interest = interestModel!.data ?? [];
|
||||
// _interestdrop =
|
||||
// interest.map((platform) => platform.name.toString()).toList();
|
||||
// });
|
||||
// log(interest.toString());
|
||||
// } else {
|
||||
// print('Failed to fetch abilities');
|
||||
// }
|
||||
// }
|
||||
InterestModel? interestlistobj;
|
||||
List<String> listofInterests = [];
|
||||
|
||||
class InterestListApi {
|
||||
InterestListApi();
|
||||
@@ -33,13 +20,19 @@ class InterestListApi {
|
||||
Map<String, dynamic> responseData =
|
||||
Map<String, dynamic>.from(response.data);
|
||||
if (responseData['status'] == "success") {
|
||||
print("success");
|
||||
interestlistobj = InterestModel.fromJson(responseData);
|
||||
getIntersetFromResponse();
|
||||
} else {
|
||||
// return ResponseData<dynamic>(
|
||||
// responseData['message'], ResponseStatus.FAILED);
|
||||
return ResponseData<dynamic>(
|
||||
responseData['message'], ResponseStatus.FAILED);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
getIntersetFromResponse() {
|
||||
for (var interests in interestlistobj!.data!) {
|
||||
listofInterests.add(interests.name ?? "null");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
String? myusername;
|
||||
@@ -14,3 +13,5 @@ bool OnBoard = false;
|
||||
RxInt notification = 0.obs;
|
||||
late Timer timerhomeglobal;
|
||||
bool isTimerInitialize = false;
|
||||
String? globalAccountType;
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class _CustomDropDownWidgetSignupState
|
||||
// ),
|
||||
|
||||
widget.leadingImage == null
|
||||
? SizedBox()
|
||||
? const SizedBox()
|
||||
: widget.leadingImage!,
|
||||
|
||||
SizedBox(width: 16.w),
|
||||
@@ -713,7 +713,7 @@ class _CustomDropDownRadioState extends State<CustomDropDownRadio> {
|
||||
fontFamily: 'Helvetica',
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
onDropTap.value
|
||||
? Image.asset('assets/images/png/arrowup.png')
|
||||
: Image.asset('assets/images/png/arrowdown.png'),
|
||||
@@ -917,7 +917,7 @@ class _CustomDropDownChexkBoxState extends State<CustomDropDownChexkBox> {
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -933,65 +933,7 @@ class _CustomDropDownChexkBoxState extends State<CustomDropDownChexkBox> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// onDropTap.value = !onDropTap.value;
|
||||
// },
|
||||
// child: Container(
|
||||
// width: double.infinity,
|
||||
// // height: 50,
|
||||
// padding:
|
||||
// EdgeInsets.only(right: 22, left: 12, top: 14, bottom: 14),
|
||||
// decoration: BoxDecoration(
|
||||
// color: const Color(0xFFFFFFFF).withOpacity(0.10),
|
||||
// borderRadius: onDropTap.value
|
||||
// ? const BorderRadius.vertical(
|
||||
// top: Radius.circular(30),
|
||||
// )
|
||||
// : const BorderRadius.all(Radius.circular(30)),
|
||||
// gradient: LinearGradient(
|
||||
// begin: Alignment.topLeft,
|
||||
// end: Alignment.bottomRight,
|
||||
// colors: [
|
||||
// const Color(0xFFffffff).withOpacity(0.50),
|
||||
// const Color(0xFFFFFFFF).withOpacity(0.50),
|
||||
// ],
|
||||
// ),
|
||||
// border: Border.all(color: const Color(0xFF434A53)),
|
||||
// ),
|
||||
// child: Center(
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// children: [
|
||||
// // if (widget.leadingImage != null) widget.leadingImage!,
|
||||
// widget.leadingImage == null
|
||||
// ?
|
||||
// SizedBox()
|
||||
// :
|
||||
// widget.leadingImage!,
|
||||
// const SizedBox(width: 12),
|
||||
// Expanded(
|
||||
// child: Text(
|
||||
// selectedValues.isEmpty
|
||||
// ? widget.header
|
||||
// : selectedValues.join(', '),
|
||||
// style: TextStyle(
|
||||
// color: Colors.white,
|
||||
// fontSize: 16,
|
||||
// fontFamily: 'Helvetica',
|
||||
// fontWeight: FontWeight.w400),
|
||||
// ),
|
||||
// ),
|
||||
// const Spacer(),
|
||||
// onDropTap.value
|
||||
// ? Image.asset('assets/images/png/arrowup.png')
|
||||
// : Image.asset('assets/images/png/arrowdown.png'),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
onDropTap.value = !onDropTap.value;
|
||||
@@ -999,7 +941,7 @@ class _CustomDropDownChexkBoxState extends State<CustomDropDownChexkBox> {
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 50,
|
||||
padding: EdgeInsets.only(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 22,
|
||||
left: 12,
|
||||
),
|
||||
@@ -1026,7 +968,7 @@ class _CustomDropDownChexkBoxState extends State<CustomDropDownChexkBox> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
widget.leadingImage == null
|
||||
? SizedBox()
|
||||
? const SizedBox()
|
||||
: widget.leadingImage!,
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
@@ -1034,7 +976,7 @@ class _CustomDropDownChexkBoxState extends State<CustomDropDownChexkBox> {
|
||||
selectedValues.isEmpty
|
||||
? widget.header
|
||||
: selectedValues.join(', '),
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontFamily: 'Helvetica',
|
||||
|
||||
@@ -20,16 +20,7 @@ Future<void> main() async {
|
||||
|
||||
SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
]).then((value) =>
|
||||
// runApp(MyApp())
|
||||
runApp(const MyApp())
|
||||
|
||||
// StatsFl(
|
||||
// align: Alignment.center,
|
||||
// width: 200,
|
||||
// height: 100,
|
||||
// child: const MyApp())),
|
||||
);
|
||||
]).then((value) => runApp(const MyApp()));
|
||||
}
|
||||
|
||||
final streamController = StreamController.broadcast();
|
||||
@@ -42,34 +33,13 @@ class MyApp extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
||||
// var _connectionStatus = ConnectivityResult.values.toString();
|
||||
// final Connectivity _connectivity = Connectivity();
|
||||
// late StreamSubscription<ConnectivityResult> _connectivitySubscription;
|
||||
|
||||
List<ConnectivityResult> _connectionStatus = [ConnectivityResult.none];
|
||||
final Connectivity _connectivity = Connectivity();
|
||||
late StreamSubscription<List<ConnectivityResult>> _connectivitySubscription;
|
||||
|
||||
// Future<void> checkInternet() async {
|
||||
// final connectivityResult = await (Connectivity().checkConnectivity());
|
||||
|
||||
// if (connectivityResult == ConnectivityResult.wifi ||
|
||||
// connectivityResult == ConnectivityResult.mobile) {
|
||||
// setState(() {
|
||||
// _connectionStatus = connectivityResult.toString();
|
||||
// print("has internet");
|
||||
// });
|
||||
// } else {
|
||||
// setState(() {
|
||||
// _connectionStatus = connectivityResult.toString();
|
||||
// print("no internet");
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
Future<void> initConnectivity() async {
|
||||
late List<ConnectivityResult> result;
|
||||
// Platform messages may fail, so we use a try/catch PlatformException.
|
||||
|
||||
try {
|
||||
result = await _connectivity.checkConnectivity();
|
||||
print("initconnectivitity");
|
||||
@@ -85,20 +55,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
||||
return _updateConnectionStatus(result);
|
||||
}
|
||||
|
||||
// Future<void> _updateConnectionStatus(List<ConnectivityResult> result) async {
|
||||
// setState(() {
|
||||
// _connectionStatus = result.toString();
|
||||
// });
|
||||
|
||||
// // ignore: avoid_print
|
||||
// print('Connectivity changed: $_connectionStatus');
|
||||
// }
|
||||
|
||||
Future<void> _updateConnectionStatus(List<ConnectivityResult> result) async {
|
||||
// setState(() {
|
||||
// _connectionStatus = result;
|
||||
// });
|
||||
|
||||
if (result.contains(ConnectivityResult.wifi) ||
|
||||
result.contains(ConnectivityResult.mobile)) {
|
||||
setState(() {
|
||||
@@ -110,9 +67,8 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
||||
_connectionStatus = result;
|
||||
Get.toNamed(RouteName.nointernet);
|
||||
});
|
||||
// Get.toNamed(RouteName.nointernet);
|
||||
}
|
||||
// ignore: avoid_print
|
||||
|
||||
print('Connectivity changed: $_connectionStatus');
|
||||
}
|
||||
|
||||
@@ -121,33 +77,18 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
||||
AndroidDeviceInfo android = await plugin.androidInfo;
|
||||
if (android.version.sdkInt < 33) {
|
||||
if (await Permission.storage.request().isGranted) {
|
||||
// setState(() {
|
||||
// permissionGranted = true;
|
||||
// });
|
||||
} else if (await Permission.storage.request().isPermanentlyDenied) {
|
||||
await openAppSettings();
|
||||
await utils.showToast("Permission denied.");
|
||||
}
|
||||
// else if (await Permission.audio.request().isDenied) {
|
||||
// // setState(() {
|
||||
// // permissionGranted = false;
|
||||
// // });
|
||||
// }
|
||||
} else {
|
||||
if (await Permission.photos.request().isGranted) {
|
||||
// await utils.showToast("Permission granted.");
|
||||
// setState(() {
|
||||
// permissionGranted = true;
|
||||
// });
|
||||
} else if (await Permission.photos.request().isPermanentlyDenied) {
|
||||
await openAppSettings();
|
||||
await utils.showToast("Permission denied.");
|
||||
} else if (await Permission.photos.request().isDenied) {
|
||||
await openAppSettings();
|
||||
await utils.showToast("Permission denied.");
|
||||
// setState(() {
|
||||
// permissionGranted = false;
|
||||
// });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -159,7 +100,6 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
||||
_connectivitySubscription =
|
||||
_connectivity.onConnectivityChanged.listen(_updateConnectionStatus);
|
||||
|
||||
//do not remove this coomented code
|
||||
if (Platform.isAndroid) {
|
||||
_getStoragePermission();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
GetuserdetailsModel? getuserobj;
|
||||
|
||||
|
||||
class Getuserdetails {
|
||||
Getuserdetails();
|
||||
|
||||
@@ -27,21 +26,22 @@ class Getuserdetails {
|
||||
// Assuming response data is a map
|
||||
getuserobj = GetuserdetailsModel.fromJson(responseData);
|
||||
|
||||
await prefs.setString('fullname', getuserobj?.data?.userData?.fullName ?? "");
|
||||
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',
|
||||
await prefs.setString(
|
||||
'fullname', getuserobj?.data?.userData?.fullName ?? "");
|
||||
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');
|
||||
fullname = prefs.getString('fullname');
|
||||
phonenumber = prefs.getString('phone');
|
||||
|
||||
|
||||
emailid = prefs.getString('email');
|
||||
myusername = prefs.getString('username');
|
||||
fullname = prefs.getString('fullname');
|
||||
phonenumber = prefs.getString('phone');
|
||||
globalAccountType = prefs.getString('accountTypefromLogin');
|
||||
} else if (responseData is String) {
|
||||
// Parse the JSON string into a map
|
||||
Map<String, dynamic> jsonMap;
|
||||
try {
|
||||
jsonMap = json.decode(responseData);
|
||||
@@ -51,18 +51,19 @@ class Getuserdetails {
|
||||
ResponseStatus.FAILED);
|
||||
}
|
||||
|
||||
|
||||
await prefs.setString('fullname', getuserobj?.data?.userData?.fullName ?? "");
|
||||
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(
|
||||
'fullname', getuserobj?.data?.userData?.fullName ?? "");
|
||||
await prefs.setString(
|
||||
'username', getuserobj?.data?.userData?.userName ?? "");
|
||||
await prefs.setString(
|
||||
'email', getuserobj?.data?.userData?.emailAddress ?? "");
|
||||
await prefs.setString(
|
||||
'phone', getuserobj?.data?.userData?.phoneNumber ?? "");
|
||||
|
||||
emailid = prefs.getString('email');
|
||||
myusername = prefs.getString('username');
|
||||
fullname = prefs.getString('fullname');
|
||||
phonenumber = prefs.getString('phone');
|
||||
|
||||
|
||||
emailid = prefs.getString('email');
|
||||
myusername = prefs.getString('username');
|
||||
fullname = prefs.getString('fullname');
|
||||
phonenumber = prefs.getString('phone');
|
||||
} else {
|
||||
// Handle other types if necessary
|
||||
return ResponseData<dynamic>(
|
||||
@@ -71,4 +72,4 @@ class Getuserdetails {
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,38 +32,6 @@ class _SplashScreenState extends State<SplashScreen> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
// Future.delayed(const Duration(seconds: 2), () async {
|
||||
// SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
// token = prefs.getString('access-token');
|
||||
// emailid = prefs.getString('email');
|
||||
// myusername = prefs.getString('username');
|
||||
// fullname = prefs.getString('fullname');
|
||||
// phonenumber = prefs.getString('phone');
|
||||
|
||||
// if (token == null || token!.isEmpty) {
|
||||
// Get.toNamed(RouteName.onboarding1);
|
||||
// } else {
|
||||
// await Getuserdetails().Getuser().then((value) {
|
||||
// if (getuserobj?.data?.userData?.isProfileUpdated == 0) {
|
||||
// String? accountype =
|
||||
// getuserobj?.data?.userData?.principalTypeXid.toString();
|
||||
|
||||
// if (accountype == "1") {
|
||||
// Get.toNamed(RouteName.tellusindividualscreen,
|
||||
// arguments: {'pageroute': "mainscreen"});
|
||||
// } else if (accountype == "2") {
|
||||
// Get.toNamed(RouteName.tellusbusinessscreen,
|
||||
// arguments: {'pageroute': "mainscreen"});
|
||||
// }
|
||||
// } else {
|
||||
// Get.toNamed(RouteName.mainscreen);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
|
||||
InterestListApi().getinterestlistApi();
|
||||
|
||||
Future.delayed(const Duration(seconds: 2), () async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
token = prefs.getString('access-token');
|
||||
@@ -78,6 +46,7 @@ class _SplashScreenState extends State<SplashScreen> {
|
||||
if (token == null || token!.isEmpty) {
|
||||
Get.toNamed(RouteName.onboarding1);
|
||||
} else {
|
||||
await InterestListApi().getinterestlistApi();
|
||||
await Uploadata(deviceName);
|
||||
await Getuserdetails().Getuser().then((value) {
|
||||
if (getuserobj?.data?.userData?.isProfileUpdated == 0) {
|
||||
|
||||
Reference in New Issue
Block a user