routes.dart 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. import 'dart:convert';
  2. import 'package:fluro/fluro.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:sport/bean/achievement_info.dart';
  5. import 'package:sport/pages/my/achievement_detail_page.dart';
  6. import 'package:sport/pages/my/achievement_page.dart';
  7. import 'package:sport/pages/my/feedback_detail_page.dart';
  8. import 'package:sport/pages/my/feedback_page.dart';
  9. import 'package:sport/pages/my/game_list_page.dart';
  10. import 'package:sport/pages/my/level_page.dart';
  11. import 'package:sport/pages/my/score_shop.dart';
  12. import 'package:sport/pages/my/shop_detail.dart';
  13. import 'package:sport/pages/setting/message_setting_page.dart';
  14. import 'package:sport/pages/social/chat_page.dart';
  15. import 'package:sport/pages/social/message_detail_page.dart';
  16. import 'package:sport/pages/social/message_page.dart';
  17. import 'package:sport/pages/social/search_page.dart';
  18. import 'route_handles.dart';
  19. class Routes {
  20. static String root = "/";
  21. static String home = "/home";
  22. // setting
  23. static String setting = "/setting";
  24. static String privacypolicy = "/privacypolicy";
  25. static String serviceagreement = "/serviceagreement";
  26. static String account = "/account";
  27. static String userInfo = "/user_info";
  28. static String deviceInfo = "/device_info";
  29. static String messageSetting = "/message_setting";
  30. // social
  31. static String socialDetail = "/social_detail";
  32. static String socialPost = "/post";
  33. static String socialPostDetail = "/post_detail";
  34. static String socialUserDetail = "/user_detail";
  35. static String socialSearch = "/social_search";
  36. static String socialMessage = "/social_message";
  37. static String socialMessageDetail = "/social_message_detail";
  38. static String chat = '/chat';
  39. // home
  40. static String sportDetail = "/sport_detail";
  41. static String sportHistory = "/sport_history";
  42. static String targetModify = "/target_modify";
  43. static String rankIntroduce = '/rank_introduce';
  44. // game
  45. static String gameIndex = "/game";
  46. static String gameDetails = "/game_details";
  47. static String rankDetails = "/rank_details";
  48. static String rankPeopleDetails = "/rank_people_detals";
  49. // login
  50. static String login = "/login";
  51. static String license = "/license";
  52. static String authCode = "/authCode";
  53. static String register = "/register";
  54. static String basicInfo = "/basicInfo";
  55. static String findPassword = "/findPassword";
  56. // mine
  57. static String achievement = "/achievement";
  58. static String achievementDetail = "/achievement_detail";
  59. static String level = "/level";
  60. static String feedback = "/feedback";
  61. static String feedbackDetail = "/feedback_detail";
  62. static String gamelistpage = "/gamelistpage";
  63. static String scoreShopPage = "/scoreShopPage";
  64. static String shopPageDetail = '/shopPageDetail';
  65. static void configureRoutes(Router router) {
  66. router.notFoundHandler = Handler(handlerFunc: (BuildContext context, Map<String, List<String>> params) {
  67. print("ROUTE WAS NOT FOUND !!!");
  68. return null;
  69. });
  70. router.define(root, handler: splashHandler);
  71. router.define(home, handler: homeHandler);
  72. // setting
  73. router.define(setting, handler: settingHandler);
  74. router.define(privacypolicy, handler: privacypolicyHandler);
  75. router.define(serviceagreement, handler: serviceagreementHandler);
  76. router.define(account, handler: accountHandler);
  77. router.define(messageSetting, handler: Handler(handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  78. return MessageSettingPage();
  79. }));
  80. router.define(userInfo, handler: userInfoHandler);
  81. router.define(deviceInfo, handler: deviceInfoHandler);
  82. // social
  83. router.define(socialDetail, handler: socialDetailHandler);
  84. router.define(socialPost, handler: socialPostHandler);
  85. router.define(socialPostDetail, handler: socialPostDetailHandler);
  86. router.define(socialUserDetail, handler: socialUserDetailHandler);
  87. router.define(socialSearch, handler: Handler(handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  88. return SearchPage();
  89. }));
  90. router.define(socialMessage, handler: Handler(handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  91. return MessagePage();
  92. }));
  93. router.define(socialMessageDetail, handler: Handler(handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  94. return MessageDetailPage(params['data'].first);
  95. }));
  96. router.define(chat, handler: Handler(handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  97. return ChatPage(params['user'].first,post: params['post'].first,);
  98. }));
  99. // home
  100. router.define(sportDetail, handler: sportDetailHandler);
  101. router.define(sportHistory, handler: sportHistoryHandler);
  102. router.define(targetModify, handler: targetModifyHandler);
  103. // game
  104. router.define(gameIndex, handler: gameIndexHandler);
  105. router.define(gameDetails, handler: gameDetailsHandler);
  106. router.define(rankDetails, handler: rankDetailHandler);
  107. router.define(rankPeopleDetails, handler: rankPeopleDetailsHandler);
  108. router.define(rankIntroduce, handler: rankIntroduceHandler);
  109. // login
  110. router.define(login, handler: loginHandler);
  111. router.define(license, handler: licenseHandler);
  112. router.define(authCode, handler: authCodeHandler);
  113. router.define(register, handler: registerHandler);
  114. router.define(basicInfo, handler: basicHandler);
  115. router.define(findPassword, handler: findPasswordHandler);
  116. // mine
  117. router.define(achievement, handler: Handler(handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  118. return AchievementPage(AchievementInfoData.fromJson(json.decode(params['data'].first)));
  119. }));
  120. router.define(achievementDetail, handler: Handler(handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  121. return AchievementDetailPage(int.parse(params['id'].first),int.parse(params['userId'].first));
  122. }));
  123. router.define(level, handler: Handler(handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  124. return LevelPage();
  125. }));
  126. router.define(feedback, handler: Handler(handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  127. return FeedbackPage();
  128. }));
  129. router.define(feedbackDetail, handler: Handler(handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  130. return FeedbackDetailPage(params['data'].first);
  131. }));
  132. router.define(gamelistpage, handler: Handler(handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  133. return GameListPage();
  134. }));
  135. router.define(scoreShopPage, handler: Handler(handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  136. return ScoreShopPage();
  137. }));
  138. router.define(scoreShopPage, handler: Handler(handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  139. return ShopDetailPage();
  140. }));
  141. }
  142. }