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) if (community.banner != null)
FullscreenableImage( FullscreenableImage(
url: community.banner, url: community.banner,
child: CachedNetworkImage(imageUrl: community.banner), child: CachedNetworkImage(
imageUrl: community.banner,
errorWidget: (_, __, ___) => Container(),
),
), ),
SafeArea( SafeArea(
child: Padding( child: Padding(

View File

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

View File

@ -48,6 +48,8 @@ class UsersListPage extends StatelessWidget {
height: 50, height: 50,
width: 50, width: 50,
imageUrl: users[i].avatar, imageUrl: users[i].avatar,
errorWidget: (_, __, ___) =>
SizedBox(height: 50, width: 50),
imageBuilder: (context, imageProvider) => Container( imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, 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, url: post.url,
child: CachedNetworkImage( child: CachedNetworkImage(
imageUrl: post.url, imageUrl: post.url,
errorWidget: (_, __, ___) => Icon(Icons.warning),
progressIndicatorBuilder: (context, url, progress) => progressIndicatorBuilder: (context, url, progress) =>
CircularProgressIndicator(value: progress.progress), CircularProgressIndicator(value: progress.progress),
), ),

View File

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