diff --git a/lib/constants/app_theme.dart b/lib/constants/app_theme.dart index 475a4d21..83396c53 100644 --- a/lib/constants/app_theme.dart +++ b/lib/constants/app_theme.dart @@ -111,8 +111,13 @@ class AppTheme { } class SystemStyle { - static const lightStatusBar = SystemUiOverlayStyle( + static const initial = SystemUiOverlayStyle( statusBarIconBrightness: Brightness.light, systemNavigationBarColor: Colors.white, ); + + static const yellowBottomBar = SystemUiOverlayStyle( + statusBarIconBrightness: Brightness.light, + systemNavigationBarColor: Color(0xFFFFD000), + ); } diff --git a/lib/pages/tab_navigator.dart b/lib/pages/tab_navigator.dart index 18bd16a1..b81d6c86 100644 --- a/lib/pages/tab_navigator.dart +++ b/lib/pages/tab_navigator.dart @@ -1,3 +1,4 @@ +import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -76,7 +77,7 @@ class _TabNavigatorState extends State _buildBottomBar('我的', R.ASSETS_ICONS_TABBAR_USER_NO_PNG, R.ASSETS_ICONS_TABBAR_USER_PNG), ]; - return Scaffold( + return BeeScaffold( body: WillPopScope( onWillPop: () async { if (_lastPressed == null || @@ -94,7 +95,7 @@ class _TabNavigatorState extends State physics: NeverScrollableScrollPhysics(), ), ), - bottomNavigationBar: StatefulBuilder(builder: (context, setFunc) { + bottomNavi: StatefulBuilder(builder: (context, setFunc) { return BottomNavigationBar( items: _bottomNav, backgroundColor: Colors.white, diff --git a/lib/pages/things_page/fixed_submit_page.dart b/lib/pages/things_page/fixed_submit_page.dart index e1188834..aad9c125 100644 --- a/lib/pages/things_page/fixed_submit_page.dart +++ b/lib/pages/things_page/fixed_submit_page.dart @@ -1,3 +1,4 @@ +import 'package:akuCommunity/constants/app_theme.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -214,6 +215,7 @@ class _FixedSubmitPageState extends State { Widget build(BuildContext context) { UserProvider userProvider = Provider.of(context); return BeeScaffold( + systemStyle: SystemStyle.yellowBottomBar, title: '报事报修', actions: [ IconButton( diff --git a/lib/pages/things_page/widget/add_fixed_submit_page.dart b/lib/pages/things_page/widget/add_fixed_submit_page.dart index c5e692dd..97c72c96 100644 --- a/lib/pages/things_page/widget/add_fixed_submit_page.dart +++ b/lib/pages/things_page/widget/add_fixed_submit_page.dart @@ -1,5 +1,7 @@ import 'dart:io'; +import 'package:akuCommunity/constants/app_theme.dart'; +import 'package:akuCommunity/widget/picker/bee_house_picker.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -10,14 +12,11 @@ import 'package:provider/provider.dart'; import 'package:velocity_x/velocity_x.dart'; import 'package:akuCommunity/base/base_style.dart'; -import 'package:akuCommunity/const/resource.dart'; import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/extensions/widget_list_ext.dart'; import 'package:akuCommunity/pages/manager_func.dart'; import 'package:akuCommunity/pages/things_page/widget/finish_fixed_submit_page.dart'; import 'package:akuCommunity/provider/app_provider.dart'; -import 'package:akuCommunity/provider/user_provider.dart'; -import 'package:akuCommunity/ui/profile/house/pick_my_house_page.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/network/base_model.dart'; import 'package:akuCommunity/utils/network/net_util.dart'; @@ -51,50 +50,15 @@ class _AddFixedSubmitPageState extends State { super.dispose(); } - Widget _buildHouseCard( - String title, - String detail, - ) { - return Padding( - padding: EdgeInsets.all(32.w), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - '报修房屋'.text.black.size(28.sp).make(), - 32.w.heightBox, - GestureDetector( - onTap: () { - Get.to(() => PickMyHousePage()); - }, - child: Row( - children: [ - Image.asset( - R.ASSETS_ICONS_HOUSE_PNG, - width: 60.w, - height: 60.w, - ), - 40.w.widthBox, - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - title.text.black.size(32.sp).bold.make(), - 10.w.heightBox, - detail.text.black.size(32.sp).bold.make() - ], - ), - ), - Icon( - CupertinoIcons.chevron_forward, - size: 40.w, - ), - ], - ).material(color: Colors.transparent), - ), - 24.w.heightBox, - BeeDivider.horizontal(), - ], - ), + Widget _buildHouseCard() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '报修房屋'.text.black.size(28.sp).make().pSymmetric(h: 32.w), + 8.w.heightBox, + BeeHousePicker(), + BeeDivider.horizontal(indent: 32.w, endIndent: 32.w), + ], ); } @@ -209,17 +173,13 @@ class _AddFixedSubmitPageState extends State { @override Widget build(BuildContext context) { - UserProvider userProvider = Provider.of(context); AppProvider appProvider = Provider.of(context); return WillPopScope( child: BeeScaffold( title: '报事报修', body: ListView( children: [ - _buildHouseCard( - S.of(context).tempPlotName, - appProvider.selectedHouse.roomName, - ), + _buildHouseCard(), _getType(), _buildReportCard(), _addImages(), diff --git a/lib/ui/community/community_views/topic/topic_detail_page.dart b/lib/ui/community/community_views/topic/topic_detail_page.dart index a4532233..e3916938 100644 --- a/lib/ui/community/community_views/topic/topic_detail_page.dart +++ b/lib/ui/community/community_views/topic/topic_detail_page.dart @@ -35,7 +35,7 @@ class _TopicDetailPageState extends State { @override Widget build(BuildContext context) { return AnnotatedRegion( - value: SystemStyle.lightStatusBar, + value: SystemStyle.initial, child: Scaffold( floatingActionButton: FloatingActionButton( heroTag: 'event_add', diff --git a/lib/widget/bee_scaffold.dart b/lib/widget/bee_scaffold.dart index b7b450d6..f1f53be0 100644 --- a/lib/widget/bee_scaffold.dart +++ b/lib/widget/bee_scaffold.dart @@ -1,10 +1,12 @@ +import 'package:akuCommunity/constants/app_theme.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:velocity_x/velocity_x.dart'; import 'package:akuCommunity/widget/bee_back_button.dart'; -class BeeScaffold extends StatefulWidget { +class BeeScaffold extends StatelessWidget { final String title; final Widget body; @@ -19,6 +21,8 @@ class BeeScaffold extends StatefulWidget { final Widget bottomNavi; final PreferredSizeWidget appBarBottom; final FloatingActionButton fab; + + final SystemUiOverlayStyle systemStyle; BeeScaffold({ Key key, @required this.title, @@ -30,6 +34,7 @@ class BeeScaffold extends StatefulWidget { this.bottomNavi, this.appBarBottom, this.fab, + this.systemStyle = SystemStyle.initial, }) : super(key: key); BeeScaffold.white({ @@ -42,28 +47,29 @@ class BeeScaffold extends StatefulWidget { this.bottomNavi, this.appBarBottom, this.fab, + this.systemStyle = SystemStyle.initial, }) : this.bodyColor = Colors.white, super(key: key); - @override - _BeeScaffoldState createState() => _BeeScaffoldState(); -} - -class _BeeScaffoldState extends State { @override Widget build(BuildContext context) { - return Scaffold( - backgroundColor: widget.bodyColor, - appBar: AppBar( - backgroundColor: widget.bgColor, - title: widget.title.text.make(), - leading: widget.leading ?? BeeBackButton(), - actions: widget.actions, - bottom: widget.appBarBottom, + return AnnotatedRegion( + value: systemStyle, + child: Scaffold( + backgroundColor: bodyColor, + appBar: title == null + ? null + : AppBar( + backgroundColor: bgColor, + title: title.text.make(), + leading: leading ?? BeeBackButton(), + actions: actions, + bottom: appBarBottom, + ), + body: body, + bottomNavigationBar: bottomNavi, + floatingActionButton: fab, ), - body: widget.body, - bottomNavigationBar: widget.bottomNavi, - floatingActionButton: widget.fab, ); } } diff --git a/lib/widget/picker/bee_house_picker.dart b/lib/widget/picker/bee_house_picker.dart new file mode 100644 index 00000000..98b843e0 --- /dev/null +++ b/lib/widget/picker/bee_house_picker.dart @@ -0,0 +1,47 @@ +import 'package:akuCommunity/provider/app_provider.dart'; +import 'package:akuCommunity/ui/profile/house/pick_my_house_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; +import 'package:velocity_x/velocity_x.dart'; +import 'package:akuCommunity/utils/headers.dart'; + +class BeeHousePicker extends StatelessWidget { + const BeeHousePicker({Key key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final appProvider = Provider.of(context); + return MaterialButton( + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + onPressed: () { + Get.to(() => PickMyHousePage()); + }, + child: Row( + children: [ + Image.asset( + R.ASSETS_ICONS_HOUSE_PNG, + width: 60.w, + height: 60.w, + ), + 40.w.widthBox, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + S.of(context).tempPlotName.text.black.size(32.sp).bold.make(), + 10.w.heightBox, + appProvider.selectedHouse.roomName.text.black + .size(32.sp) + .bold + .make() + ], + ), + ), + Icon(CupertinoIcons.chevron_forward, size: 40.w), + ], + ), + ); + } +}