pro pic fix 5
This commit is contained in:
@@ -16,6 +16,20 @@ class BusinessArguments {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class HomeArguments {
|
||||||
|
final AppUser signedInUser;
|
||||||
|
final BusinessUser? businessUser;
|
||||||
|
final Business? business;
|
||||||
|
final String profilePicUrl;
|
||||||
|
|
||||||
|
HomeArguments(
|
||||||
|
this.signedInUser,
|
||||||
|
this.businessUser,
|
||||||
|
this.business,
|
||||||
|
this.profilePicUrl,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
class AppProfileUpdateArguments {
|
class AppProfileUpdateArguments {
|
||||||
final AppUser signedInUser;
|
final AppUser signedInUser;
|
||||||
final ImageProvider<Object>? propicFile;
|
final ImageProvider<Object>? propicFile;
|
||||||
|
|||||||
@@ -23,15 +23,16 @@ class Home extends StatefulWidget {
|
|||||||
class _HomeState extends State<Home> {
|
class _HomeState extends State<Home> {
|
||||||
String useremail = "";
|
String useremail = "";
|
||||||
final baseAPI = AppEnviroment.baseApiUrl;
|
final baseAPI = AppEnviroment.baseApiUrl;
|
||||||
late Future<BusinessArguments> profile;
|
late Future<HomeArguments> profile;
|
||||||
|
|
||||||
String proPicUrl = "empty";
|
String proPicUrl = "empty";
|
||||||
ImageProvider<Object>? propicFile;
|
ImageProvider<Object>? propicFile;
|
||||||
|
|
||||||
Future<BusinessArguments> getProfile() async {
|
Future<HomeArguments> getProfile() async {
|
||||||
AppUser userData;
|
AppUser userData;
|
||||||
Business? busData;
|
Business? busData;
|
||||||
BusinessUser? bUserData;
|
BusinessUser? bUserData;
|
||||||
|
String userPic;
|
||||||
|
|
||||||
// Get Userdata
|
// Get Userdata
|
||||||
var uid = await SuperTokens.getUserId();
|
var uid = await SuperTokens.getUserId();
|
||||||
@@ -72,15 +73,10 @@ class _HomeState extends State<Home> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//get profile picture
|
//get profile picture
|
||||||
if (proPicUrl != "empty") {
|
if (userData.pro_pic_path == "") {
|
||||||
} else if (userData.pro_pic_path == "") {
|
userPic = "";
|
||||||
setState(() {
|
|
||||||
proPicUrl = "";
|
|
||||||
});
|
|
||||||
} else if (AppEnviroment.getEnv() == "Dev") {
|
} else if (AppEnviroment.getEnv() == "Dev") {
|
||||||
setState(() {
|
userPic = "${AppEnviroment.baseFileUrl}/mih/${userData.pro_pic_path}";
|
||||||
proPicUrl = "${AppEnviroment.baseFileUrl}/mih/${userData.pro_pic_path}";
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
var url =
|
var url =
|
||||||
"${AppEnviroment.baseApiUrl}/minio/pull/file/${userData.pro_pic_path}/prod";
|
"${AppEnviroment.baseApiUrl}/minio/pull/file/${userData.pro_pic_path}/prod";
|
||||||
@@ -89,16 +85,15 @@ class _HomeState extends State<Home> {
|
|||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
String body = response.body;
|
String body = response.body;
|
||||||
var decodedData = jsonDecode(body);
|
var decodedData = jsonDecode(body);
|
||||||
setState(() {
|
|
||||||
proPicUrl = decodedData['minioURL'];
|
userPic = decodedData['minioURL'];
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
throw Exception(
|
throw Exception(
|
||||||
"Error: GetUserData status code ${response.statusCode}");
|
"Error: GetUserData status code ${response.statusCode}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return BusinessArguments(userData, bUserData, busData);
|
return HomeArguments(userData, bUserData, busData, userPic);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<AppUser> getUserDetails() async {
|
Future<AppUser> getUserDetails() async {
|
||||||
@@ -194,7 +189,7 @@ class _HomeState extends State<Home> {
|
|||||||
signedInUser: snapshot.requireData.signedInUser,
|
signedInUser: snapshot.requireData.signedInUser,
|
||||||
businessUser: snapshot.data!.businessUser,
|
businessUser: snapshot.data!.businessUser,
|
||||||
business: snapshot.data!.business,
|
business: snapshot.data!.business,
|
||||||
propicFile: propicFile,
|
propicFile: NetworkImage(snapshot.data!.profilePicUrl),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Center(
|
return Center(
|
||||||
|
|||||||
Reference in New Issue
Block a user