Flutter 将图片变为黑白模式

Flutter Jun 30, 2020

方法一

Container(
  foregroundDecoration: BoxDecoration(
    color: Colors.grey,
    backgroundBlendMode: BlendMode.saturation,
  ),
  child: child, //图片widget
)

方法二

ColorFiltered(
  colorFilter: ColorFilter.mode(
    Colors.grey,
    BlendMode.saturation,
  ),
  child: child, //图片widget
)