From a0c1b8b6a73c120d2d96051d3586726a187618df Mon Sep 17 00:00:00 2001 From: laiiihz Date: Wed, 28 Apr 2021 17:33:49 +0800 Subject: [PATCH] fix jpush cast error --- lib/constants/application_objects.dart | 31 ++++++++++++ lib/main_initialize.dart | 11 +++-- lib/pages/personal/personal_page.dart | 66 +++++++++++++++++++++++++- lib/ui/market/market_page.dart | 4 -- lib/ui/profile/order/order_page.dart | 33 +++++++++++++ 5 files changed, 134 insertions(+), 11 deletions(-) create mode 100644 lib/ui/profile/order/order_page.dart diff --git a/lib/constants/application_objects.dart b/lib/constants/application_objects.dart index b43b248e..dc87f114 100644 --- a/lib/constants/application_objects.dart +++ b/lib/constants/application_objects.dart @@ -1,3 +1,4 @@ +import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:flutter/material.dart'; import 'package:aku_community/const/resource.dart'; @@ -74,6 +75,31 @@ List appObjects = [ AO('借还管理', R.ASSETS_APPLICATIONS_BORROW_PNG, () => SelectBorrowReturnPage()), AO('一键报警', R.ASSETS_APPLICATIONS_POLICE_PNG, () => AlarmPage()), AO('设施预约', R.ASSETS_ICONS_TOOL_FACILITY_PNG, () => PickFacilityPage()), + AO( + '小区教育', + R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + () => BeeScaffold(title: '小区教育'), + ), + AO( + '健康运动', + R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + () => BeeScaffold(title: '健康运动'), + ), + AO( + '家政服务', + R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + () => BeeScaffold(title: '家政服务'), + ), + AO( + '居家养老', + R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + () => BeeScaffold(title: '居家养老'), + ), + AO( + '物业租赁', + R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + () => BeeScaffold(title: '物业租赁'), + ), ]; List userAppObjects = [ @@ -123,6 +149,11 @@ List _smartManagerApp = [ '借还管理', '一键报警', '设施预约', + '小区教育', + '健康运动', + '家政服务', + '居家养老', + '物业租赁', ]; ///智慧管家 diff --git a/lib/main_initialize.dart b/lib/main_initialize.dart index 05c46c5d..8c36133f 100644 --- a/lib/main_initialize.dart +++ b/lib/main_initialize.dart @@ -38,8 +38,9 @@ class MainInitialize { static Future initJPush() async { if (kIsWeb || Platform.isMacOS) return; JPush jpush = new JPush(); - Function(Map message) jPushLogger(String type) { - return (Map message) async { + Future Function(Map? message)? jPushLogger( + String type) { + return (Map? message) async { LoggerData.addData({ 'type': type, 'message': message, @@ -48,9 +49,9 @@ class MainInitialize { } jpush.addEventHandler( - onReceiveNotification: jPushLogger('onReceiveNotification') as Future Function(Map?)?, - onOpenNotification: jPushLogger('onOpenNotification') as Future Function(Map?)?, - onReceiveMessage: jPushLogger('onReceiveMessage') as Future Function(Map?)?, + onReceiveNotification: jPushLogger('onReceiveNotification'), + onOpenNotification: jPushLogger('onOpenNotification'), + onReceiveMessage: jPushLogger('onReceiveMessage'), ); jpush.setup( appKey: "6a2c6507e3e8b3187ac1c9f9", diff --git a/lib/pages/personal/personal_page.dart b/lib/pages/personal/personal_page.dart index 061602f2..15850a5d 100644 --- a/lib/pages/personal/personal_page.dart +++ b/lib/pages/personal/personal_page.dart @@ -1,3 +1,4 @@ +import 'package:aku_community/ui/profile/order/order_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -72,8 +73,7 @@ class _PersonalIndexState extends State child: FadeInImage.assetNetwork( placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, image: API.image( - userProvider.userInfoModel?.imgUrl ?? - ''), + userProvider.userInfoModel?.imgUrl ?? ''), height: 106.w, width: 106.w, fit: BoxFit.cover, @@ -161,6 +161,32 @@ class _PersonalIndexState extends State ); } + Widget _orderButton({ + required String name, + required String path, + required int index, + }) { + return MaterialButton( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset(path, height: 50.w, width: 50.w), + 10.hb, + Text( + name, + style: TextStyle( + color: Color(0xFF333333), + fontSize: 22.sp, + ), + ), + ], + ), + onPressed: () { + Get.to(() => OrderPage(initIndex: index)); + }, + ); + } + @override Widget build(BuildContext context) { final double _statusHeight = MediaQuery.of(context).padding.top; @@ -175,6 +201,42 @@ class _PersonalIndexState extends State child: CustomScrollView( slivers: [ _sliverAppBar(_statusHeight), + SliverToBoxAdapter( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + _containerBar('我的订单'), + GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 5, + ), + shrinkWrap: true, + children: [ + _orderButton( + name: '待付款', + path: R.ASSETS_ICONS_USER_ICON_DFK_PNG, + index: 1, + ), + _orderButton( + name: '待收货', + path: R.ASSETS_ICONS_USER_ICON_DSH_PNG, + index: 2, + ), + _orderButton( + name: '待评价', + path: R.ASSETS_ICONS_USER_ICON_DPJ_PNG, + index: 3, + ), + _orderButton( + name: '售后', + path: R.ASSETS_ICONS_USER_ICON_SH_PNG, + index: 4, + ), + ], + ), + ], + ), + ), SliverToBoxAdapter( child: Container( decoration: BoxDecoration( diff --git a/lib/ui/market/market_page.dart b/lib/ui/market/market_page.dart index 22f34b67..dfe8007b 100644 --- a/lib/ui/market/market_page.dart +++ b/lib/ui/market/market_page.dart @@ -24,10 +24,6 @@ class _MarketPageState extends State Widget build(BuildContext context) { super.build(context); final mediaWidth = MediaQuery.of(context).size.width; - print({ - 'height': MediaQuery.of(context).size.height, - 'width': MediaQuery.of(context).size.width, - }); return BeeScaffold( title: '商城', body: NestedScrollView( diff --git a/lib/ui/profile/order/order_page.dart b/lib/ui/profile/order/order_page.dart new file mode 100644 index 00000000..e26a699c --- /dev/null +++ b/lib/ui/profile/order/order_page.dart @@ -0,0 +1,33 @@ +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart'; +import 'package:flutter/material.dart'; + +class OrderPage extends StatefulWidget { + final int initIndex; + OrderPage({Key? key, required this.initIndex}) : super(key: key); + + @override + _OrderPageState createState() => _OrderPageState(); +} + +class _OrderPageState extends State with TickerProviderStateMixin { + late TabController _tabController; + List _tabs = ['全部', '待付款', '待收货', '待评价', '售后']; + @override + void initState() { + super.initState(); + _tabController = TabController( + length: _tabs.length, + vsync: this, + initialIndex: widget.initIndex, + ); + } + + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '订单', + appBarBottom: BeeTabBar(controller: _tabController, tabs: _tabs), + ); + } +}