fix error when profile picture is not given

This commit is contained in:
2024-09-05 10:33:37 +02:00
parent 44332286eb
commit fd46cd9cb6
4 changed files with 13 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -98,6 +98,17 @@ class _HomeState extends State<Home> {
return HomeArguments(userData, bUserData, busData, userPic); return HomeArguments(userData, bUserData, busData, userPic);
} }
ImageProvider<Object>? isPictureAvailable(String url) {
if (url == "") {
return const AssetImage('images/i-dont-know-2.png');
} else if (url != "") {
return NetworkImage(url);
} else {
return null;
}
}
// <a href="https://www.flaticon.com/free-icons/dont-know" title="dont know icons">Dont know icons created by Freepik - Flaticon</a>
@override @override
void dispose() { void dispose() {
// TODO: implement dispose // TODO: implement dispose
@@ -121,7 +132,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: NetworkImage(snapshot.data!.profilePicUrl), propicFile: isPictureAvailable(snapshot.data!.profilePicUrl),
); );
} else { } else {
return Center( return Center(

View File

@@ -244,7 +244,7 @@ class _ProfileUserUpdateState extends State<ProfileUserUpdate> {
radius: 50, radius: 50,
), ),
SizedBox( SizedBox(
width: 110, width: 120,
child: Image(image: logoFrame), child: Image(image: logoFrame),
) )
], ],