Skip to content

Commit

Permalink
Merge pull request #229 from les-crepes/fix-default-avatar
Browse files Browse the repository at this point in the history
fix avatar
  • Loading branch information
LucaCoduriV authored Sep 8, 2022
2 parents afc9ae9 + fea9943 commit 2f802ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/screens/add_meal.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:auto_route/auto_route.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:cross_file_image/cross_file_image.dart';
import 'package:day_night_time_picker/day_night_time_picker.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -89,7 +90,7 @@ class _AddMealScreenState extends State<AddMealScreen> {
if (_image != null) {
image = XFileImage(_image!);
} else {
image = NetworkImage(widget._meal!.photo!);
image = CachedNetworkImageProvider(widget._meal!.photo!);
}
} else if (_image != null) {
image = XFileImage(_image!);
Expand Down
3 changes: 2 additions & 1 deletion lib/widgets/custom_cached_network_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class CustomCachedNetworkImage extends StatelessWidget {
imageUrl: imageUrl,
progressIndicatorBuilder: (context, url, downloadProgress) =>
CircularProgressIndicator(value: downloadProgress.progress),
errorWidget: (context, url, error) => const Icon(Icons.error),
errorWidget: (context, url, error) =>
Image.asset('assets/images/default_user_pic.png'),
imageBuilder: ((context, imageProvider) => Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
Expand Down

0 comments on commit 2f802ef

Please sign in to comment.