gpt4 book ai didi

linux - Flutter Linux 和 MacOS & Web : The provided ScrollController is currently attached to more than one ScrollPosition

转载 作者:行者123 更新时间:2023-12-05 08:24:54 26 4
gpt4 key购买 nike

我使用的是 Flutter Linux:

我有一些基本的 child 需要滚动一点,所以我需要一个 ListView 来启用滚动并得到这个异常一个像这样的简单代码:

ListView(
children: [
Text(
'data',
style: TextStyle(fontSize: 215),
),
Text(
'data',
style: TextStyle(fontSize: 215),
),
Text(
'data',
style: TextStyle(fontSize: 215),
),
],
)

在通知 AnimationController 的状态监听器时抛出了以下断言:提供的 ScrollController 当前附加到多个 ScrollPosition。

最佳答案

解决方案很简单,只需像这样将 Controller 添加到 ListView 中:

ListView(
controller: ScrollController(),
children: [
Text(
'data',
style: TextStyle(fontSize: 215),
),
Text(
'data',
style: TextStyle(fontSize: 215),
),
Text(
'data',
style: TextStyle(fontSize: 215),
),
],
)

来源:

https://github.com/flutter/flutter/issues/85456

关于linux - Flutter Linux 和 MacOS & Web : The provided ScrollController is currently attached to more than one ScrollPosition,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69883594/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com