PageView内的ListView-限制水平滚动区域

时间:2020-02-06 02:04:49

标签: flutter scroll flutter-listview flutter-pageview

我在PageView中有一个ListView,所以我有一个垂直滚动(ListView)和一个水平滚动(PageView)。我的问题是水平滚动比垂直滚动更敏感,执行垂直滚动变得很困难,因为它几乎总是被当作横向滚动。

我的想法是限制水平滚动区域,以使垂直滚动在屏幕的最大区域占主导:

areas where I want to limit the scroll

这可能吗?我该怎么办?

PageController  pageController = new PageController();

return Scaffold
(
    body: Stack
    (
      children: <Widget>
      [
        widfondo(), 
        Column
        (
          children: <Widget>
          [
            widAppBar(context, cuento),
            Expanded
            (
              child: PageView.builder
              (
                itemCount: cantidadDePaginas,
                dragStartBehavior: DragStartBehavior.down,
                //physics: BouncingScrollPhysics(),
                onPageChanged: (index)
                {
                  setState(() 
                  {
                    numeroPagina = ++index;
                  });
                },
                controller: pageController,
                itemBuilder: (BuildContext context, int index)
                {
                  return widCuerpo(context, cuento, index);
                },
              ),
            )
          ],
        )
      ],
    ),
);

  Widget widCuerpo(BuildContext context, Cuento cuento, int numPagina)
  {
    return  ListView
    (
      scrollDirection: Axis.vertical,
      children: <Widget>
      [
        widTituloCuerpo(context, cuento),
        widTextoCuerpo(context, cuento),
      ], 
    );
  }

我看到了其他类似的问题,并且看到它们使用了PageController,但是我不确定是否可以这样做。

谢谢。

0 个答案:

没有答案