- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
还可以在 StackOverflow 上找到解决方案,但在我的情况下不起作用
'_positions.isNotEmpty': ScrollController not attached to any scroll views
PageView throws '_positions.isNotEmpty': ScrollController not attached to any scroll views
Widget _buildIntroSlider() {
return Container(
padding: EdgeInsets.symmetric(horizontal: 46.0),
child: Stack(
alignment: AlignmentDirectional.bottomCenter,
children: <Widget>[
PageView.builder(
scrollDirection: Axis.horizontal,
controller: _pageController,
onPageChanged: _onPageChanged,
itemCount: slideList.length,
itemBuilder: (ctx, i) =>
SlideItem(slide: slideList[i], bold: false),
),
],
),
);
}
最佳答案
每当您使用 PageController 时,您需要记住,如果您尝试访问 PageController 数据,例如呈现具有该特定 Controller 的 PageView 之前的当前索引,您将收到此错误。
您可以检查它是否是 aleady 构建的_pageController.hasClients
如果没有,则不能调用 Controller 的任何其他方法,否则会引发错误。
关于flutter - 如何解决失败的断言 : line 110 pos 12: '_positions.isNotEmpty' : ScrollController not attached to any scroll views,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60967898/
我正在监听 PageController 以获取位置,然后将其与 ListView 同步。当操作 PageView 时,同时操作 ListView。 示例:https://github.com/Ram
我有一个附加到 Listview 的 ScrollController,但是当我滚动时它会抛出异常: @override initState() { super.initState();
我正在 flutter 中使用 DraggableScrollableSheet,我想知道工作表是折叠还是展开。 DraggableScrollableSheet 的构建器提供了一个 scrollCo
它在列表中的最后一个元素之前停止。有没有办法直到最后一个元素的结束容器 controller ..animateTo( controller
我正在尝试使用自定义ScrollController初始化SingleChildScrollView以从某个位置开始。我以为我可以使用initialScrollOffset并在init方法中设置一个初
一旦获得有关最大滚动范围的信息,我就会尝试显示一个小部件。如果我将 ScrollController 的实例分配给可滚动小部件的 controller 属性,我就可以找到该数字。 我的问题是 Scro
我正在为 SingleChildScrollView 小部件使用 ScrollController,我想在其中检测滚动开始、结束/停止和仍在滚动的时间? 如何检测,我正在使用 Listene scro
我正在使用 CustomScrollView,并为它提供了一个 Controller 。ScrollController 有效,我什至给它添加了一个监听器并打印出 ScrollView 的位置。 Cu
我已将 ScrollController 附加到 [SliverAppBar, SliverList] 的 CustomScrollView 在默认情况下,我会使用 reverse:true 和 an
我有一个 NestedScrollView,其中包含一个 SliverAppBar 和一个 TabBarView,每个选项卡都包含一个无限加载列表。现在我只有一个 ScrollController 附
当呈现多个小部件实例并且调用 getValue 方法时,flutter 会抛出附加到多个 ScrollView 的错误 ScrollController。我假设这是因为它们都使用相同的 Control
我想为 CustomScrollView 制作某种自定义滚动进度指示器。 _scrollController = ScrollController()..addListener(_scroll); v
我有一个带有 child 的有状态小部件 final _scrollController = TrackingScrollController(); PageView( controller: _
我创建了一个聊天应用程序的设计,并尝试滚动到自动结束,我使用了这段代码 scrollController.animateTo( scrollController.position.
我可以将 ScrollController 添加到 ListView。我试图对 SliverList 做同样的事情,但我意识到没有参数来添加 Controller 。有没有其他方法可以实现这一目标?
我想使用 scrollController 在 listView 的底部显示索引,如下图所示: 在用户向下滚动或向上滚动后,左侧以红色突出显示的计数会根据用户的滚动方向增加/减少。 我要实现的是自动更
有两个选项可以检索 CustomScrollView 的滚动位置。 documentation声明如下: ScrollNotification and NotificationListener, wh
我的 Flutter 应用程序在离开具有 ScrollController 以控制 NestedScrollView 的页面时抛出异常(ScrollController 附加到多个 ScrollVie
我有一个 NestedScrollView,当我使用 SliverAppBar 时,它可以很好地自动隐藏 AppBar(我想要的一个功能)。我遇到问题的地方是我使用 ListView.Builder
我是 Flutter 的新手,刚刚学习了如何从 firestore 检索数据并做了一些 UI。现在我有两个问题; 1- 这是一个设置页面,其中有 CustomScrollView 包含用于 Contr
我是一名优秀的程序员,十分优秀!