1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 12:59:21 +00:00

Improve post image loading size

This commit is contained in:
Pierre HUBERT 2019-05-20 09:13:12 +02:00
parent 0bf85b478a
commit 073ddd8386
2 changed files with 11 additions and 4 deletions

View File

@ -205,6 +205,7 @@ class _PostTileState extends State<PostTile> {
url: widget.post.fileURL, url: widget.post.fileURL,
allowFullScreen: true, allowFullScreen: true,
roundedEdges: false, roundedEdges: false,
loadingHeight: 150,
); );
} }

View File

@ -14,6 +14,7 @@ class NetworkImageWidget extends StatelessWidget {
final bool roundedEdges; final bool roundedEdges;
final double width; final double width;
final double height; final double height;
final double loadingHeight;
const NetworkImageWidget({ const NetworkImageWidget({
Key key, Key key,
@ -22,10 +23,15 @@ class NetworkImageWidget extends StatelessWidget {
this.width, this.width,
this.height, this.height,
this.roundedEdges = true, this.roundedEdges = true,
this.loadingHeight,
}) : assert(url != null), }) : assert(url != null),
assert(allowFullScreen != null), assert(allowFullScreen != null),
super(key: key); super(key: key);
double get _loadingHeight => loadingHeight != null ? loadingHeight : height;
double get _loadingWidth => width;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Material( return Material(
@ -41,16 +47,16 @@ class NetworkImageWidget extends StatelessWidget {
height: height, height: height,
fit: BoxFit.cover, fit: BoxFit.cover,
placeholder: (c, s) => Container( placeholder: (c, s) => Container(
width: width, width: _loadingWidth,
height: height, height: _loadingHeight,
color: Colors.lightBlueAccent, color: Colors.lightBlueAccent,
child: Center( child: Center(
child: CircularProgressIndicator(), child: CircularProgressIndicator(),
), ),
), ),
errorWidget: (c, s, o) => Container( errorWidget: (c, s, o) => Container(
width: width, width: _loadingWidth,
height: height, height: _loadingHeight,
color: Colors.red, color: Colors.red,
child: Center( child: Center(
child: Icon( child: Icon(