有没有办法显示全屏图像?
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 ),);
在该代码中,图像周围有空间:/
解决方法
您的问题是,中心会使图像达到首选尺寸而不是全尺寸.
相反,正确的方法是强制图像消耗.
相反,正确的方法是强制图像消耗.
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,);
对齐:Alignment.center是不必要的.但是既然你使用了Center小部件,那么我知道如何定制它会很有趣.