您的位置:首页 > 移动开发

Flutter 实现整个App变为灰色的方法示例

2020-04-05 12:07 1481 查看

在Flutter中实现整个App变为灰色是非常简单的,只需要在最外层的控件上包裹ColorFiltered,用法如下:

@override
Widget build(BuildContext context) {
return ColorFiltered(
colorFilter: ColorFilter.mode(Colors.grey, BlendMode.color),
child: Scaffold(
appBar: _appBar,
body: IndexedStack(
index: _currIndex,
children: <Widget>[HomeItemPage(), WidgetPage(), MyPage()],
),
backgroundColor: Theme.of(context).backgroundColor,
bottomNavigationBar: _buildBottomNavigationBar(context),
));
}

前后效果对比如下:

 

 

到此这篇关于Flutter 实现整个App变为灰色的方法示例的文章就介绍到这了,更多相关Flutter App变为灰色内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

您可能感兴趣的文章:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Flutter App 灰色