From 073ddd8386c1896f96ca1481ab321797652a7780 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 20 May 2019 09:13:12 +0200 Subject: [PATCH] Improve post image loading size --- lib/ui/tiles/post_tile.dart | 1 + lib/ui/widgets/network_image_widget.dart | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/ui/tiles/post_tile.dart b/lib/ui/tiles/post_tile.dart index dee42fd..ed07df0 100644 --- a/lib/ui/tiles/post_tile.dart +++ b/lib/ui/tiles/post_tile.dart @@ -205,6 +205,7 @@ class _PostTileState extends State { url: widget.post.fileURL, allowFullScreen: true, roundedEdges: false, + loadingHeight: 150, ); } diff --git a/lib/ui/widgets/network_image_widget.dart b/lib/ui/widgets/network_image_widget.dart index d8278a0..2141c1e 100644 --- a/lib/ui/widgets/network_image_widget.dart +++ b/lib/ui/widgets/network_image_widget.dart @@ -14,6 +14,7 @@ class NetworkImageWidget extends StatelessWidget { final bool roundedEdges; final double width; final double height; + final double loadingHeight; const NetworkImageWidget({ Key key, @@ -22,10 +23,15 @@ class NetworkImageWidget extends StatelessWidget { this.width, this.height, this.roundedEdges = true, + this.loadingHeight, }) : assert(url != null), assert(allowFullScreen != null), super(key: key); + double get _loadingHeight => loadingHeight != null ? loadingHeight : height; + + double get _loadingWidth => width; + @override Widget build(BuildContext context) { return Material( @@ -41,16 +47,16 @@ class NetworkImageWidget extends StatelessWidget { height: height, fit: BoxFit.cover, placeholder: (c, s) => Container( - width: width, - height: height, + width: _loadingWidth, + height: _loadingHeight, color: Colors.lightBlueAccent, child: Center( child: CircularProgressIndicator(), ), ), errorWidget: (c, s, o) => Container( - width: width, - height: height, + width: _loadingWidth, + height: _loadingHeight, color: Colors.red, child: Center( child: Icon(