首页 文章

使用带装饰的容器时长按InkResponse不起作用

提问于
浏览
0

使用带装饰的容器时长按InkResponse不起作用

https://github.com/flutter/flutter/issues/13421

return new Container(
      color: Colors.white,
      padding: new EdgeInsets.all(16.0),
      child: new Column(

要么

return new Container(
      decoration: new BoxDecoration(
        color: Colors.white,
      ),
      padding: new EdgeInsets.all(16.0),
      child: new Column(

(两者都相同)

如果我评论颜色,一切都恢复正常 .

image 属性也是如此 .

But notborder 属性 .

我在 Container 上放置 GestureDetector 以查看是否检测到手势,检测没有问题,只是 long press 动画无法正常工作 .

我也可以使用GestureDetector确认这个 without ,我可以在做 long presstap 时从模拟器中听到 Tapping Sound .

Temporary Workaround 是用 Scaffold

return new Scaffold(
      backgroundColor: Colors.white,
      body: new Container(
        padding: new EdgeInsets.all(16.0),
        child: new Column(

1 回答

  • 4

    这就是文档所说的:

    InkResponse窗口小部件必须具有“材质”窗口小部件作为祖先 . “材质”小组件是实际绘制墨水反应的位置 . 这与材料设计前提相匹配,其中材料实际上是通过散布墨水对触摸作出反应 .

    所以我在Container中添加了一个Material ancestor .

    new Material(
          color: Colors.white,
          child: new Container(
            padding: new EdgeInsets.all(16.0),
            child: new Column(
    

相关问题