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 1/2] 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() { From 2464c39a7a24990fd8321c1b4d8d65106e51b83a Mon Sep 17 00:00:00 2001 From: "sanfan.hx" Date: Mon, 14 Jan 2019 14:36:04 +0800 Subject: [PATCH 2/2] temp --- lib/components/pagination.dart | 2 +- lib/components/search_input.dart | 36 +++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/lib/components/pagination.dart b/lib/components/pagination.dart index 2793882d..474d239e 100644 --- a/lib/components/pagination.dart +++ b/lib/components/pagination.dart @@ -24,7 +24,7 @@ class Pagination extends StatelessWidget { {'image': 'https://img.alicdn.com/tfs/TB1W4hMAwHqK1RjSZJnXXbNLpXa-519-260.jpg', 'type': 0, 'id': 9695909, 'url': 'https://www.zhihu.com/question/294145797/answer/551162834', 'title': '为什么阿里巴巴、腾讯和 Google 之类的企业都在使用 Flutter 开发 App?'}, {'image': 'https://img.alicdn.com/tfs/TB1XmFIApzqK1RjSZSgXXcpAVXa-720-338.jpg', 'type': 0, 'id': 9695859, 'url': 'https://zhuanlan.zhihu.com/p/51696594', 'title': 'Flutter 1.0 正式发布: Google 的便携 UI 工具包'}, {'image': 'https://img.alicdn.com/tfs/TB1mClCABLoK1RjSZFuXXXn0XXa-600-362.jpg', 'type': 0, 'id': 96956491409, 'url':'https://zhuanlan.zhihu.com/p/53497167','title': 'Flutter 示范应用现已开源 — 万物起源(The History of Everything)'}, - {'image': 'https://img.alicdn.com/tfs/TB1fXxIAAvoK1RjSZFNXXcxMVXa-600-362.jpg', 'type': 0, 'id': 9695816, 'url': 'https://mp.weixin.qq.com/s?__biz=MzAwODY4OTk2Mg==&mid=2652048101&idx=1&sn=20296088e4bd8ca33c5c9991167d9f7d&chksm=808caaa0b7fb23b65c0e5806209f8d86da6732f3a00a70353f3606018339518b0a8656f14dc5&mpshare=1&scene=2&srcid=0106SZapVysZdIS6Oc5AhNH6&from=timeline&ascene=2&devicetype=android-27&version=27000038&nettype=WIFI&abtest_cookie=BQABAAgACgALABMAFAAFAJ2GHgAjlx4AV5keAJuZHgCcmR4AAAA%3D&lang=zh_CN&pass_ticket=4K1%2FUpsxP4suPj2iubR17wbAP7r9LW9iYrPAC2dppTqv7j7JO5FWMXtcKeBRxueV&wx_header=1', 'title': 'Flutter 与 Material Design 双剑合璧,助您构建精美应用'} + {'image': 'https://img.alicdn.com/tfs/TB1fXxIAAvoK1RjSZFNXXcxMVXa-600-362.jpg', 'type': 0, 'id': 9695816, 'url': 'https://mp.weixin.qq.com/s?__biz=MzAwODY4OTk2Mg==&mid=2652048101&idx=1&sn=20296088e4bd8ca33c5c9991167d9f7d&chksm=808caaa0b7fb23b65c0e5806209f8d86da6732f3a00a70353f3606018339518b0a8656f14dc5&mpsshare=1&scene=2&srcid=0106SZapVysZdIS6Oc5AhNH6&from=timeline&ascene=2&devicetype=android-27&version=27000038&nettype=WIFI&abtest_cookie=BQABAAgACgALABMAFAAFAJ2GHgAjlx4AV5keAJuZHgCcmR4AAAA%3D&lang=zh_CN&pass_ticket=4K1%2FUpsxP4suPj2iubR17wbAP7r9LW9iYrPAC2dppTqv7j7JO5FWMXtcKeBRxueV&wx_header=1', 'title': 'Flutter 与 Material Design 双剑合璧,助您构建精美应用'} ]; void _launchURL(String url) async { diff --git a/lib/components/search_input.dart b/lib/components/search_input.dart index 36155575..a62bce1e 100644 --- a/lib/components/search_input.dart +++ b/lib/components/search_input.dart @@ -159,7 +159,9 @@ class _MaterialSearchState extends State { _resultsTimer?.cancel(); } Widget buildBody(List results) { - if (_loading) { + if (_criteria.isEmpty) { + return History(); + } else if (_loading) { return new Center( child: new Padding( padding: const EdgeInsets.only(top: 50.0), @@ -396,3 +398,35 @@ class SearchInput extends StatelessWidget { } } // wigdet干掉.=> componets + + +class History extends StatefulWidget { + const History() : super(); + + @override + _History createState() => _History(); +} + +/* +* AppBar 默认的实例,有状态 +* */ +class _History extends State { + + + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return new Center( + child: Text('这是一个即将完善的历史记录的面板'), + ); + } +} \ No newline at end of file