2024-05-09 00:41:19 -04:00
|
|
|
// to store names of routes
|
|
|
|
|
|
|
|
|
|
part of 'router.dart';
|
|
|
|
|
|
|
|
|
|
class Routes {
|
2024-05-22 03:49:14 -04:00
|
|
|
static const home = _SimpleRoute(
|
|
|
|
|
pathName: '',
|
|
|
|
|
name: 'home',
|
|
|
|
|
);
|
2024-05-10 17:49:47 -04:00
|
|
|
static const onboarding = _SimpleRoute(
|
|
|
|
|
pathName: 'login',
|
|
|
|
|
name: 'onboarding',
|
|
|
|
|
);
|
2024-05-09 00:41:19 -04:00
|
|
|
static const library = _SimpleRoute(
|
|
|
|
|
pathName: 'library',
|
|
|
|
|
pathParamName: 'libraryId',
|
|
|
|
|
name: 'library',
|
|
|
|
|
);
|
|
|
|
|
static const libraryItem = _SimpleRoute(
|
|
|
|
|
pathName: 'item',
|
|
|
|
|
pathParamName: 'itemId',
|
|
|
|
|
name: 'libraryItem',
|
|
|
|
|
);
|
2024-06-13 18:10:10 -04:00
|
|
|
|
2024-08-23 03:44:44 -04:00
|
|
|
// Local settings
|
2024-05-10 17:49:47 -04:00
|
|
|
static const settings = _SimpleRoute(
|
|
|
|
|
pathName: 'config',
|
|
|
|
|
name: 'settings',
|
|
|
|
|
);
|
2024-10-05 10:01:08 -04:00
|
|
|
static const themeSettings = _SimpleRoute(
|
|
|
|
|
pathName: 'theme',
|
|
|
|
|
name: 'themeSettings',
|
|
|
|
|
parentRoute: settings,
|
|
|
|
|
);
|
2024-06-13 18:10:10 -04:00
|
|
|
static const autoSleepTimerSettings = _SimpleRoute(
|
2024-09-25 03:13:42 -04:00
|
|
|
pathName: 'autoSleepTimer',
|
2024-06-13 18:10:10 -04:00
|
|
|
name: 'autoSleepTimerSettings',
|
2024-09-25 03:13:42 -04:00
|
|
|
parentRoute: settings,
|
|
|
|
|
);
|
|
|
|
|
static const notificationSettings = _SimpleRoute(
|
|
|
|
|
pathName: 'notifications',
|
|
|
|
|
name: 'notificationSettings',
|
|
|
|
|
parentRoute: settings,
|
2024-06-13 18:10:10 -04:00
|
|
|
);
|
2024-09-26 04:30:51 -04:00
|
|
|
static const playerSettings = _SimpleRoute(
|
|
|
|
|
pathName: 'player',
|
|
|
|
|
name: 'playerSettings',
|
|
|
|
|
parentRoute: settings,
|
|
|
|
|
);
|
2024-09-28 01:27:56 -04:00
|
|
|
static const shakeDetectorSettings = _SimpleRoute(
|
|
|
|
|
pathName: 'shakeDetector',
|
|
|
|
|
name: 'shakeDetectorSettings',
|
|
|
|
|
parentRoute: settings,
|
|
|
|
|
);
|
2024-06-13 18:10:10 -04:00
|
|
|
|
|
|
|
|
// search and explore
|
2024-06-05 12:08:44 -04:00
|
|
|
static const search = _SimpleRoute(
|
|
|
|
|
pathName: 'search',
|
|
|
|
|
name: 'search',
|
|
|
|
|
// parentRoute: library,
|
|
|
|
|
);
|
|
|
|
|
static const explore = _SimpleRoute(
|
|
|
|
|
pathName: 'explore',
|
|
|
|
|
name: 'explore',
|
|
|
|
|
);
|
2024-08-20 08:36:39 -04:00
|
|
|
|
|
|
|
|
// downloads
|
|
|
|
|
static const downloads = _SimpleRoute(
|
|
|
|
|
pathName: 'downloads',
|
|
|
|
|
name: 'downloads',
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// library browser to browse the library using author, genre, etc.
|
|
|
|
|
static const libraryBrowser = _SimpleRoute(
|
|
|
|
|
pathName: 'browser',
|
|
|
|
|
name: 'libraryBrowser',
|
|
|
|
|
// parentRoute: library,
|
|
|
|
|
);
|
2024-08-23 03:44:44 -04:00
|
|
|
|
|
|
|
|
// you page for the user
|
|
|
|
|
static const you = _SimpleRoute(
|
|
|
|
|
pathName: 'you',
|
|
|
|
|
name: 'you',
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// user management
|
|
|
|
|
static const userManagement = _SimpleRoute(
|
|
|
|
|
pathName: 'users',
|
|
|
|
|
name: 'userManagement',
|
|
|
|
|
);
|
2024-09-16 23:51:50 -04:00
|
|
|
|
|
|
|
|
// openID callback
|
|
|
|
|
static const openIDCallback = _SimpleRoute(
|
|
|
|
|
pathName: 'callback',
|
|
|
|
|
name: 'openIDCallback',
|
|
|
|
|
parentRoute: onboarding,
|
|
|
|
|
);
|
2024-10-03 05:54:29 -04:00
|
|
|
|
|
|
|
|
// logs page
|
|
|
|
|
static const logs = _SimpleRoute(
|
|
|
|
|
pathName: 'logs',
|
|
|
|
|
name: 'logs',
|
|
|
|
|
);
|
2024-05-09 00:41:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// a class to store path
|
|
|
|
|
|
|
|
|
|
class _SimpleRoute {
|
|
|
|
|
const _SimpleRoute({
|
|
|
|
|
required this.pathName,
|
2024-05-10 17:49:47 -04:00
|
|
|
this.pathParamName,
|
2024-05-09 00:41:19 -04:00
|
|
|
required this.name,
|
2024-06-05 12:08:44 -04:00
|
|
|
this.parentRoute,
|
2024-05-09 00:41:19 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
final String pathName;
|
2024-05-10 17:49:47 -04:00
|
|
|
final String? pathParamName;
|
2024-05-09 00:41:19 -04:00
|
|
|
final String name;
|
2024-06-05 12:08:44 -04:00
|
|
|
final _SimpleRoute? parentRoute;
|
2024-05-09 00:41:19 -04:00
|
|
|
|
2024-06-13 18:10:10 -04:00
|
|
|
/// the full path of the route
|
2024-09-16 23:51:50 -04:00
|
|
|
String get fullPath {
|
|
|
|
|
return '${parentRoute?.fullPath ?? ''}$localPath';
|
2024-06-13 18:10:10 -04:00
|
|
|
}
|
2024-06-05 12:08:44 -04:00
|
|
|
|
2024-06-13 18:10:10 -04:00
|
|
|
/// the local path of the route
|
2024-06-05 12:08:44 -04:00
|
|
|
String get localPath =>
|
2024-05-10 17:49:47 -04:00
|
|
|
'/$pathName${pathParamName != null ? '/:$pathParamName' : ''}';
|
2024-05-09 00:41:19 -04:00
|
|
|
}
|