Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show fullscreen image in flutter

Tags:

flutter

dart

Is there any way to show fullscreen image ?

    var imagejadwal = new Image.network(     "https://firebasestorage.googleapis.com/v0/b/c-smp-bruder.appspot.com/o/fotojadwal.jpg?alt=media&token=b35b74df-eb40-4978-8039-2f1ff2565a57",     fit: BoxFit.cover ); return new Scaffold(   appBar: new AppBar(     title: new Text(widget.title),   ),   body: new Center(       child: imagejadwal   ), ); 

in that code, there's space around the image :/

like image 978
Arvin Avatar asked Feb 10 '18 00:02

Arvin


Video Answer


1 Answers

Your problem is that Center will make the image to get it's preferred size instead of the full size. The correct approach would be instead to force the image to expand.

return new Scaffold(   body: new Image.network(     "https://cdn.pixabay.com/photo/2017/02/21/21/13/unicorn-2087450_1280.png",     fit: BoxFit.cover,     height: double.infinity,     width: double.infinity,     alignment: Alignment.center,   ), ); 

The alignment: Alignment.center is unnecessary. But since you used the Center widget, I tought it would be interesting to know how to customize it.

like image 166
Rémi Rousselet Avatar answered Sep 24 '22 02:09

Rémi Rousselet