update routers

hmxc
张萌 4 years ago
parent 49999a666b
commit 4fd67e048f

@ -14,7 +14,6 @@ import 'package:akuCommunity/provider/cart.dart';
import 'package:flutter_picker/flutter_picker.dart'; import 'package:flutter_picker/flutter_picker.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:akuCommunity/routers/router_init.dart';
void main() { void main() {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
@ -35,7 +34,6 @@ class _MyAppState extends State<MyApp> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
RouterInit.setupRouter();
registerWxApi(appId: 'wxd7bdef0d4849ddb8'); registerWxApi(appId: 'wxd7bdef0d4849ddb8');
} }
@ -48,16 +46,11 @@ class _MyAppState extends State<MyApp> {
], ],
child: GetMaterialApp( child: GetMaterialApp(
title: '智慧社区', title: '智慧社区',
// builder: BotToastInit(),
// navigatorObservers: [BotToastNavigatorObserver()],
navigatorKey: RouterInit.navigatorKey,
onGenerateRoute: RouterInit.router.generator,
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
theme: ThemeData( theme: ThemeData(
primarySwatch: Colors.yellow, primarySwatch: Colors.yellow,
visualDensity: VisualDensity.adaptivePlatformDensity, visualDensity: VisualDensity.adaptivePlatformDensity,
), ),
// home: TabNavigator(),
home: TabNavigator(), home: TabNavigator(),
// //
localizationsDelegates: [ localizationsDelegates: [

@ -1,5 +1,4 @@
import 'package:akuCommunity/pages/market/market_cart_page/market_cart_page.dart'; import 'package:akuCommunity/pages/market/market_cart_page/market_cart_page.dart';
import 'package:akuCommunity/routers/page_routers.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter_icons/flutter_icons.dart';

@ -1,171 +1,4 @@
import 'package:akuCommunity/pages/one_alarm/widget/alarm_page.dart';
import 'package:akuCommunity/pages/setting_page/agreement_page/privacy_page.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:akuCommunity/pages/market/market_detail_page/market_detail_page.dart';
import 'package:akuCommunity/pages/market/market_cart_page/market_cart_page.dart';
import 'package:akuCommunity/pages/goods_details/goods_details_page.dart';
import 'package:akuCommunity/pages//goods_details/view_comments_page.dart';
import 'package:akuCommunity/pages/community/note_create_page.dart';
import 'package:akuCommunity/pages/community/topice_detail_page.dart';
import 'package:akuCommunity/pages/common/common_page.dart';
import 'package:akuCommunity/pages/personal/order_page.dart';
import 'package:akuCommunity/pages/personal/order_details_page.dart';
import 'package:akuCommunity/pages/personal/refund_select_page.dart';
import 'package:akuCommunity/pages/personal/refund_apply_page.dart';
import 'package:akuCommunity/pages/personal/evaluate_good_page.dart';
import 'package:akuCommunity/pages/personal/look_logistics_page.dart';
import 'package:akuCommunity/pages/sign/sign_in_page.dart';
import 'package:akuCommunity/pages/sign/user_authentication_page.dart';
import 'package:akuCommunity/pages/confirm_order_page/confirm_order_page.dart';
import 'package:akuCommunity/pages/confirm_order_page/pay_order_page.dart';
import 'package:akuCommunity/pages/scan/scan_page.dart';
import 'package:akuCommunity/pages/message_center_page/message_center_page.dart';
import 'package:akuCommunity/pages/message_center_page/system_message_page/system_message_page.dart';
import 'package:akuCommunity/pages/message_center_page/comment_message_page/comment_message_page.dart';
import 'package:akuCommunity/pages/message_center_page/shop_message_page/shop_message_page.dart';
import 'package:akuCommunity/pages/message_center_page/system_message_page/system_details_page/system_details_page.dart';
import 'package:akuCommunity/pages/certification_page/certification_page.dart';
import 'package:akuCommunity/pages/visitor_access_page/visitor_access_page.dart';
import 'package:akuCommunity/pages/visitor_access_page/visitor_record_page.dart';
import 'package:akuCommunity/pages/visitor_access_page/visitor_pass_page.dart';
import 'package:akuCommunity/pages/life_pay/life_pay_page.dart';
import 'package:akuCommunity/pages/life_pay/life_pay_record_page/life_pay_record_page.dart';
import 'package:akuCommunity/pages/life_pay/life_pay_bill_page/life_pay_bill_page.dart';
import 'package:akuCommunity/pages/life_pay/life_pay_info_page/life_pay_info_page.dart';
import 'package:akuCommunity/pages/industry_committee/industry_committee_page.dart';
import 'package:akuCommunity/pages/industry_committee/committee_mailbox/committee_mailbox_page.dart';
import 'package:akuCommunity/pages/convenient_phone/convenient_phone_page.dart';
import 'package:akuCommunity/pages/total_application_page/total_applications_page.dart';
import 'package:akuCommunity/pages/questionnaire_page/questionnaire_page.dart';
import 'package:akuCommunity/pages/questionnaire_page/questionnaire_details_page/questionnaire_details_page.dart';
import 'package:akuCommunity/pages/goods_manage_page/goods_manage_page.dart';
import 'package:akuCommunity/pages/goods_manage_page/mine_goods_page/mine_goods_page.dart';
import 'package:akuCommunity/pages/opening_code_page/opening_code_page.dart';
import 'package:akuCommunity/pages/goods_deto_page/goods_deto_page.dart';
import 'package:akuCommunity/pages/goods_deto_page/deto_code_page/deto_code_page.dart';
import 'package:akuCommunity/pages/goods_deto_page/deto_create_page/deto_create_page.dart';
import 'package:akuCommunity/pages/activities_page/activities_page.dart';
import 'package:akuCommunity/pages/activities_page/activities_details_page/activities_details_page.dart';
import 'package:akuCommunity/pages/activities_page/member_list_page/member_list_page.dart';
import 'package:akuCommunity/pages/notice_page/notice_page.dart';
import 'package:akuCommunity/pages/mine_house_page/mine_house_page.dart';
import 'package:akuCommunity/pages/mine_house_page/house_authenticate_page/house_authenticate_page.dart';
import 'package:akuCommunity/pages/mine_car_page/mine_car_page.dart';
import 'package:akuCommunity/pages/mine_car_page/car_add_page/car_add_page.dart';
import 'package:akuCommunity/pages/mine_car_page/select_community_page/select_community_page.dart';
import 'package:akuCommunity/pages/mine_car_page/select_parking_page/select_parking_page.dart';
import 'package:akuCommunity/pages/market_class/market_class_page.dart';
import 'package:akuCommunity/pages/address_page/address_page.dart';
import 'package:akuCommunity/pages/address_page/address_edit_page.dart';
import 'package:akuCommunity/pages/fitup_manage/fitup_manage_page.dart';
import 'package:akuCommunity/pages/invoice/invoice_page.dart';
import 'package:akuCommunity/pages/setting_page/about_page/about_page.dart';
import 'package:akuCommunity/pages/setting_page/feedback_page/feedback_page.dart';
import 'package:akuCommunity/pages/setting_page/invite_page/invite_page.dart';
import 'package:akuCommunity/pages/setting_page/agreement_page/agreement_page.dart';
import 'package:akuCommunity/pages/things_page/things_page.dart';
import 'package:akuCommunity/pages/things_page/things_detail_page/things_detail_page.dart';
import 'package:akuCommunity/pages/things_page/things_create_page/things_create_page.dart';
import 'package:akuCommunity/pages/things_page/things_evaluate_page/things_evaluate_page.dart';
enum PageName {
market_detail_page,
market_cart_page,
goods_details_page,
view_comments_page,
invoice_page,
common_page,
note_create_page,
topice_detail_page,
order_page,
order_details_page,
refund_select_page,
refund_apply_page,
evaluate_good_page,
look_logistics_page,
sign_in_page,
user_authentication_page,
confirm_order_page,
pay_order_page,
pay_success_page,
scan_page,
message_center_page,
system_message_page,
comment_message_page,
shop_message_page,
system_details_page,
open_door_page,
certification_page,
visitor_access_page,
visitor_record_page,
visitor_pass_page,
life_pay_page,
life_pay_record_page,
life_pay_bill_page,
life_pay_info_page,
industry_committee_page,
committee_mailbox_page,
convenient_phone_page,
total_applications_page,
questionnaire_page,
questionnaire_details_page,
goods_manage_page,
mine_goods_page,
opening_code_page,
goods_deto_page,
deto_code_page,
deto_create_page,
activities_page,
activities_details_page,
member_list_page,
notice_page,
mine_house_page,
house_authenticate_page,
mine_car_page,
car_add_page,
select_community_page,
select_parking_page,
market_class_page,
address_page,
address_edit_page,
one_alarm_page,
fitup_manage_page,
setting_page,
about_page,
feedback_page,
invite_page,
things_page,
things_detail_page,
things_create_page,
things_evaluate_page,
agreement_page,
privacy_page,
alarm_page,
}
class Bundle { class Bundle {
Map<String, dynamic> _map = {}; Map<String, dynamic> _map = {};
@ -205,142 +38,3 @@ class Bundle {
} }
} }
typedef Widget HandlerFunc(
BuildContext context, Map<String, List<String>> params);
typedef Widget PageBuilderFunc(Bundle bundle);
class PageBuilder {
final PageBuilderFunc builder;
HandlerFunc handlerFunc;
PageBuilder({this.builder}) {
this.handlerFunc = (context, _) {
return this.builder(ModalRoute.of(context).settings.arguments as Bundle);
};
}
Handler getHandler() {
return Handler(handlerFunc: this.handlerFunc);
}
}
final Map<PageName, PageBuilder> pageRoutes = {
PageName.market_detail_page:
PageBuilder(builder: (bundle) => MarketDetailPage(bundle: bundle)),
PageName.market_cart_page: PageBuilder(builder: (bundle) => MarketCartPage()),
PageName.goods_details_page:
PageBuilder(builder: (bundle) => GoodsDetailsPage(bundle: bundle)),
PageName.view_comments_page:
PageBuilder(builder: (bundle) => ViewCommentsPage()),
PageName.invoice_page:
PageBuilder(builder: (bundle) => InvoicePage(bundle: bundle)),
PageName.note_create_page: PageBuilder(builder: (bundle) => NoteCreatePage()),
PageName.topice_detail_page:
PageBuilder(builder: (bundle) => TopiceDetailPage(bundle: bundle)),
PageName.order_page:
PageBuilder(builder: (bundle) => OrderPage(bundle: bundle)),
PageName.order_details_page:
PageBuilder(builder: (bundle) => OrderDetailsPage(bundle: bundle)),
PageName.refund_select_page:
PageBuilder(builder: (bundle) => RefundSelectPage(bundle: bundle)),
PageName.refund_apply_page:
PageBuilder(builder: (bundle) => RefundApplyPage(bundle: bundle)),
PageName.evaluate_good_page:
PageBuilder(builder: (bundle) => EvaluateGoodPage(bundle: bundle)),
PageName.look_logistics_page:
PageBuilder(builder: (bundle) => LookLogisticsPage()),
PageName.sign_in_page: PageBuilder(builder: (bundle) => SignInPage()),
PageName.user_authentication_page:
PageBuilder(builder: (bundle) => UserAuthenticationPage()),
PageName.common_page:
PageBuilder(builder: (bundle) => CommonPage(bundle: bundle)),
PageName.privacy_page: PageBuilder(builder: (bundle) => PrivacyPage()),
PageName.confirm_order_page:
PageBuilder(builder: (bundle) => ConfirmOrderPage(bundle: bundle)),
PageName.pay_order_page:
PageBuilder(builder: (bundle) => PayOrderPage(bundle: bundle)),
PageName.scan_page: PageBuilder(builder: (bundle) => ScanPage()),
PageName.message_center_page:
PageBuilder(builder: (bundle) => MessageCenterPage()),
PageName.system_message_page:
PageBuilder(builder: (bundle) => SystemMessagePage()),
PageName.comment_message_page:
PageBuilder(builder: (bundle) => CommentMessagePage()),
PageName.shop_message_page:
PageBuilder(builder: (bundle) => ShopMessagePage()),
PageName.system_details_page:
PageBuilder(builder: (bundle) => SystemDetailsPage(bundle: bundle)),
PageName.certification_page:
PageBuilder(builder: (bundle) => CertificationPage()),
PageName.visitor_access_page:
PageBuilder(builder: (bundle) => VisitorAccessPage()),
PageName.visitor_record_page:
PageBuilder(builder: (bundle) => VisitorRecordPage()),
PageName.visitor_pass_page:
PageBuilder(builder: (bundle) => VisitorPassPage()),
PageName.life_pay_page: PageBuilder(builder: (bundle) => LifePayPage()),
PageName.life_pay_record_page:
PageBuilder(builder: (bundle) => LifePayRecordPage()),
PageName.life_pay_bill_page:
PageBuilder(builder: (bundle) => LifePayBillPage()),
PageName.life_pay_info_page:
PageBuilder(builder: (bundle) => LifePayInfoPage(bundle: bundle)),
PageName.industry_committee_page:
PageBuilder(builder: (bundle) => IndustryCommitteePage()),
PageName.committee_mailbox_page:
PageBuilder(builder: (bundle) => CommitteeMailboxPage()),
PageName.convenient_phone_page:
PageBuilder(builder: (bundle) => ConvenientPhonePage()),
PageName.total_applications_page:
PageBuilder(builder: (bundle) => TotalApplicationsPage()),
PageName.questionnaire_page:
PageBuilder(builder: (bundle) => QuestionnairePage()),
PageName.questionnaire_details_page: PageBuilder(
builder: (bundle) => QuestionnaireDetailsPage(bundle: bundle)),
PageName.goods_manage_page:
PageBuilder(builder: (bundle) => GoodsManagePage()),
PageName.mine_goods_page: PageBuilder(builder: (bundle) => MineGoodsPage()),
PageName.opening_code_page:
PageBuilder(builder: (bundle) => OpeningCodePage()),
PageName.goods_deto_page: PageBuilder(builder: (bundle) => GoodsDetoPage()),
PageName.deto_code_page: PageBuilder(builder: (bundle) => DetoCodePage()),
PageName.deto_create_page: PageBuilder(builder: (bundle) => DetoCreatePage()),
PageName.activities_page:
PageBuilder(builder: (bundle) => ActivitiesPage(bundle: bundle)),
PageName.activities_details_page:
PageBuilder(builder: (bundle) => ActivitiesDetailsPage(bundle: bundle)),
PageName.member_list_page: PageBuilder(builder: (bundle) => MemberListPage()),
PageName.notice_page:
PageBuilder(builder: (bundle) => NoticePage(bundle: bundle)),
PageName.mine_house_page: PageBuilder(builder: (bundle) => MineHousePage()),
PageName.house_authenticate_page:
PageBuilder(builder: (bundle) => HouseAuthenticatePage()),
PageName.mine_car_page:
PageBuilder(builder: (bundle) => MineCarPage(bundle: bundle)),
PageName.car_add_page: PageBuilder(builder: (bundle) => CarAddPage()),
PageName.select_community_page:
PageBuilder(builder: (bundle) => SelectCommunityPage()),
PageName.select_parking_page:
PageBuilder(builder: (bundle) => SelectParkingPage(bundle: bundle)),
PageName.market_class_page:
PageBuilder(builder: (bundle) => MarketClassPage()),
PageName.address_page: PageBuilder(builder: (bundle) => AddressPage()),
PageName.address_edit_page:
PageBuilder(builder: (bundle) => AddressEditPage(bundle: bundle)),
PageName.fitup_manage_page:
PageBuilder(builder: (bundle) => FitupManagePage()),
PageName.about_page: PageBuilder(builder: (bundle) => AboutPage()),
PageName.invite_page: PageBuilder(builder: (bundle) => InvitePage()),
PageName.feedback_page: PageBuilder(builder: (bundle) => FeedBackPage()),
PageName.agreement_page: PageBuilder(builder: (bundle) => AgreementPage()),
PageName.things_page:
PageBuilder(builder: (bundle) => ThingsPage(bundle: bundle)),
PageName.things_detail_page:
PageBuilder(builder: (bundle) => ThingsDetailPage(bundle: bundle)),
PageName.things_create_page:
PageBuilder(builder: (bundle) => ThingsCreatePage(bundle: bundle)),
PageName.things_evaluate_page:
PageBuilder(builder: (bundle) => ThingsEvaluatePage(bundle: bundle)),
PageName.alarm_page: PageBuilder(
builder: (bundle) => AlarmPage(bundle: bundle),
)
};

@ -1,17 +0,0 @@
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart' hide Router;
import 'page_routers.dart';
class RouterInit {
static final router = Router();
static final GlobalKey<NavigatorState> navigatorKey = GlobalKey();
static setupRouter() {
pageRoutes.forEach((path, handler) {
router.define(
path.toString(),
handler: handler.getHandler(),
transitionType: TransitionType.cupertino,
);
});
}
}
Loading…
Cancel
Save