DecorationImage不显示图像-颤振

时间:2019-04-09 07:50:08

标签: image dart flutter assets

我找不到与此相关的任何内容,所以我想我做错了什么。我正在尝试在If you don't want to create a Redis Cluster by configuring and executing individual instances manually as explained above, there is a much simpler system (but you'll not learn the same amount of operational details). Just check utils/create-cluster directory in the Redis distribution. There is a script called create-cluster inside (same name as the directory it is contained into), it's a simple bash script. In order to start a 6 nodes cluster with 3 masters and 3 slaves just type the following commands: create-cluster start create-cluster create Reply to yes in step 2 when the redis-cli utility wants you to accept the cluster layout. You can now interact with the cluster, the first node will start at port 30001 by default. When you are done, stop the cluster with: create-cluster stop. Please read the README inside this directory for more information on how to run the script. 内显示DecorationImage,但屏幕上什么都没有显示。

我尝试用BoxDecoration显示相关资产,并且可以正常工作。我试图将Image.asset('assets\\test.png');AssetImage之类的东西放到FileImage中,但似乎它们都不适合我。

我的代码基本上如下:

DecorationImage

我该怎么做才能显示 return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ new Container( decoration: new BoxDecoration( image: new DecorationImage( image: new AssetImage('assets\\test.png'), fit: BoxFit.cover, ), ), ), ], ), ) ); ?目前,我只看到一个空白屏幕。

2 个答案:

答案 0 :(得分:2)

您需要像这样将widthheight赋予您的Container

new Container(
  height: 100,
  width: 100,
  decoration: new BoxDecoration(
    image: new DecorationImage(
      image: new AssetImage('assets\\test.png'),
      fit: BoxFit.cover,
    ),
  ),
),

答案 1 :(得分:-1)

只是错误的方式.. 使用这个 => "/" 而不是这个 => "\"

image: DecorationImage( image: AssetImage("lib/assets/images/aksam_gece.png"), fit: BoxFit.fill, ),

还要检查 pubspec 路径