软件编程
位置:首页>> 软件编程>> Android编程>> Flutter 实现整个App变为灰色的方法示例

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

作者:老孟程序员  发布时间:2023-02-21 13:20:39 

标签:Flutter,App,灰色

在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变为灰色的方法示例 

来源:https://www.cnblogs.com/mengqd/p/12630396.html

0
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com