图片变为灰色
图片组件
设置image里的color和colorBlendMode属性:
Image.asset(
'assets/images/index001.png',
fit: BoxFit.cover,
color: Colors.grey,
colorBlendMode: BlendMode.color,
)
背景图片
Container(
width: 200,
height: 200,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/index001.png'),
fit: BoxFit.cover,
colorFilter: const ColorFilter.mode(
Colors.grey,
BlendMode.color
),
),
),
),
页面变为灰色:ColorFiltered(颜色过滤器)
看名字就知道是增加颜色滤镜效果的
ColorFiltered(
colorFilter:ColorFilter.mode(Colors.grey, BlendMode.color),
child: child,
);