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