简体   繁体   English

如何在 flutter 的页面浏览小部件中同时滚动两种方式?

[英]How to scroll both ways simultaneously in pageview widget in flutter?

I am using PageView for my application.我正在为我的应用程序使用PageView PageView has a property of scrollDirection which sets the scroll either horizontal or vertical . PageView有一个scrollDirection属性,它将滚动设置为horizontalvertical code example:代码示例:

 Widget build(BuildContext context) {
    return PageView.builder(
        scrollDirection: Axis.horizontal,
        itemBuilder: (context, position) {
          return Container(
            color: Colors.black,
            child: Stack(
              children: <Widget>[AppVideoPlayer(), onScreenControls()],
            ),
          );
        },
        itemCount: 20);
  }

Is there a way where PageView can be set to scroll both ways (horizontal and vertical) at the same time.有没有一种方法可以将 PageView 设置为同时滚动两种方式(水平和垂直)。 If not, then is there any way in which this can be achieved?如果没有,那么有什么方法可以实现吗?

  Widget build(BuildContext context) {
    return PageView.builder(
        scrollDirection: Axis.vertical,
        itemBuilder: (context, position) {
          return PageView.builder(
        scrollDirection: Axis.horizontal,
        itemBuilder: (context, position) {
          return Container(
            color: Colors.black,
            child: Stack(
              children: <Widget>[AppVideoPlayer(), onScreenControls()],
            ),
          );
        },
        itemCount: 20);
        },
        itemCount: 20);
  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM