Skip to content

Commit

Permalink
Do not show warning sign when no image is given
Browse files Browse the repository at this point in the history
  • Loading branch information
adzialocha committed Jun 4, 2024
1 parent d0b9127 commit f5a744a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/app/lib/ui/widgets/image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ class MeliImage extends StatelessWidget {

const MeliImage({super.key, required this.image, this.externalError});

Widget _error(BuildContext context, String message) {
Widget _error(BuildContext context, String message, IconData icon) {
return Container(
color: MeliColors.peach,
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
const Icon(
Icons.warning_rounded,
Icon(
icon,
size: 40.0,
color: MeliColors.black,
),
Expand All @@ -32,11 +32,12 @@ class MeliImage extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (externalError != null) {
return _error(context, externalError!);
return _error(context, externalError!, Icons.warning_rounded);
}

if (image == null) {
return _error(context, AppLocalizations.of(context)!.imageMissingError);
return _error(context, AppLocalizations.of(context)!.imageMissingError,
Icons.image_not_supported);
}

return Image.network(
Expand Down Expand Up @@ -64,7 +65,8 @@ class MeliImage extends StatelessWidget {
);
},
errorBuilder: (context, error, stack) {
return _error(context, AppLocalizations.of(context)!.imageLoadingError);
return _error(context, AppLocalizations.of(context)!.imageLoadingError,
Icons.warning_rounded);
},
);
}
Expand Down

0 comments on commit f5a744a

Please sign in to comment.