Fill errorWidget field on every cached network image, cuz otherwise they would break the app

This commit is contained in:
krawieck 2020-09-13 16:05:17 +02:00
parent 4bec0c533a
commit 1e0fcf9c67
6 changed files with 25 additions and 5 deletions

View File

@ -265,6 +265,7 @@ class _CommunityOverview extends StatelessWidget {
),
),
),
errorWidget: (_, __, ___) => Icon(Icons.warning),
),
),
),
@ -277,7 +278,10 @@ class _CommunityOverview extends StatelessWidget {
if (community.banner != null)
FullscreenableImage(
url: community.banner,
child: CachedNetworkImage(imageUrl: community.banner),
child: CachedNetworkImage(
imageUrl: community.banner,
errorWidget: (_, __, ___) => Container(),
),
),
SafeArea(
child: Padding(

View File

@ -162,7 +162,10 @@ class InstancePage extends HookWidget {
if (site.site.banner != null)
FullscreenableImage(
url: site.site.banner,
child: CachedNetworkImage(imageUrl: site.site.banner),
child: CachedNetworkImage(
imageUrl: site.site.banner,
errorWidget: (_, __, ___) => Container(),
),
),
SafeArea(
child: Center(
@ -175,7 +178,10 @@ class InstancePage extends HookWidget {
child: CachedNetworkImage(
width: 100,
height: 100,
imageUrl: site.site.icon),
imageUrl: site.site.icon,
errorWidget: (_, __, ___) =>
Icon(Icons.warning),
),
),
),
Text(site.site.name,
@ -332,6 +338,8 @@ class _AboutTab extends HookWidget {
height: 50,
width: 50,
imageUrl: e.icon,
errorWidget: (_, __, ___) =>
SizedBox(width: 50, height: 50),
imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
@ -380,6 +388,8 @@ class _AboutTab extends HookWidget {
height: 50,
width: 50,
imageUrl: e.avatar,
errorWidget: (_, __, ___) =>
SizedBox(width: 50, height: 50),
imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration(
shape: BoxShape.circle,

View File

@ -48,6 +48,8 @@ class UsersListPage extends StatelessWidget {
height: 50,
width: 50,
imageUrl: users[i].avatar,
errorWidget: (_, __, ___) =>
SizedBox(height: 50, width: 50),
imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration(
shape: BoxShape.circle,

View File

@ -200,6 +200,7 @@ class Comment extends StatelessWidget {
),
),
),
errorWidget: (_, __, ___) => Container(),
),
),
),

View File

@ -374,6 +374,7 @@ class Post extends StatelessWidget {
url: post.url,
child: CachedNetworkImage(
imageUrl: post.url,
errorWidget: (_, __, ___) => Icon(Icons.warning),
progressIndicatorBuilder: (context, url, progress) =>
CircularProgressIndicator(value: progress.progress),
),

View File

@ -96,6 +96,7 @@ class UserProfile extends HookWidget {
if (userViewSnap.data?.banner != null)
CachedNetworkImage(
imageUrl: userViewSnap.data.banner,
errorWidget: (_, __, ___) => Container(),
)
else
Container(
@ -154,6 +155,7 @@ class UserProfile extends HookWidget {
borderRadius: BorderRadius.all(Radius.circular(12)),
child: CachedNetworkImage(
imageUrl: userViewSnap.data.avatar,
errorWidget: (_, __, ___) => Container(),
),
),
),