Flutter 實現整個App變為灰色的方法示例
阿新 • • 發佈:2020-04-07
在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變為灰色內容請搜尋我們以前的文章或繼續瀏覽下面的相關文章希望大家以後多多支援我們!