gpt4 book ai didi

flutter - 如何防止轻敲 InkWell 内部时对周围 InkWell 产生涟漪效应

转载 作者:行者123 更新时间:2023-12-02 12:13:12 25 4
gpt4 key购买 nike

假设我有这个小部件:

Card(
child: InkWell(
onTap: () {},
child: Padding(
padding: const EdgeInsets.all(28.0),
child: RaisedButton(
child: Text('Test'),
onPressed: () {},
),
),
),
),

我想仅在点击 RaishedButton 时禁用(防止显示)Card/InkWell 上的波纹效果,但要显示它当点击 Card 时(即在按钮之外)。有什么办法可以达到这样的效果吗?

我认为普遍的问题可以是:当点击内部的 InkWell 时,如何防止对周围的 InkWell 产生涟漪效应?如果你看一下源代码,那么你可以看到 RaishedButton MaterialInkWell 小部件会引起波纹。

Here is the full sample code .

enter image description here

最佳答案

如果您想要快速破解,请查看:

Container(
width: 180,
height: 120,
child: Stack(
children: <Widget>[
Card(
child: InkWell(
onTap: () {},
),
),
Center(
child: RaisedButton(
child: Text('Test'),
onPressed: () {},
),
)
],
),
)

enter image description here

关于flutter - 如何防止轻敲 InkWell 内部时对周围 InkWell 产生涟漪效应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58285012/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com