main.dart 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817
  1. import 'package:easy_refresh/easy_refresh.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_riverpod/flutter_riverpod.dart';
  4. import 'package:flutter_screenutil/flutter_screenutil.dart';
  5. import 'package:go_router/go_router.dart';
  6. import 'package:news_app/event/logout_event.dart';
  7. import 'package:news_app/provider/global_theme_provider.dart';
  8. import 'package:news_app/provider/global_user_provider.dart';
  9. import 'package:news_app/provider/gray_provider.dart';
  10. import 'package:news_app/provider/main_provider.dart';
  11. import 'package:news_app/ui/activity/activity_detail_page.dart';
  12. import 'package:news_app/ui/activity/main_activity_page.dart';
  13. import 'package:news_app/ui/login/login_register_page.dart';
  14. import 'package:news_app/ui/login/privacy_agreement_page.dart';
  15. import 'package:news_app/ui/login/splash_page.dart';
  16. import 'package:news_app/ui/me/edit_user_profile_page.dart';
  17. import 'package:news_app/ui/me/main_user_page.dart';
  18. import 'package:news_app/ui/me/msg_center_page.dart';
  19. import 'package:news_app/ui/me/setting_page.dart';
  20. import 'package:news_app/ui/me/user_activity_page.dart';
  21. import 'package:news_app/ui/me/user_change_password.dart';
  22. import 'package:news_app/ui/me/user_favorite_page.dart';
  23. import 'package:news_app/ui/me/user_feedback_page.dart';
  24. import 'package:news_app/ui/me/user_read_history_page.dart';
  25. import 'package:news_app/ui/me/user_score_page.dart';
  26. import 'package:news_app/ui/me/user_share_page.dart';
  27. import 'package:news_app/ui/me/user_shop_page.dart';
  28. import 'package:news_app/ui/news/main_news_page.dart';
  29. import 'package:news_app/ui/news/news_detail_page.dart';
  30. import 'package:news_app/ui/news/special_list_page.dart';
  31. import 'package:news_app/ui/search/activity_search_page.dart';
  32. import 'package:news_app/ui/search/search_result_page.dart';
  33. import 'package:news_app/ui/search/video_search_page.dart';
  34. import 'package:news_app/ui/topic/main_topic_page.dart';
  35. import 'package:news_app/ui/topic/topic_detail_page.dart';
  36. import 'package:news_app/ui/topic/topic_list_page.dart';
  37. import 'package:news_app/ui/video/main_video_page.dart';
  38. import 'package:news_app/ui/video/video_detail_page.dart';
  39. import 'package:news_app/util/log.util.dart';
  40. import 'package:news_app/util/shared_prefs_instance_util.dart';
  41. import 'package:news_app/util/theme_util.dart';
  42. import 'constant/config.dart';
  43. import 'gen/assets.gen.dart';
  44. import 'http/http_util.dart';
  45. import 'model/user_model.dart';
  46. /// @author: bo.zeng
  47. /// @email: cnhbwds@gmail.com
  48. /// @date: 2025 2025/4/9 16:00
  49. /// @description:
  50. void _initBeforeApp() async {
  51. WidgetsFlutterBinding.ensureInitialized();
  52. //全局配置 Dio
  53. HttpUtil();
  54. // 全局配置EasyRefresh
  55. EasyRefresh.defaultHeaderBuilder =
  56. () => ClassicHeader(
  57. dragText: '下拉刷新',
  58. armedText: '释放刷新',
  59. readyText: '正在刷新...',
  60. processingText: '刷新中...',
  61. processedText: '刷新完成',
  62. noMoreText: '没有更多数据',
  63. failedText: '刷新失败',
  64. messageText: '最后更新于 %T',
  65. messageStyle: TextStyle(color: Colors.grey[500], fontSize: 12),
  66. textStyle: TextStyle(color: Colors.grey[700], fontSize: 13),
  67. );
  68. EasyRefresh.defaultFooterBuilder =
  69. () => ClassicFooter(
  70. dragText: '上拉加载',
  71. armedText: '释放加载',
  72. readyText: '准备加载...',
  73. processingText: '加载中...',
  74. processedText: '加载完成',
  75. noMoreText: '没有更多数据了',
  76. failedText: '加载失败',
  77. messageText: '最后加载于 %T',
  78. messageStyle: TextStyle(color: Colors.grey[500], fontSize: 12),
  79. textStyle: TextStyle(color: Colors.grey[700], fontSize: 13),
  80. );
  81. // 初始化全局 SharedPreferences
  82. await initSharedPrefs();
  83. }
  84. final grayProvider = NotifierProvider<GrayProvider, bool>(() => GrayProvider());
  85. void main() {
  86. _initBeforeApp();
  87. runApp(ProviderScope(child: const MyApp()));
  88. }
  89. final globalThemeProvider = NotifierProvider<GlobalThemeNotifier, ThemeMode>(
  90. () {
  91. return GlobalThemeNotifier();
  92. },
  93. );
  94. final globalUserProvider = NotifierProvider<GlobalUserNotifier, UserModel>(() {
  95. return GlobalUserNotifier();
  96. });
  97. class MyApp extends ConsumerWidget {
  98. const MyApp({super.key});
  99. @override
  100. Widget build(BuildContext context, WidgetRef ref) {
  101. ref.read(grayProvider.notifier).fetchGray();
  102. bool gray = ref.watch(grayProvider);
  103. return ScreenUtilInit(
  104. designSize: const Size(375, 812),
  105. splitScreenMode: true,
  106. //支持分屏尺寸
  107. minTextAdapt: true,
  108. //否根据宽度/高度中的最小值适配文字
  109. builder: (context, child) {
  110. return gray
  111. ? ColorFiltered(
  112. colorFilter: ColorFilter.matrix(<double>[
  113. 0.2126, 0.7152, 0.0722, 0, 0, // R
  114. 0.2126, 0.7152, 0.0722, 0, 0, // G
  115. 0.2126, 0.7152, 0.0722, 0, 0, // B
  116. 0, 0, 0, 1, 0, // A
  117. ]),
  118. child: MaterialApp.router(
  119. debugShowCheckedModeBanner: false,
  120. theme: lightTheme,
  121. // 白天模式
  122. darkTheme: darkTheme,
  123. // 黑夜模式
  124. themeMode: ref.watch(globalThemeProvider),
  125. routerConfig: _routerConfig,
  126. ),
  127. )
  128. : MaterialApp.router(
  129. debugShowCheckedModeBanner: false,
  130. theme: lightTheme,
  131. // 白天模式
  132. darkTheme: darkTheme,
  133. // 黑夜模式
  134. themeMode: ref.watch(globalThemeProvider),
  135. routerConfig: _routerConfig,
  136. );
  137. },
  138. );
  139. }
  140. }
  141. class MainPage extends ConsumerStatefulWidget {
  142. const MainPage({super.key});
  143. @override
  144. ConsumerState<MainPage> createState() => _MainPageState();
  145. }
  146. class _MainPageState extends ConsumerState<MainPage> {
  147. late PageController _pageController;
  148. void _requestUserInfo() async {
  149. uuid = await getUuid() ?? "";
  150. // 获取用户信息
  151. await ref.read(globalUserProvider.notifier).fetchUserInfo();
  152. }
  153. @override
  154. void initState() {
  155. super.initState();
  156. _requestUserInfo();
  157. _pageController = PageController(initialPage: 0);
  158. _registerEventBus();
  159. }
  160. void _registerEventBus() {
  161. eventBus.on<LogoutEvent>().listen((event) {
  162. consoleLog("用户退出了");
  163. ref.read(globalUserProvider.notifier).clearUserInfo();
  164. ref.invalidate(globalUserProvider);
  165. if (event.jumLogin) {
  166. final currentLocation =
  167. _routerConfig.routerDelegate.state.matchedLocation;
  168. consoleLog(currentLocation);
  169. //如果在首页,就不跳转
  170. if (currentLocation != "/main") {
  171. rootNavigatorKey.currentContext?.go('/login');
  172. }
  173. } else {
  174. _pageController.jumpToPage(0);
  175. ref.read(mainPageProvider.notifier).changeNavIndex(0);
  176. }
  177. });
  178. }
  179. @override
  180. void dispose() {
  181. super.dispose();
  182. _pageController.dispose();
  183. }
  184. final mainPageProvider = NotifierProvider<MainPageProvider, int>(() {
  185. return MainPageProvider();
  186. });
  187. @override
  188. Widget build(BuildContext context) {
  189. return Scaffold(
  190. body: PageView(
  191. scrollDirection: Axis.horizontal,
  192. controller: _pageController,
  193. physics: const NeverScrollableScrollPhysics(),
  194. children: [
  195. MainNewsPage(),
  196. MainActivityPage(),
  197. MainVideoPage(),
  198. // MainTopicPage(),
  199. MainUserPage(),
  200. ],
  201. ),
  202. bottomNavigationBar: BottomNavigationBar(
  203. elevation: 10,
  204. type: BottomNavigationBarType.fixed,
  205. selectedItemColor: Colors.blue,
  206. unselectedItemColor: Colors.grey,
  207. currentIndex: ref.watch(mainPageProvider),
  208. items: [
  209. BottomNavigationBarItem(
  210. icon: Image.asset(
  211. Assets.images.navNewsUnselect.path,
  212. width: 20.w,
  213. height: 20.w,
  214. ),
  215. label: "新闻",
  216. activeIcon: Image.asset(
  217. Assets.images.navNewsSelect.path,
  218. width: 20.w,
  219. height: 20.w,
  220. ),
  221. ),
  222. BottomNavigationBarItem(
  223. icon: Image.asset(
  224. Assets.images.navActivityUnselect.path,
  225. width: 20.w,
  226. height: 20.w,
  227. ),
  228. activeIcon: Image.asset(
  229. Assets.images.navActivitySelect.path,
  230. width: 20.w,
  231. height: 20.w,
  232. ),
  233. label: "活动",
  234. ),
  235. BottomNavigationBarItem(
  236. icon: Image.asset(
  237. Assets.images.navVideoUnselect.path,
  238. width: 20.w,
  239. height: 20.w,
  240. ),
  241. label: "视频",
  242. activeIcon: Image.asset(
  243. Assets.images.navVideoSelect.path,
  244. width: 20.w,
  245. height: 20.w,
  246. ),
  247. ),
  248. // BottomNavigationBarItem(
  249. // icon: Image.asset(
  250. // Assets.images.navTopicUnselect.path,
  251. // width: 20.w,
  252. // height: 20.w,
  253. // ),
  254. // label: "话题",
  255. // activeIcon: Image.asset(
  256. // Assets.images.navTopicSelect.path,
  257. // width: 20.w,
  258. // height: 20.w,
  259. // ),
  260. // ),
  261. BottomNavigationBarItem(
  262. icon: Image.asset(
  263. Assets.images.navUserUnselect.path,
  264. width: 20.w,
  265. height: 20.w,
  266. ),
  267. label: "我的",
  268. activeIcon: Image.asset(
  269. Assets.images.navUserSelect.path,
  270. width: 20.w,
  271. height: 20.w,
  272. ),
  273. ),
  274. ],
  275. onTap: (index) {
  276. if (index == 3 && uuid.isEmpty) {
  277. context.push('/login');
  278. return;
  279. }
  280. _pageController.jumpToPage(index);
  281. ref.read(mainPageProvider.notifier).changeNavIndex(index);
  282. },
  283. ),
  284. );
  285. }
  286. }
  287. /// The route configuration.
  288. final GoRouter _routerConfig = GoRouter(
  289. navigatorKey: rootNavigatorKey,
  290. routes: <RouteBase>[
  291. GoRoute(
  292. path: '/',
  293. builder: (BuildContext context, GoRouterState state) {
  294. return const SplashPage();
  295. },
  296. ),
  297. GoRoute(
  298. path: '/login',
  299. pageBuilder: (context, state) {
  300. return CustomTransitionPage(
  301. key: state.pageKey,
  302. child: LoginRegisterPage(),
  303. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  304. return FadeTransition(
  305. opacity: CurveTween(
  306. curve: Curves.easeInOutCirc,
  307. ).animate(animation),
  308. child: child,
  309. );
  310. },
  311. );
  312. },
  313. ),
  314. // GoRoute(
  315. // path: '/login',
  316. // builder: (BuildContext context, GoRouterState state) {
  317. // return const LoginRegisterPage();
  318. // },
  319. // ),
  320. GoRoute(
  321. path: '/main',
  322. builder: (BuildContext context, GoRouterState state) {
  323. return const MainPage();
  324. },
  325. ),
  326. GoRoute(
  327. path: '/news/detail',
  328. pageBuilder: (context, state) {
  329. String contentId = state.extra as String;
  330. return CustomTransitionPage(
  331. key: state.pageKey,
  332. child: NewsDetailPage(contentId),
  333. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  334. return FadeTransition(
  335. opacity: CurveTween(
  336. curve: Curves.easeInOutCirc,
  337. ).animate(animation),
  338. child: child,
  339. );
  340. },
  341. );
  342. },
  343. ),
  344. // GoRoute(
  345. // path: '/news/detail',
  346. // builder: (BuildContext context, GoRouterState state) {
  347. // String contentId = state.extra as String;
  348. // return NewsDetailPage(contentId);
  349. // },
  350. // ),
  351. GoRoute(
  352. path: '/activity/detail',
  353. pageBuilder: (context, state) {
  354. String activityId = state.extra as String;
  355. return CustomTransitionPage(
  356. key: state.pageKey,
  357. child: ActivityDetailPage(activityId),
  358. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  359. return FadeTransition(
  360. opacity: CurveTween(
  361. curve: Curves.easeInOutCirc,
  362. ).animate(animation),
  363. child: child,
  364. );
  365. },
  366. );
  367. },
  368. ),
  369. // GoRoute(
  370. // path: "/activity/detail",
  371. // builder: (BuildContext context, GoRouterState state) {
  372. // String activityId = state.extra as String;
  373. // return ActivityDetailPage(activityId);
  374. // },
  375. // ),
  376. GoRoute(
  377. path: '/video/detail',
  378. pageBuilder: (context, state) {
  379. VideoParam data = state.extra as VideoParam;
  380. // return VideoDetailPage(param: data);
  381. return CustomTransitionPage(
  382. key: state.pageKey,
  383. child: VideoDetailPage(param: data),
  384. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  385. return FadeTransition(
  386. opacity: CurveTween(
  387. curve: Curves.easeInOutCirc,
  388. ).animate(animation),
  389. child: child,
  390. );
  391. },
  392. );
  393. },
  394. ),
  395. // GoRoute(
  396. // path: '/video/detail',
  397. // builder: (BuildContext context, GoRouterState state) {
  398. // VideoParam data = state.extra as VideoParam;
  399. // return VideoDetailPage(param: data);
  400. // },
  401. // ),
  402. GoRoute(
  403. path: '/user/editProfile',
  404. pageBuilder: (context, state) {
  405. return CustomTransitionPage(
  406. key: state.pageKey,
  407. child: EditProfilePage(),
  408. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  409. return FadeTransition(
  410. opacity: CurveTween(
  411. curve: Curves.easeInOutCirc,
  412. ).animate(animation),
  413. child: child,
  414. );
  415. },
  416. );
  417. },
  418. ),
  419. // GoRoute(
  420. // path: '/user/editProfile',
  421. // builder: (BuildContext context, GoRouterState state) {
  422. // return const EditProfilePage();
  423. // },
  424. // ),
  425. GoRoute(
  426. path: '/user/score',
  427. pageBuilder: (context, state) {
  428. return CustomTransitionPage(
  429. key: state.pageKey,
  430. child: UserScorePage(),
  431. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  432. return FadeTransition(
  433. opacity: CurveTween(
  434. curve: Curves.easeInOutCirc,
  435. ).animate(animation),
  436. child: child,
  437. );
  438. },
  439. );
  440. },
  441. ),
  442. // GoRoute(
  443. // path: '/user/score',
  444. // builder: (BuildContext context, GoRouterState state) {
  445. // return const UserScorePage();
  446. // },
  447. // ),
  448. GoRoute(
  449. path: '/user/msgCenter',
  450. pageBuilder: (context, state) {
  451. return CustomTransitionPage(
  452. key: state.pageKey,
  453. child: MsgCenterPage(),
  454. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  455. return FadeTransition(
  456. opacity: CurveTween(
  457. curve: Curves.easeInOutCirc,
  458. ).animate(animation),
  459. child: child,
  460. );
  461. },
  462. );
  463. },
  464. ),
  465. // GoRoute(
  466. // path: '/user/msgCenter',
  467. // builder: (BuildContext context, GoRouterState state) {
  468. // return const MsgCenterPage();
  469. // },
  470. // ),
  471. GoRoute(
  472. path: '/user/favorite',
  473. pageBuilder: (context, state) {
  474. return CustomTransitionPage(
  475. key: state.pageKey,
  476. child: UserFavoritePage(),
  477. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  478. return FadeTransition(
  479. opacity: CurveTween(
  480. curve: Curves.easeInOutCirc,
  481. ).animate(animation),
  482. child: child,
  483. );
  484. },
  485. );
  486. },
  487. ),
  488. // GoRoute(
  489. // path: '/user/favorite',
  490. // builder: (BuildContext context, GoRouterState state) {
  491. // return const UserFavoritePage();
  492. // },
  493. // ),
  494. GoRoute(
  495. path: '/user/readHistory',
  496. pageBuilder: (context, state) {
  497. return CustomTransitionPage(
  498. key: state.pageKey,
  499. child: UserReadHistoryPage(),
  500. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  501. return FadeTransition(
  502. opacity: CurveTween(
  503. curve: Curves.easeInOutCirc,
  504. ).animate(animation),
  505. child: child,
  506. );
  507. },
  508. );
  509. },
  510. ),
  511. // GoRoute(
  512. // path: '/user/readHistory',
  513. // builder: (BuildContext context, GoRouterState state) {
  514. // return const UserReadHistoryPage();
  515. // },
  516. // ),
  517. GoRoute(
  518. path: '/user/setting',
  519. pageBuilder: (context, state) {
  520. return CustomTransitionPage(
  521. key: state.pageKey,
  522. child: SettingPage(),
  523. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  524. return FadeTransition(
  525. opacity: CurveTween(
  526. curve: Curves.easeInOutCirc,
  527. ).animate(animation),
  528. child: child,
  529. );
  530. },
  531. );
  532. },
  533. ),
  534. // GoRoute(
  535. // path: '/user/setting',
  536. // builder: (BuildContext context, GoRouterState state) {
  537. // return const SettingPage();
  538. // },
  539. // ),
  540. GoRoute(
  541. path: '/user/feedback',
  542. pageBuilder: (context, state) {
  543. return CustomTransitionPage(
  544. key: state.pageKey,
  545. child: UserFeedbackPage(),
  546. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  547. return FadeTransition(
  548. opacity: CurveTween(
  549. curve: Curves.easeInOutCirc,
  550. ).animate(animation),
  551. child: child,
  552. );
  553. },
  554. );
  555. },
  556. ),
  557. // GoRoute(
  558. // path: '/user/feedback',
  559. // builder: (BuildContext context, GoRouterState state) {
  560. // return const UserFeedbackPage();
  561. // },
  562. // ),
  563. GoRoute(
  564. path: '/user/share',
  565. pageBuilder: (context, state) {
  566. return CustomTransitionPage(
  567. key: state.pageKey,
  568. child: UserSharePage(),
  569. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  570. return FadeTransition(
  571. opacity: CurveTween(
  572. curve: Curves.easeInOutCirc,
  573. ).animate(animation),
  574. child: child,
  575. );
  576. },
  577. );
  578. },
  579. ),
  580. // GoRoute(
  581. // path: '/user/share',
  582. // builder: (BuildContext context, GoRouterState state) {
  583. // return const UserSharePage();
  584. // },
  585. // ),
  586. GoRoute(
  587. path: '/user/activity',
  588. pageBuilder: (context, state) {
  589. return CustomTransitionPage(
  590. key: state.pageKey,
  591. child: UserActivityPage(),
  592. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  593. return FadeTransition(
  594. opacity: CurveTween(
  595. curve: Curves.easeInOutCirc,
  596. ).animate(animation),
  597. child: child,
  598. );
  599. },
  600. );
  601. },
  602. ),
  603. // GoRoute(
  604. // path: "/user/activity",
  605. // builder: (BuildContext context, GoRouterState state) {
  606. // return UserActivityPage();
  607. // },
  608. // ),
  609. GoRoute(
  610. path: '/topic/list',
  611. pageBuilder: (context, state) {
  612. final contentId = state.extra as String;
  613. return CustomTransitionPage(
  614. key: state.pageKey,
  615. child: TopicListPage(contentId: contentId),
  616. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  617. return FadeTransition(
  618. opacity: CurveTween(
  619. curve: Curves.easeInOutCirc,
  620. ).animate(animation),
  621. child: child,
  622. );
  623. },
  624. );
  625. },
  626. ),
  627. GoRoute(
  628. path: '/topic/detail',
  629. pageBuilder: (context, state) {
  630. final contentId = state.extra as String;
  631. return CustomTransitionPage(
  632. key: state.pageKey,
  633. child: TopicDetailPage(contentId: contentId),
  634. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  635. return FadeTransition(
  636. opacity: CurveTween(
  637. curve: Curves.easeInOutCirc,
  638. ).animate(animation),
  639. child: child,
  640. );
  641. },
  642. );
  643. },
  644. ),
  645. // GoRoute(
  646. // path: "/topic/detail",
  647. // builder: (BuildContext context, GoRouterState state) {
  648. // final contentId = state.extra as String;
  649. // return TopicDetailPage(contentId: contentId);
  650. // },
  651. // ),
  652. GoRoute(
  653. path: '/search',
  654. pageBuilder: (context, state) {
  655. return CustomTransitionPage(
  656. key: state.pageKey,
  657. child: SearchResultPage(),
  658. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  659. return FadeTransition(
  660. opacity: CurveTween(
  661. curve: Curves.easeInOutCirc,
  662. ).animate(animation),
  663. child: child,
  664. );
  665. },
  666. );
  667. },
  668. ),
  669. // GoRoute(
  670. // path: "/search",
  671. // builder: (BuildContext context, GoRouterState state) {
  672. // return SearchResultPage();
  673. // },
  674. // ),
  675. GoRoute(
  676. path: '/video/search',
  677. pageBuilder: (context, state) {
  678. return CustomTransitionPage(
  679. key: state.pageKey,
  680. child: VideoSearchPage(),
  681. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  682. return FadeTransition(
  683. opacity: CurveTween(
  684. curve: Curves.easeInOutCirc,
  685. ).animate(animation),
  686. child: child,
  687. );
  688. },
  689. );
  690. },
  691. ),
  692. // GoRoute(
  693. // path: "/video/search",
  694. // builder: (BuildContext context, GoRouterState state) {
  695. // return VideoSearchPage();
  696. // },
  697. // ),
  698. GoRoute(
  699. path: '/activity/search',
  700. pageBuilder: (context, state) {
  701. return CustomTransitionPage(
  702. key: state.pageKey,
  703. child: ActivitySearchPage(),
  704. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  705. return FadeTransition(
  706. opacity: CurveTween(
  707. curve: Curves.easeInOutCirc,
  708. ).animate(animation),
  709. child: child,
  710. );
  711. },
  712. );
  713. },
  714. ),
  715. // GoRoute(
  716. // path: "/activity/search",
  717. // builder: (BuildContext context, GoRouterState state) {
  718. // return ActivitySearchPage();
  719. // },
  720. // ),
  721. //
  722. GoRoute(
  723. path: '/user/privacy',
  724. pageBuilder: (context, state) {
  725. return CustomTransitionPage(
  726. key: state.pageKey,
  727. child: PrivacyAgreementPage(),
  728. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  729. return FadeTransition(
  730. opacity: CurveTween(
  731. curve: Curves.easeInOutCirc,
  732. ).animate(animation),
  733. child: child,
  734. );
  735. },
  736. );
  737. },
  738. ),
  739. // GoRoute(
  740. // path: "/user/privacy",
  741. // builder: (BuildContext context, GoRouterState state) {
  742. // return PrivacyAgreementPage();
  743. // },
  744. // ),
  745. GoRoute(
  746. path: '/user/changePassword',
  747. pageBuilder: (context, state) {
  748. return CustomTransitionPage(
  749. key: state.pageKey,
  750. child: UserChangePassword(),
  751. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  752. return FadeTransition(
  753. opacity: CurveTween(
  754. curve: Curves.easeInOutCirc,
  755. ).animate(animation),
  756. child: child,
  757. );
  758. },
  759. );
  760. },
  761. ),
  762. // GoRoute(
  763. // path: "/user/changePassword",
  764. // builder: (BuildContext context, GoRouterState state) {
  765. // return UserChangePassword();
  766. // },
  767. // ),
  768. GoRoute(
  769. path: '/user/shop',
  770. pageBuilder: (context, state) {
  771. return CustomTransitionPage(
  772. key: state.pageKey,
  773. child: UserShopPage(),
  774. transitionsBuilder: (context, animation, secondaryAnimation, child) {
  775. return FadeTransition(
  776. opacity: CurveTween(
  777. curve: Curves.easeInOutCirc,
  778. ).animate(animation),
  779. child: child,
  780. );
  781. },
  782. );
  783. },
  784. ),
  785. GoRoute(
  786. path: SpecialListPage.routeName,
  787. builder: (BuildContext context, GoRouterState state) {
  788. String cid =
  789. state.extra == null ? "670577300123717" : state.extra as String;
  790. return SpecialListPage(cid: cid);
  791. },
  792. ),
  793. ],
  794. );