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

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

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

老孟程序员   2021-04-21 我要评论

在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),
  ));
}

前后效果对比如下:

 

 

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们