community_page_router.dart 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. import 'package:auto_route/auto_route.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:router/ext/auto_router_extensions.dart';
  4. import 'package:router/path/router_path.dart';
  5. import '../../modules/community/community_page.dart';
  6. import '../../modules/community/news/news_page.dart';
  7. import '../../modules/community/following/following_page.dart';
  8. import '../../modules/community/foryou/foryou_page.dart';
  9. import '../../modules/community/newsfeed_detail/newsfeed_detail_page.dart';
  10. import '../../modules/community/newsfeed_post/newsfeed_post_page.dart';
  11. // import '../../modules/community/newsfeed_myposts/newsfeed_myposts_page.dart';
  12. import '../../modules/garage/for_sale/for_sale_page.dart';
  13. import '../../modules/garage/for_rent/for_rent_page.dart';
  14. import '../../modules/garage/garagesale_detail/garagesale_detail_page.dart';
  15. import '../../modules/garage/garagesale_post/garagesale_post_page.dart';
  16. // import '../../modules/garage/garagesale_myposts/garagesale_myposts_page.dart';
  17. import '../../modules/my_posts/my_posts_page.dart';
  18. import '../../modules/my_posts/my_posts_newsfeed/my_posts_newsfeed_page.dart';
  19. import '../../modules/my_posts/my_posts_forrent/my_posts_forrent_page.dart';
  20. import '../../modules/my_posts/my_posts_forsale/my_posts_forsale_page.dart';
  21. import '../../modules/my_following/my_following_page.dart';
  22. import '../../modules/my_following/my_follow/my_follow_page.dart';
  23. import '../../modules/my_following/my_follower/my_follower_page.dart';
  24. part 'community_page_router.gr.dart';
  25. /*\
  26. * Community组件的路由
  27. */
  28. @AutoRouterConfig(replaceInRouteName: 'Page|Screen,PageRoute')
  29. class CommunityPageRouter extends _$CommunityPageRouter {
  30. @override
  31. List<AutoRoute> get routes => [
  32. CustomRoute(
  33. page: CommunityPageRoute.page,
  34. path: RouterPath.community,
  35. transitionsBuilder: applySlideTransition,
  36. children: [
  37. // newsfeed-news page
  38. CustomRoute(
  39. page: NewsPageRoute.page,
  40. path: RouterPath.newsfeedNews,
  41. transitionsBuilder: applySlideTransition,
  42. ),
  43. // newsfeed-following page
  44. CustomRoute(
  45. page: FollowingPageRoute.page,
  46. path: RouterPath.newsfeedFollowing,
  47. transitionsBuilder: applySlideTransition,
  48. ),
  49. // newsfeed-foryou page
  50. CustomRoute(
  51. page: ForyouPageRoute.page,
  52. path: RouterPath.newsfeedForYou,
  53. transitionsBuilder: applySlideTransition,
  54. ),
  55. CustomRoute(
  56. page: ForsalePageRoute.page,
  57. path: RouterPath.garageForSale,
  58. transitionsBuilder: applySlideTransition,
  59. ),
  60. // garageSale-forRent page
  61. CustomRoute(
  62. page: ForrentPageRoute.page,
  63. path: RouterPath.garageForRent,
  64. transitionsBuilder: applySlideTransition,
  65. )
  66. ],
  67. ),
  68. CustomRoute(
  69. page: NewsfeedPostPageRoute.page,
  70. path: RouterPath.newsFeedPost,
  71. transitionsBuilder: applySlideTransition,
  72. ),
  73. CustomRoute(
  74. page: NewsfeedDetailPageRoute.page,
  75. path: "${RouterPath.newsFeedDetail}:id/:type",
  76. transitionsBuilder: applySlideTransition,
  77. ),
  78. // Garage
  79. CustomRoute(
  80. page: GaragesalePostPageRoute.page,
  81. path: RouterPath.garageSalePost,
  82. transitionsBuilder: applySlideTransition,
  83. ),
  84. CustomRoute(
  85. page: GaragesaleDetailPageRoute.page,
  86. path: RouterPath.garageSaleDetail,
  87. transitionsBuilder: applySlideTransition,
  88. ),
  89. CustomRoute(
  90. page: MyPostsPageRoute.page,
  91. path: RouterPath.myPosts,
  92. transitionsBuilder: applySlideTransition,
  93. children: [
  94. // newsfeed
  95. CustomRoute(
  96. page: MyPostsNewsfeedPageRoute.page,
  97. path: RouterPath.garageForSale,
  98. transitionsBuilder: applySlideTransition,
  99. ),
  100. // for sale
  101. CustomRoute(
  102. page: MyPostsForSalePageRoute.page,
  103. path: RouterPath.myPostsForSale,
  104. transitionsBuilder: applySlideTransition,
  105. ),
  106. // for rent
  107. CustomRoute(
  108. page: MyPostsForRentPageRoute.page,
  109. path: RouterPath.myPostsForRent,
  110. transitionsBuilder: applySlideTransition,
  111. )
  112. ]
  113. ),
  114. CustomRoute(
  115. page: MyFollowingPageRoute.page,
  116. path: RouterPath.myFollowing,
  117. transitionsBuilder: applySlideTransition,
  118. children: [
  119. CustomRoute(
  120. page: MyFollowPageRoute.page,
  121. path: RouterPath.myFollowingFollow,
  122. transitionsBuilder: applySlideTransition,
  123. ),
  124. CustomRoute(
  125. page: MyFollowerPageRoute.page,
  126. path: RouterPath.myFollowingFollower,
  127. transitionsBuilder: applySlideTransition,
  128. ),
  129. ]
  130. ),
  131. ];
  132. }