From 66b4d19004d67fde92f02e416e71dd4b9e4b43f1 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 24 Jun 2019 20:27:20 +0200 Subject: [PATCH] Fix an issue with web links --- lib/models/post.dart | 2 ++ lib/ui/tiles/post_tile.dart | 15 ++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/models/post.dart b/lib/models/post.dart index 9f23ca8..2223785 100644 --- a/lib/models/post.dart +++ b/lib/models/post.dart @@ -74,6 +74,8 @@ class Post implements LikeElement { bool get canUpdate => access == UserAccessLevels.FULL; + bool get hasLinkImage => linkImage != null; + bool get canDelete => access == UserAccessLevels.FULL || access == UserAccessLevels.INTERMEDIATE; diff --git a/lib/ui/tiles/post_tile.dart b/lib/ui/tiles/post_tile.dart index 338101b..18b85a9 100644 --- a/lib/ui/tiles/post_tile.dart +++ b/lib/ui/tiles/post_tile.dart @@ -263,11 +263,16 @@ class _PostTileState extends State { children: [ Padding( padding: const EdgeInsets.only(right: 8.0), - child: NetworkImageWidget( - url: widget.post.linkImage, - width: 70, - roundedEdges: false, - ), + child: widget.post.hasLinkImage + ? NetworkImageWidget( + url: widget.post.linkImage, + width: 70, + roundedEdges: false, + ) + : Icon( + Icons.link, + size: 70, + ), ), Flexible( child: Column(