使用flutter widget小部件ColorFiltered
ColorFiltered(
colorFilter:ColorFilter.mode(Colors.grey, BlendMode.color),
child: child,
);
将上面代码放到全局根widget下,即可设置全部页面颜色变灰
- 通过colorFilter可设置某种颜色过滤,比如变灰设置灰色即可,以及颜色混合模式
- ColorFiltered 小部件继承SingleChildRenderObjectWidget,因此会提供一个child子布局,这里可以放置想要过滤颜色的页面;
效果演示

GitHub项目地址:https://github.com/ChessLuo/flutter_study_app
支持我的话可以关注下我的公众号,一起学习Android、小程序、跨平台开发~
image
网友评论