route_handles.dart 6.5 KB

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