我试图制作一个带有图片背景的页面,以下是我的代码:
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("loginBackground"),
),
)
),
然而,当我运行它时,它会打开一个新的编辑器,其中包含一些Flutter的代码,并且有一行被黄色高亮显示,我认为这意味着断点(如果我错了请纠正我)。文件名是'image_provider.dart',这是相关的代码(我已经指出了高亮显示的行):
@protected
Future<ui.Codec> _loadAsync(AssetBundleImageKey key, DecoderCallback decode) async {
ByteData? data;
// Hot reload/restart could change whether an asset bundle or key in a
// bundle are available, or if it is a network backed bundle.
try {
data = await key.bundle.load(key.name);
} on FlutterError {
PaintingBinding.instance!.imageCache!.evict(key);
rethrow; // THIS IS THE HIGHLIGHTED LINE
}
// `key.bundle.load` has a non-nullable return type, but might be null when
// running with weak checking, so we need to null check it anyway (and
// ignore the warning that the null-handling logic is dead code).
if (data == null) { // ignore: dead_code
PaintingBinding.instance!.imageCache!.evict(key);
throw StateError('Unable to read data');
}
return await decode(data.buffer.asUint8List());
}
}
我不知道这意味着什么,所以非常感谢任何帮助。
这是图片(滚动):
![](https://istack.dev59.com/PREZj.webp)
(很抱歉它太大了)如果您需要更多细节,请评论:)