route_handles.dart 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. // splash 页面
  2. import 'dart:convert';
  3. import 'package:fluro/fluro.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:sport/bean/post.dart';
  6. import 'package:sport/bean/post_user.dart';
  7. import 'package:sport/bean/game.dart';
  8. import 'package:sport/bean/rank_game_info.dart';
  9. import 'package:sport/bean/user.dart';
  10. import 'package:sport/pages/game/game_detail.dart';
  11. import 'package:sport/pages/game/rank_detail.dart';
  12. import 'package:sport/pages/game/rank_introduce.dart';
  13. import 'package:sport/pages/game/rank_people_detail.dart';
  14. import 'package:sport/pages/home/duration_page.dart';
  15. import 'package:sport/pages/home/duration_setting_page.dart';
  16. import 'package:sport/pages/home/sport_detail_page.dart';
  17. import 'package:sport/pages/home/sport_history_page.dart';
  18. import 'package:sport/pages/home/target_modify_page.dart';
  19. import 'package:sport/pages/home_page.dart';
  20. import 'package:sport/pages/login/auth_code.dart';
  21. import 'package:sport/pages/login/basic.dart';
  22. import 'package:sport/pages/login/find_password.dart';
  23. import 'package:sport/pages/login/index.dart';
  24. import 'package:sport/pages/login/license.dart';
  25. import 'package:sport/pages/login/register.dart';
  26. import 'package:sport/pages/my/device_info_page.dart';
  27. import 'package:sport/pages/my/user_info_page.dart';
  28. import 'package:sport/pages/setting/account_page.dart';
  29. import 'package:sport/pages/setting/message_setting_page.dart';
  30. import 'package:sport/pages/setting/privacypolicy_page.dart';
  31. import 'package:sport/pages/setting/serviceagreement_page.dart';
  32. import 'package:sport/pages/setting/setting_page.dart';
  33. import 'package:sport/pages/social/post_detail_page.dart';
  34. import 'package:sport/pages/social/post_page.dart';
  35. import 'package:sport/pages/social/social_detail_page.dart';
  36. import 'package:sport/pages/social/user_detail_page.dart';
  37. import 'package:sport/pages/splash_page.dart';
  38. import 'package:sport/pages/game/index.dart';
  39. import 'package:sport/bean/forum.dart';
  40. import 'package:sport/services/Converter.dart';
  41. var splashHandler = new Handler(
  42. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  43. return SplashPage();
  44. });
  45. var homeHandler = new Handler(
  46. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  47. return HomePage();
  48. });
  49. // setting
  50. var settingHandler = new Handler(
  51. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  52. return SettingPage();
  53. });
  54. var privacypolicyHandler = new Handler(
  55. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  56. return PrivacypolicyPage();
  57. });
  58. var serviceagreementHandler = new Handler(
  59. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  60. return ServiceagreementPage();
  61. });
  62. var accountHandler = new Handler(
  63. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  64. return AccountPage();
  65. });
  66. var messageSettingHandler = new Handler(
  67. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  68. return MessageSettingPage();
  69. });
  70. var userInfoHandler = new Handler(
  71. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  72. return UserInfoPage();
  73. });
  74. var deviceInfoHandler = new Handler(
  75. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  76. return DeviceInfoPage();
  77. });
  78. // social
  79. var socialDetailHandler = new Handler(
  80. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  81. return SocialDetailPage(
  82. Forum.fromJson(json.decode(params['data']!.first.toString())),
  83. index: Converter.toInt(params['index']?.first ?? 0),
  84. );
  85. });
  86. var socialPostHandler = new Handler(
  87. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  88. return PostPage(params['id']!.first.toString());
  89. });
  90. var socialPostDetailHandler = new Handler(
  91. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  92. return PostDetailPage(Post.fromJson(json.decode(params['data']!.first.toString())),
  93. params['comment']?.first.toString() == "true", null);
  94. });
  95. var socialUserDetailHandler = new Handler(
  96. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  97. return UserDetailPage(PostUser.fromJson(json.decode(params['data']!.first.toString())));
  98. });
  99. // home
  100. var sportDetailHandler = new Handler(
  101. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  102. return SportDetailPage();
  103. });
  104. var sportHistoryHandler = new Handler(
  105. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  106. return SportHistoryPage(
  107. GameInfoData.fromJson(json.decode(params['details']!.first.toString())));
  108. });
  109. var targetModifyHandler = new Handler(
  110. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  111. // return TargetModifyPage();
  112. return DurationSettingPage();
  113. });
  114. // game
  115. var gameIndexHandler = new Handler(
  116. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  117. return GamePage();
  118. });
  119. var gameDetailsHandler = new Handler(
  120. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  121. // print(params['details'].first);
  122. return GameDetailsPage(
  123. GameInfoData.fromJson(json.decode(params['details']!.first.toString())));
  124. });
  125. var rankPeopleDetailsHandler = new Handler(
  126. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  127. return RankPeopleDetailsPage(
  128. User.fromJson(json.decode(params['details']!.first.toString())));
  129. });
  130. var loginHandler = new Handler(
  131. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  132. if (params != null) {
  133. if (params.containsKey("type")) {
  134. return Login(Converter.toInt(params['type']!.first.toString()));
  135. }
  136. }
  137. return Login(1);
  138. });
  139. var licenseHandler = new Handler(
  140. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  141. return SportLicensePage();
  142. });
  143. var authCodeHandler = new Handler(
  144. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  145. return AuthCodePage(params['phone']!.first.toString());
  146. });
  147. var registerHandler = new Handler(
  148. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  149. return RegisterPage();
  150. });
  151. var basicHandler = new Handler(
  152. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  153. return BasicInfoPage(username: params['username']!.first.toString());
  154. });
  155. var findPasswordHandler = new Handler(
  156. handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  157. return FindPasswordPage();
  158. });