当前位置 : 主页 > 手机开发 > android >

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

来源:互联网 收集:自由互联 发布时间:2021-05-12
在Flutter中实现整个App变为灰色是非常简单的,只需要在最外层的控件上包裹ColorFiltered,用法如下: @overrideWidget build(BuildContext context) { return ColorFiltered( colorFilter: ColorFilter.mode(Colors.gre

在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变为灰色内容请搜索自由互联以前的文章或继续浏览下面的相关文章希望大家以后多多支持自由互联!

网友评论