From d166d2113c26a39e5685d24d62a3312ae9566f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A9=E5=8D=97?= Date: Fri, 11 Jan 2019 12:27:18 +0800 Subject: [PATCH] SafeArea for iPhoneX and above models --- lib/main.dart | 80 ++++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 39 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 7ec4dc7b..21ec6cb9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -14,8 +14,6 @@ import 'model/widget.dart'; import './widgets/index.dart'; import 'package:flutter_rookie_book/components/SearchInput.dart'; - - const int ThemeColor = 0xFFC91B3A; class MyApp extends StatelessWidget { @@ -133,49 +131,53 @@ class _MyHomePageState extends State } else { return null; } - }, (value) { - }, () {}); + }, (value) {}, () {}); } @override Widget build(BuildContext context) { return new Scaffold( - appBar: new AppBar(title: buildSearchInput(context)), - body: new TabBarView(controller: controller, children: [ - new FirstPage(), - new WidgetPage(db), - new CollectionPage(), - new FourthPage() - ]), - bottomNavigationBar: new Material( - color: const Color(0xFFF0EEEF), //底部导航栏主题颜色 - child: new Container( - height: 65.0, - decoration: BoxDecoration( - color: const Color(0xFFF0F0F0), - boxShadow: [ - new BoxShadow( - color: const Color(0xFFd0d0d0), - blurRadius: 3.0, - spreadRadius: 2.0, - offset: Offset(-1.0, -1.0), - ), - ], + appBar: new AppBar(title: buildSearchInput(context)), + body: new TabBarView(controller: controller, children: [ + new FirstPage(), + new WidgetPage(db), + new CollectionPage(), + new FourthPage() + ]), + bottomNavigationBar: Material( + color: const Color(0xFFF0EEEF), //底部导航栏主题颜色 + child: SafeArea( + child: Container( + height: 65.0, + decoration: BoxDecoration( + color: const Color(0xFFF0F0F0), + boxShadow: [ + BoxShadow( + color: const Color(0xFFd0d0d0), + blurRadius: 3.0, + spreadRadius: 2.0, + offset: Offset(-1.0, -1.0), ), - child: new TabBar( - controller: controller, - indicatorColor: - Theme.of(context).primaryColor, //tab标签的下划线颜色 - // labelColor: const Color(0xFF000000), - indicatorWeight: 3.0, - labelColor: Theme.of(context).primaryColor, - unselectedLabelColor: const Color(0xFF8E8E8E), - tabs: [ - new Tab(text: '业界动态', icon: new Icon(Icons.language)), - new Tab(text: '组件', icon: new Icon(Icons.extension)), - new Tab(text: '组件收藏', icon: new Icon(Icons.star)), - new Tab(text: '关于手册', icon: new Icon(Icons.favorite)), - ])))); + ], + ), + child: TabBar( + controller: controller, + indicatorColor: Theme.of(context).primaryColor, //tab标签的下划线颜色 + // labelColor: const Color(0xFF000000), + indicatorWeight: 3.0, + labelColor: Theme.of(context).primaryColor, + unselectedLabelColor: const Color(0xFF8E8E8E), + tabs: [ + Tab(text: '业界动态', icon: Icon(Icons.language)), + Tab(text: '组件', icon: Icon(Icons.extension)), + Tab(text: '组件收藏', icon: Icon(Icons.star)), + Tab(text: '关于手册', icon: Icon(Icons.favorite)), + ], + ), + ), + ), + ), + ); } void _onTabChange() {