diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index c224a39..041b4fd 100644 --- a/.dart_tool/package_config.json +++ b/.dart_tool/package_config.json @@ -620,7 +620,7 @@ "languageVersion": "2.1" } ], - "generated": "2020-10-15T08:14:11.281280Z", + "generated": "2020-10-15T12:19:28.149342Z", "generator": "pub", "generatorVersion": "2.8.2" } diff --git a/assets/images/empty/3.0x/empty.png b/assets/images/empty/3.0x/empty.png new file mode 100755 index 0000000..8f8a5f2 Binary files /dev/null and b/assets/images/empty/3.0x/empty.png differ diff --git a/lib/pages/orders_page/order_search_page.dart b/lib/pages/orders_page/order_search_page.dart new file mode 100644 index 0000000..363fac3 --- /dev/null +++ b/lib/pages/orders_page/order_search_page.dart @@ -0,0 +1,91 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:zhiying_comm/zhiying_comm.dart'; +import 'package:zhiying_base_widget/widgets/empty/empty_widget.dart'; + +// 订单搜索页面 +class OrderSearchPage extends StatefulWidget { + @override + _OrderSearchPageState createState() => _OrderSearchPageState(); +} + +class _OrderSearchPageState extends State { + final TextEditingController _keywordController = TextEditingController(); + + @override + void initState() { + // TODO: implement initState + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: _createNav(), + body: SafeArea( + child: Container(width: double.infinity, + height: double.infinity, + child: Center(child: EmptyWidget())), + ), + ); + } + + // 导航栏 + Widget _createNav() { + return CupertinoNavigationBar( + border: Border( + bottom: BorderSide( + width: 0.0, // One physical pixel. + style: BorderStyle.none, + ), + ), + backgroundColor: Colors.white, + leading: Navigator.canPop(context) + ? GestureDetector( + child: Container( + padding: EdgeInsets.zero, + child: Icon( + Icons.arrow_back_ios, + size: 20, + ), + ), + onTap: () { + if (Navigator.canPop(context)) { + Navigator.pop(context); + } + }, + ) + : Container(), + middle: Container( + height: 32, + child: CupertinoTextField( + autofocus: true, + padding: EdgeInsets.only(left: 12, right: 12), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + color: Color(0xfff9f9f9)), + placeholder: '搜索商品标题/粉丝姓名/订单号', + placeholderStyle: TextStyle(color: Color(0xff999999), fontSize: 14), + controller: _keywordController, + style: TextStyle(fontSize: 14, color: Color(0xff333333)), + ), + ), + trailing: Container( + padding: EdgeInsets.only(left: 10), + child: CupertinoButton( + padding: EdgeInsets.zero, + child: Text( + '搜索', + style: TextStyle( + fontSize: 14, + color: Colors.redAccent, + ), + ), + onPressed: () { + Logger.debug(_keywordController.text); + }, + ), + ), + ); + } +} diff --git a/lib/pages/orders_page/orders_page.dart b/lib/pages/orders_page/orders_page.dart index c12e529..50b1870 100644 --- a/lib/pages/orders_page/orders_page.dart +++ b/lib/pages/orders_page/orders_page.dart @@ -1,5 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:zhiying_base_widget/pages/orders_page/order_search_page.dart'; import 'package:zhiying_base_widget/pages/orders_page/views/order_filter.dart'; import 'package:zhiying_base_widget/pages/orders_page/views/order_item_widget.dart'; import 'package:zhiying_base_widget/pages/orders_page/views/order_serch_widget.dart'; @@ -9,8 +10,7 @@ import 'package:zhiying_base_widget/pages/orders_page/views/order_tabbar_widget. class OrdersPage extends StatefulWidget { final Map data; - const OrdersPage( - this.data, { + const OrdersPage(this.data, { Key key, }) : super(key: key); @@ -42,19 +42,19 @@ class _OrdersPageState extends State { backgroundColor: Colors.white, leading: Navigator.canPop(context) ? GestureDetector( - child: Container( - padding: EdgeInsets.zero, - child: Icon( - Icons.arrow_back_ios, - size: 20, - ), - ), - onTap: () { - if (Navigator.canPop(context)) { - Navigator.pop(context); - } - }, - ) + child: Container( + padding: EdgeInsets.zero, + child: Icon( + Icons.arrow_back_ios, + size: 20, + ), + ), + onTap: () { + if (Navigator.canPop(context)) { + Navigator.pop(context); + } + }, + ) : Container(), middle: Text( '我的订单', @@ -90,7 +90,15 @@ class _OrdersContainerState extends State<_OrdersContainer> Widget build(BuildContext context) { return Column( children: [ - OrderSearchWidget(), + GestureDetector( + child: OrderSearchWidget(), + onTap: () { + Navigator.of(context) + .push(MaterialPageRoute(builder: (BuildContext context) { + return OrderSearchPage(); + })); + }, + ), OrderTabbarWidget( _tabController, [ diff --git a/lib/pages/orders_page/views/order_serch_widget.dart b/lib/pages/orders_page/views/order_serch_widget.dart index 3b20ea3..e09a4f2 100644 --- a/lib/pages/orders_page/views/order_serch_widget.dart +++ b/lib/pages/orders_page/views/order_serch_widget.dart @@ -9,14 +9,17 @@ class OrderSearchWidget extends StatelessWidget { height: 40, padding: EdgeInsets.only(left: 12.5, right: 12.5, top: 4, bottom: 4), color: Colors.white, - child: CupertinoTextField( - textAlign: TextAlign.center, - textInputAction: TextInputAction.search, + child: Container( padding: EdgeInsets.only(left: 12, right: 12), decoration: BoxDecoration( borderRadius: BorderRadius.circular(16), color: Color(0xfff9f9f9)), - placeholder: '搜索商品标题/粉丝姓名/订单号', - placeholderStyle: TextStyle(color: Color(0xff999999), fontSize: 14), + child: Center( + child: Text( + '搜索商品标题/粉丝姓名/订单号', + textAlign: TextAlign.center, + style: TextStyle(color: Color(0xff999999), fontSize: 14), + ), + ), ), ); } diff --git a/lib/widgets/empty/empty_widget.dart b/lib/widgets/empty/empty_widget.dart new file mode 100644 index 0000000..0681903 --- /dev/null +++ b/lib/widgets/empty/empty_widget.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; + +class EmptyWidget extends StatelessWidget { + final String tips; + + const EmptyWidget({Key key, this.tips = '暂无数据~'}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + 'assets/images/empty/empty.png', + package: 'zhiying_base_widget', + ), + Padding(padding: const EdgeInsets.all(16.0), + child: Text(tips, style: TextStyle( + fontSize: 15, + color: Color(0xff999999), + ))), + ], + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index d1d67f5..d97efac 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -65,7 +65,7 @@ flutter: # To add assets to your plugin package, add an assets section, like this: assets: - assets/images/launch_image/launch_image.png - # - images/a_dot_ham.jpeg + - assets/images/empty/empty.png # # For details regarding assets in packages, see # https://flutter.dev/assets-and-images/#from-packages