解决办法1:将Stack的overflow属性设置为Overflow.visible

Stack(
  overflow: Overflow.visible,
  children: [
    // ...
  ],
)

解决办法2:将MouseRegion的behavior属性设置为HitTestBehavior.translucent

Stack(
  clipBehavior: Clip.none,
  children: [
    MouseRegion(
      behavior: HitTestBehavior.translucent,
      child: // ...
    ),
    // ...
  ],
)

解决办法3:使用Positioned包裹MouseRegion,设置top、left、right、bottom属性为0

Stack(
  clipBehavior: Clip.none,
  children: [
    Positioned(
      top: 0,
      left: 0,
      right: 0,
      bottom: 0,
      child: MouseRegion(
        child: // ...
      ),
    ),
    // ...
  ],
)
Flutter使用Stack设置clipBehavior为Clipnone溢出之后MouseRegion不生效了我需要所有的解决办法请给出解决代码

原文地址: http://www.cveoy.top/t/topic/bfwf 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录