【发布时间】:2019-05-27 03:01:15
【问题描述】:
我正在尝试将背景图片添加到我的 Flutter 应用程序中,并且我已经解决了关于 SO 的所有类似问题。应用程序 m 运行良好,但图像没有出现。
这是我的小部件代码:
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
actions: <Widget>[
new IconButton(icon: const Icon(Icons.list), onPressed: _loadWeb)
],
),
body: new Stack(
children: <Widget>[
Container(
child: new DecoratedBox(
decoration: new BoxDecoration(
image: new DecorationImage(
image: new AssetImage("images/logo.png"),
fit: BoxFit.fill,
),
),
),
),
Center(
child: _authList(),
)
],
),
floatingActionButton: FloatingActionButton(
onPressed: getFile,
tooltip: 'Select file',
child: Icon(Icons.sd_storage),
), // This trailing comma makes auto-formatting nicer for build methods.
));
}
应用程序运行良好,堆栈上的第二个小部件,即 listView 正常工作,但图像未显示。
有什么想法吗?
【问题讨论】: