我的错误是RenderViewport预期为RenderSliver类型的子级,但接收到了RenderStack类型的子级。
Scaffold(
body: CustomScrollView(
slivers: [
appbar(context),
Stack(
children: [
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(
'https://idsb.tmgrup.com.tr/ly/uploads/images/2020/05/13/35552.jpeg'))),
height: createSize(347, context),
width: createSize(375, context),
)
],
)
],
));发布于 2021-05-26 11:24:34
您必须使用SliverToBoxAdapter小部件在自定义滚动视图中呈现任何非sliver小部件,如下所示:
SliverToBoxAdapter(
child: Stack(
children: [
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(
'https://idsb.tmgrup.com.tr/ly/uploads/images/2020/05/13/35552.jpeg'))),
height: createSize(347, context),
width: createSize(375, context),
)
],
),
),https://stackoverflow.com/questions/67703820
复制相似问题