Flutter 实现整个App变为灰色的方法示例
时间:2021-02-09 14:34:22|栏目:Android代码|点击: 次
在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),
));
}
前后效果对比如下:
上一篇:Android 中利用 ksoap2 调用 WebService的示例代码
栏 目:Android代码
下一篇:Android仿Flipboard动画效果的实现代码
本文地址:http://www.codeinn.net/misctech/59922.html






