|
| 1 | +/* |
| 2 | + * @Author: LinXunFeng [email protected] |
| 3 | + * @Repo: https://github.com/fluttercandies/flutter_scrollview_observer |
| 4 | + * @Date: 2025-08-02 15:49:38 |
| 5 | + */ |
| 6 | + |
| 7 | +import 'package:flutter/foundation.dart'; |
| 8 | +import 'package:flutter/material.dart'; |
| 9 | +import 'package:go_router/go_router.dart'; |
| 10 | +import 'package:scrollview_observer_example/common/route/route.dart'; |
| 11 | +import 'package:scrollview_observer_example/features/custom_scrollview/custom_scrollview_demo/custom_scrollview_center_demo_page.dart'; |
| 12 | +import 'package:scrollview_observer_example/features/custom_scrollview/custom_scrollview_demo/custom_scrollview_demo_page.dart'; |
| 13 | +import 'package:scrollview_observer_example/features/custom_scrollview/custom_scrollview_demo/multi_sliver_demo_page.dart'; |
| 14 | +import 'package:scrollview_observer_example/features/custom_scrollview/sliver_appbar_demo/sliver_appbar_demo_page.dart'; |
| 15 | +import 'package:scrollview_observer_example/features/gridview/gridview_ctx_demo/gridview_ctx_demo_page.dart'; |
| 16 | +import 'package:scrollview_observer_example/features/gridview/gridview_custom_demo/gridview_custom_demo_page.dart'; |
| 17 | +import 'package:scrollview_observer_example/features/gridview/gridview_demo/gridview_demo_page.dart'; |
| 18 | +import 'package:scrollview_observer_example/features/gridview/gridview_fixed_height_demo/gridview_fixed_height_demo_page.dart'; |
| 19 | +import 'package:scrollview_observer_example/features/gridview/horizontal_gridview_demo/horizontal_gridview_demo_page.dart'; |
| 20 | +import 'package:scrollview_observer_example/features/gridview/sliver_grid_demo/sliver_grid_demo_page.dart'; |
| 21 | +import 'package:scrollview_observer_example/features/home/home_page.dart'; |
| 22 | +import 'package:scrollview_observer_example/features/listview/horizontal_listview_demo/horizontal_listview_page.dart'; |
| 23 | +import 'package:scrollview_observer_example/features/listview/infinite_listview_demo/infinite_listview_page.dart'; |
| 24 | +import 'package:scrollview_observer_example/features/listview/listview_ctx_demo/listview_ctx_demo_page.dart'; |
| 25 | +import 'package:scrollview_observer_example/features/listview/listview_custom_demo/listview_custom_demo_page.dart'; |
| 26 | +import 'package:scrollview_observer_example/features/listview/listview_demo/listview_demo_page.dart'; |
| 27 | +import 'package:scrollview_observer_example/features/listview/listview_dynamic_offset/listview_dynamic_offset_page.dart'; |
| 28 | +import 'package:scrollview_observer_example/features/listview/listview_fixed_height_demo/listview_fixed_height_demo_page.dart'; |
| 29 | +import 'package:scrollview_observer_example/features/listview/sliver_list_demo/sliver_list_demo_page.dart'; |
| 30 | +import 'package:scrollview_observer_example/features/pageview/pageview_demo/pageview_demo_page.dart'; |
| 31 | +import 'package:scrollview_observer_example/features/pageview/pageview_demo/pageview_parallax_item_listener_page.dart'; |
| 32 | +import 'package:scrollview_observer_example/features/pageview/pageview_demo/pageview_parallax_page.dart'; |
| 33 | +import 'package:scrollview_observer_example/features/scene/anchor_demo/anchor_page.dart'; |
| 34 | +import 'package:scrollview_observer_example/features/scene/anchor_demo/anchor_waterfall_page.dart'; |
| 35 | +import 'package:scrollview_observer_example/features/scene/azlist_demo/azlist_page.dart'; |
| 36 | +import 'package:scrollview_observer_example/features/scene/chat_demo/page/chat_gpt_page.dart'; |
| 37 | +import 'package:scrollview_observer_example/features/scene/chat_demo/page/chat_page.dart'; |
| 38 | +import 'package:scrollview_observer_example/features/scene/expandable_carousel_slider_demo/expandable_carousel_slider_demo.dart'; |
| 39 | +import 'package:scrollview_observer_example/features/scene/image_tab_demo/image_tab_page.dart'; |
| 40 | +import 'package:scrollview_observer_example/features/scene/scrollview_form_demo/scrollview_form_demo_page.dart'; |
| 41 | +import 'package:scrollview_observer_example/features/scene/video_auto_play_list/video_list_auto_play_page.dart'; |
| 42 | +import 'package:scrollview_observer_example/features/scene/visibility_demo/page/visibility_listview_page.dart'; |
| 43 | +import 'package:scrollview_observer_example/features/scene/visibility_demo/page/visibility_scrollview_page.dart'; |
| 44 | +import 'package:scrollview_observer_example/features/scene/waterfall_flow_demo/waterfall_flow_page.dart'; |
| 45 | +import 'package:scrollview_observer_example/features/scene/waterfall_flow_fixed_height_demo/waterfall_flow_fixed_height_page.dart'; |
| 46 | + |
| 47 | +class MyPage { |
| 48 | + static const home = '/home'; |
| 49 | + // ListView |
| 50 | + static const listView = '/list_view'; |
| 51 | + static const listViewContext = '/list_view_context'; |
| 52 | + static const listViewFixedHeight = '/list_view_fixed_height'; |
| 53 | + static const listViewHorizontal = '/list_view_horizontal'; |
| 54 | + static const listViewDynamicOffset = '/list_view_dynamic_offset'; |
| 55 | + static const listViewCustom = '/list_view_custom'; |
| 56 | + static const listViewInfinite = '/list_view_infinite'; |
| 57 | + static const sliverListView = '/sliver_list_view'; |
| 58 | + // GridView |
| 59 | + static const gridView = '/grid_view'; |
| 60 | + static const gridViewContext = '/grid_view_context'; |
| 61 | + static const gridViewFixedHeight = '/grid_view_fixed_height'; |
| 62 | + static const gridViewHorizontal = '/grid_view_horizontal'; |
| 63 | + static const gridViewCustom = '/grid_view_custom'; |
| 64 | + static const sliverGridView = '/sliver_grid_view'; |
| 65 | + // CustomScrollView |
| 66 | + static const customScrollView = '/custom_scroll_view'; |
| 67 | + static const customScrollViewCenter = '/custom_scroll_view_center'; |
| 68 | + static const multiSliver = '/multi_sliver'; |
| 69 | + static const sliverAppBar = '/sliver_app_bar'; |
| 70 | + // NestedScrollView |
| 71 | + static const nestedScrollView = '/nested_scroll_view'; |
| 72 | + // PageView |
| 73 | + static const pageView = '/page_view'; |
| 74 | + static const pageViewParallax = '/page_view_parallax'; |
| 75 | + static const pageViewParallaxItemListener = |
| 76 | + '/page_view_parallax_item_listener'; |
| 77 | + // Scene |
| 78 | + static const videoListAutoPlay = '/video_list_auto_play'; |
| 79 | + static const anchorList = '/anchor_list'; |
| 80 | + static const anchorWaterfall = '/anchor_waterfall'; |
| 81 | + static const imageTab = '/image_tab'; |
| 82 | + static const chat = '/chat'; |
| 83 | + static const chatGPT = '/chat_gpt'; |
| 84 | + static const waterfallFlow = '/waterfall_flow'; |
| 85 | + static const waterfallFlowFixedHeight = '/waterfall_flow_fixed_height'; |
| 86 | + static const scrollViewForm = '/scroll_view_form'; |
| 87 | + static const visibilityListView = '/visibility_list_view'; |
| 88 | + static const visibilityScrollView = '/visibility_scroll_view'; |
| 89 | + static const azList = '/az_list'; |
| 90 | + static const expandableCarouselSlider = '/expandable_carousel_slider'; |
| 91 | +} |
| 92 | + |
| 93 | +class MyRoute { |
| 94 | + static final observer = RouteObserver<ModalRoute>(); |
| 95 | + |
| 96 | + static final routerConfig = GoRouter( |
| 97 | + routes: routes, |
| 98 | + initialLocation: MyPage.home, |
| 99 | + observers: [ |
| 100 | + observer, |
| 101 | + ], |
| 102 | + navigatorKey: NavigationService.navigatorKey, |
| 103 | + debugLogDiagnostics: !kReleaseMode, |
| 104 | + ); |
| 105 | + |
| 106 | + static final List<RouteBase> routes = [ |
| 107 | + GoRoute( |
| 108 | + path: MyPage.home, |
| 109 | + builder: (context, state) => const HomePage(), |
| 110 | + ), |
| 111 | + GoRoute( |
| 112 | + path: MyPage.listView, |
| 113 | + builder: (context, state) => const ListViewDemoPage(), |
| 114 | + ), |
| 115 | + GoRoute( |
| 116 | + path: MyPage.listViewContext, |
| 117 | + builder: (context, state) => const ListViewCtxDemoPage(), |
| 118 | + ), |
| 119 | + GoRoute( |
| 120 | + path: MyPage.listViewFixedHeight, |
| 121 | + builder: (context, state) => const ListViewFixedHeightDemoPage(), |
| 122 | + ), |
| 123 | + GoRoute( |
| 124 | + path: MyPage.listViewHorizontal, |
| 125 | + builder: (context, state) => const HorizontalListViewPage(), |
| 126 | + ), |
| 127 | + GoRoute( |
| 128 | + path: MyPage.listViewDynamicOffset, |
| 129 | + builder: (context, state) => const ListViewDynamicOffsetPage(), |
| 130 | + ), |
| 131 | + GoRoute( |
| 132 | + path: MyPage.listViewCustom, |
| 133 | + builder: (context, state) => const ListViewCustomDemoPage(), |
| 134 | + ), |
| 135 | + GoRoute( |
| 136 | + path: MyPage.listViewInfinite, |
| 137 | + builder: (context, state) => const InfiniteListViewPage(), |
| 138 | + ), |
| 139 | + GoRoute( |
| 140 | + path: MyPage.sliverListView, |
| 141 | + builder: (context, state) => const SliverListViewDemoPage(), |
| 142 | + ), |
| 143 | + GoRoute( |
| 144 | + path: MyPage.gridView, |
| 145 | + builder: (context, state) => const GridViewDemoPage(), |
| 146 | + ), |
| 147 | + GoRoute( |
| 148 | + path: MyPage.gridViewContext, |
| 149 | + builder: (context, state) => const GridViewCtxDemoPage(), |
| 150 | + ), |
| 151 | + GoRoute( |
| 152 | + path: MyPage.gridViewFixedHeight, |
| 153 | + builder: (context, state) => const GridViewFixedHeightDemoPage(), |
| 154 | + ), |
| 155 | + GoRoute( |
| 156 | + path: MyPage.gridViewHorizontal, |
| 157 | + builder: (context, state) => const HorizontalGridViewDemoPage(), |
| 158 | + ), |
| 159 | + GoRoute( |
| 160 | + path: MyPage.gridViewCustom, |
| 161 | + builder: (context, state) => const GridViewCustomDemoPage(), |
| 162 | + ), |
| 163 | + GoRoute( |
| 164 | + path: MyPage.sliverGridView, |
| 165 | + builder: (context, state) => const SliverGridViewDemoPage(), |
| 166 | + ), |
| 167 | + GoRoute( |
| 168 | + path: MyPage.customScrollView, |
| 169 | + builder: (context, state) => const CustomScrollViewDemoPage(), |
| 170 | + ), |
| 171 | + GoRoute( |
| 172 | + path: MyPage.customScrollViewCenter, |
| 173 | + builder: (context, state) => const CustomScrollViewCenterDemoPage(), |
| 174 | + ), |
| 175 | + GoRoute( |
| 176 | + path: MyPage.multiSliver, |
| 177 | + builder: (context, state) => const MultiSliverDemoPage(), |
| 178 | + ), |
| 179 | + GoRoute( |
| 180 | + path: MyPage.sliverAppBar, |
| 181 | + builder: (context, state) => const SliverAppBarDemoPage(), |
| 182 | + ), |
| 183 | + GoRoute( |
| 184 | + path: MyPage.nestedScrollView, |
| 185 | + builder: (context, state) => const SliverAppBarDemoPage(), |
| 186 | + ), |
| 187 | + GoRoute( |
| 188 | + path: MyPage.pageView, |
| 189 | + builder: (context, state) => const PageViewDemoPage(), |
| 190 | + ), |
| 191 | + GoRoute( |
| 192 | + path: MyPage.pageViewParallax, |
| 193 | + builder: (context, state) => const PageViewParallaxPage(), |
| 194 | + ), |
| 195 | + GoRoute( |
| 196 | + path: MyPage.pageViewParallaxItemListener, |
| 197 | + builder: (context, state) => const PageViewParallaxItemListenerPage(), |
| 198 | + ), |
| 199 | + GoRoute( |
| 200 | + path: MyPage.videoListAutoPlay, |
| 201 | + builder: (context, state) => const VideoListAutoPlayPage(), |
| 202 | + ), |
| 203 | + GoRoute( |
| 204 | + path: MyPage.anchorList, |
| 205 | + builder: (context, state) => const AnchorListPage(), |
| 206 | + ), |
| 207 | + GoRoute( |
| 208 | + path: MyPage.anchorWaterfall, |
| 209 | + builder: (context, state) => const AnchorWaterfallPage(), |
| 210 | + ), |
| 211 | + GoRoute( |
| 212 | + path: MyPage.imageTab, |
| 213 | + builder: (context, state) => const ImageTabPage(), |
| 214 | + ), |
| 215 | + GoRoute( |
| 216 | + path: MyPage.chat, |
| 217 | + builder: (context, state) => const ChatPage(), |
| 218 | + ), |
| 219 | + GoRoute( |
| 220 | + path: MyPage.chatGPT, |
| 221 | + builder: (context, state) => const ChatGPTPage(), |
| 222 | + ), |
| 223 | + GoRoute( |
| 224 | + path: MyPage.waterfallFlow, |
| 225 | + builder: (context, state) => const WaterfallFlowPage(), |
| 226 | + ), |
| 227 | + GoRoute( |
| 228 | + path: MyPage.waterfallFlowFixedHeight, |
| 229 | + builder: (context, state) => const WaterfallFlowFixedHeightPage(), |
| 230 | + ), |
| 231 | + GoRoute( |
| 232 | + path: MyPage.scrollViewForm, |
| 233 | + builder: (context, state) => const ScrollViewFormDemoPage(), |
| 234 | + ), |
| 235 | + GoRoute( |
| 236 | + path: MyPage.visibilityListView, |
| 237 | + builder: (context, state) => const VisibilityListViewPage(), |
| 238 | + ), |
| 239 | + GoRoute( |
| 240 | + path: MyPage.visibilityScrollView, |
| 241 | + builder: (context, state) => const VisibilityScrollViewPage(), |
| 242 | + ), |
| 243 | + GoRoute( |
| 244 | + path: MyPage.azList, |
| 245 | + builder: (context, state) => const AzListPage(), |
| 246 | + ), |
| 247 | + GoRoute( |
| 248 | + path: MyPage.expandableCarouselSlider, |
| 249 | + builder: (context, state) => const ExpandableCarouselSliderDemo(), |
| 250 | + ), |
| 251 | + ]; |
| 252 | +} |
0 commit comments