Android 添加一个';过滤器';在按下后重新显示图像

Android 添加一个';过滤器';在按下后重新显示图像,android,flutter,widget,Android,Flutter,Widget,我正试图让一个带有图像的手势检测器作为功能的触发器。当图像被选中,我想它稍微变暗,以显示其中一个已被选中 我目前的解决办法是: return GestureDetector( onTap: onPress, child: Stack( alignment: Alignment.bottomLeft, children: [ Container( height: 105.0, width: 105.0, margi

我正试图让一个带有图像的手势检测器作为功能的触发器。当图像被选中,我想它稍微变暗,以显示其中一个已被选中

我目前的解决办法是:

return GestureDetector(
  onTap: onPress,
  child: Stack(
    alignment: Alignment.bottomLeft,
    children: [
      Container(
        height: 105.0,
        width: 105.0,
        margin: EdgeInsets.only(top: 20.0),
        decoration: BoxDecoration(
          image: DecorationImage(
            colorFilter: ColorFilter.mode(colour, BlendMode.dstATop),
            image: AssetImage('images/$imagename.jpg'),
            fit: BoxFit.fill,
          ),
          borderRadius: BorderRadius.circular(10.0),
        ),
      ),
      Container(
        child: Text(
          '$cardText',
          style: TextStyle(
            color: textColour,
            fontWeight: FontWeight.bold,
          ),
        ),
        margin: EdgeInsets.only(left: 5.0, bottom: 2.5),
      ),
    ],
  ),
);
这样做的问题是,当按下图像时,它会在使用过滤器重新绘制之前短暂消失,虽然效果很好,但并不理想。我知道,对于图像小部件,这可以通过使用
gaplessPlayback=true
来实现,但我不能将其用于装饰图像

我曾尝试在堆栈中添加第三个容器小部件,以避免图像消失,但过滤器没有正确覆盖图像,我丢失了图像容器的圆角

还有别的办法吗