我想使用FadeInImage
图标作为占位符.
FadeInImage
几乎没有建设者.
在默认构造函数中,它ImageProvider
作为占位符,并在FadeInImage.MemoryNetwork(
其中Uint8List
作为内存占位符.
第三个构造函数创建AssetImage,但我怀疑这在这里是否有用.
有没有办法将Icon转换为其中一种数据类型?
签名示例:
FadeInImage(placeholder: iconPlaceholder, image: NetworkImage("url"))
图标实际上只是字体中的文本,因此很难将其转换为图像。食谱中的技巧应该起作用。使用带有图标和透明占位符的堆栈。
body: new Stack(
children: <Widget>[
new Center(child: new Icon(Icons.something)),
new Center(
child: new FadeInImage.memoryNetwork(
placeholder: kTransparentImage,
image:
'https://github.com/flutter/website/blob/master/_includes/code/layout/lakes/images/lake.jpg?raw=true',
),
),
],
),
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
9197 次 |
最近记录: |