2024-08-28 10:41:32 +00:00
|
|
|
import 'package:animations/animations.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
2024-08-26 05:29:17 +00:00
|
|
|
import 'package:go_router/go_router.dart';
|
2024-08-30 06:05:11 +00:00
|
|
|
import 'package:rhythm_box/screens/about.dart';
|
2024-08-29 17:56:21 +00:00
|
|
|
import 'package:rhythm_box/screens/album/view.dart';
|
2024-08-29 07:02:49 +00:00
|
|
|
import 'package:rhythm_box/screens/auth/mobile_login.dart';
|
2024-08-26 05:29:17 +00:00
|
|
|
import 'package:rhythm_box/screens/explore.dart';
|
2024-08-29 08:42:48 +00:00
|
|
|
import 'package:rhythm_box/screens/library/view.dart';
|
2024-08-28 10:41:32 +00:00
|
|
|
import 'package:rhythm_box/screens/player/lyrics.dart';
|
2024-08-30 04:56:28 +00:00
|
|
|
import 'package:rhythm_box/screens/player/mini.dart';
|
2024-08-28 10:41:32 +00:00
|
|
|
import 'package:rhythm_box/screens/player/view.dart';
|
2024-08-26 12:26:07 +00:00
|
|
|
import 'package:rhythm_box/screens/playlist/view.dart';
|
2024-08-28 13:07:58 +00:00
|
|
|
import 'package:rhythm_box/screens/search/view.dart';
|
2024-08-26 05:29:17 +00:00
|
|
|
import 'package:rhythm_box/screens/settings.dart';
|
|
|
|
import 'package:rhythm_box/shells/nav_shell.dart';
|
|
|
|
|
|
|
|
final router = GoRouter(routes: [
|
|
|
|
ShellRoute(
|
|
|
|
builder: (context, state, child) => NavShell(child: child),
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
2024-08-27 06:48:31 +00:00
|
|
|
path: '/',
|
|
|
|
name: 'explore',
|
2024-08-26 05:29:17 +00:00
|
|
|
builder: (context, state) => const ExploreScreen(),
|
|
|
|
),
|
2024-08-29 08:42:48 +00:00
|
|
|
GoRoute(
|
|
|
|
path: '/library',
|
|
|
|
name: 'library',
|
|
|
|
builder: (context, state) => const LibraryScreen(),
|
|
|
|
),
|
2024-08-28 13:07:58 +00:00
|
|
|
GoRoute(
|
|
|
|
path: '/search',
|
|
|
|
name: 'search',
|
|
|
|
builder: (context, state) => const SearchScreen(),
|
|
|
|
),
|
2024-08-27 06:35:16 +00:00
|
|
|
GoRoute(
|
2024-08-27 06:48:31 +00:00
|
|
|
path: '/playlist/:id',
|
|
|
|
name: 'playlistView',
|
2024-08-27 06:35:16 +00:00
|
|
|
builder: (context, state) => PlaylistViewScreen(
|
|
|
|
playlistId: state.pathParameters['id']!,
|
|
|
|
),
|
|
|
|
),
|
2024-08-29 17:56:21 +00:00
|
|
|
GoRoute(
|
|
|
|
path: '/albums/:id',
|
|
|
|
name: 'albumView',
|
|
|
|
builder: (context, state) => AlbumViewScreen(
|
|
|
|
albumId: state.pathParameters['id']!,
|
|
|
|
),
|
|
|
|
),
|
2024-08-26 05:29:17 +00:00
|
|
|
GoRoute(
|
2024-08-27 06:48:31 +00:00
|
|
|
path: '/settings',
|
|
|
|
name: 'settings',
|
2024-08-26 05:29:17 +00:00
|
|
|
builder: (context, state) => const SettingsScreen(),
|
|
|
|
),
|
2024-08-30 06:05:11 +00:00
|
|
|
GoRoute(
|
|
|
|
path: '/about',
|
|
|
|
name: 'about',
|
|
|
|
builder: (context, state) => const AboutScreen(),
|
|
|
|
),
|
2024-08-26 05:29:17 +00:00
|
|
|
],
|
|
|
|
),
|
2024-08-28 10:41:32 +00:00
|
|
|
ShellRoute(
|
|
|
|
pageBuilder: (context, state, child) => CustomTransitionPage(
|
|
|
|
child: child,
|
|
|
|
transitionsBuilder: (context, animation, secondaryAnimation, child) {
|
|
|
|
return FadeThroughTransition(
|
|
|
|
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
animation: animation,
|
|
|
|
secondaryAnimation: secondaryAnimation,
|
|
|
|
child: child,
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
|
|
|
path: '/player',
|
|
|
|
name: 'player',
|
|
|
|
builder: (context, state) => const PlayerScreen(),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: '/player/lyrics',
|
|
|
|
name: 'playerLyrics',
|
|
|
|
builder: (context, state) => const LyricsScreen(),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2024-08-30 04:56:28 +00:00
|
|
|
ShellRoute(
|
|
|
|
builder: (context, state, child) => child,
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
|
|
|
path: '/player/mini',
|
|
|
|
name: 'playerMini',
|
|
|
|
builder: (context, state) => MiniPlayerScreen(
|
|
|
|
prevSize: state.extra as Size,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2024-08-29 07:02:49 +00:00
|
|
|
ShellRoute(
|
|
|
|
builder: (context, state, child) => child,
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
|
|
|
path: '/auth/mobile-login',
|
|
|
|
name: 'authMobileLogin',
|
|
|
|
builder: (context, state) => const MobileLogin(),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2024-08-26 05:29:17 +00:00
|
|
|
]);
|