Flutter:是否可以点击PageView? [英] Flutter: Is it possible to click through a PageView?

查看:286
本文介绍了Flutter:是否可以点击PageView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过将其封装在GestureDetector上,试图使PageView后面的窗口小部件可点击,但它不起作用。还有其他方法吗?

Trying to make widgets behind a PageView clickable by wrapping it around a GestureDetector but it doesn't work. Is there another way I can do this?

new GestureDetector(
  behavior: HitTestBehavior.translucent,
  child: new PageView(
    controller: _pageController,
    children: _buildForegroundPages(),
  ),
),


推荐答案

尝试使用 IgnorePointer 类:
https://docs.flutter.io/flutter/widgets/IgnorePointer-class.html


在命中测试期间不可见的小部件。

A widget that is invisible during hit testing.

这篇关于Flutter:是否可以点击PageView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆