【问题标题】:Flutter not scrolling back颤振不回滚
【发布时间】:2021-02-17 09:54:44
【问题描述】:

代码

 Widget getMainListViewUI() {
    return FutureBuilder<bool>(
      future: getData(),
      builder: (BuildContext context, AsyncSnapshot<bool> snapshot) {
        if (!snapshot.hasData) {
          return SizedBox();
        } else {
          return ListView.builder(
            controller: scrollController,
            padding: EdgeInsets.only(
              top: AppBar().preferredSize.height +
                  MediaQuery.of(context).padding.top +
                  24,
              bottom: 62 + MediaQuery.of(context).padding.bottom,
            ),
            itemCount: data.length,
            scrollDirection: Axis.vertical,
            itemBuilder: (BuildContext context, int index) {
              widget.animationController.forward();
              return AnimatedBuilder(
                animation: widget.animationController,
                builder: (BuildContext context, Widget child) {
                  return TutorialsListWidget(
                      animation: Tween<double>(begin: 0.0, end: 1.0).animate(CurvedAnimation(
                              parent: widget.animationController,
                              curve: Interval((1 / data.length) * index, 1.0,
                                  curve: Curves.fastOutSlowIn))),
                      animationController: widget.animationController,
                      Count: data.length,
                      Heading: data[index]['Heading'],
                      Index: index);
                },
              );
            },
          );
        }
      },
    );
  }

这是我的 Listview 代码,它在向下滚动时运行良好。我可以流畅地滚动到屏幕底部,这对我没有任何问题,但是如果我尝试向后滚动(向上滚动),它会在不滚动的情况下强制转到顶部。

示例: 向下滚动:1-2-3-4-5-6-7-8-9-10 向上滚动:10-9-2-1

它强行进入列表视图的顶部。我在这里遗漏了什么吗?

【问题讨论】:

    标签: android ios flutter listview dart


    【解决方案1】:

    有时调试构建速度很慢。 尝试发布版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-08-11
      • 2021-06-18
      • 2021-12-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多