mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-01-15 14:49:32 +00:00
chore: run dart format
Some checks are pending
Flutter CI & Release / Test (push) Waiting to run
Flutter CI & Release / Build Android APKs (push) Blocked by required conditions
Flutter CI & Release / build_linux (push) Blocked by required conditions
Flutter CI & Release / Create GitHub Release (push) Blocked by required conditions
Some checks are pending
Flutter CI & Release / Test (push) Waiting to run
Flutter CI & Release / Build Android APKs (push) Blocked by required conditions
Flutter CI & Release / build_linux (push) Blocked by required conditions
Flutter CI & Release / Create GitHub Release (push) Blocked by required conditions
This commit is contained in:
parent
a520136e01
commit
e23c0b6c5f
84 changed files with 1565 additions and 1945 deletions
|
|
@ -3,14 +3,8 @@
|
|||
part of 'router.dart';
|
||||
|
||||
class Routes {
|
||||
static const home = _SimpleRoute(
|
||||
pathName: '',
|
||||
name: 'home',
|
||||
);
|
||||
static const onboarding = _SimpleRoute(
|
||||
pathName: 'login',
|
||||
name: 'onboarding',
|
||||
);
|
||||
static const home = _SimpleRoute(pathName: '', name: 'home');
|
||||
static const onboarding = _SimpleRoute(pathName: 'login', name: 'onboarding');
|
||||
static const library = _SimpleRoute(
|
||||
pathName: 'library',
|
||||
pathParamName: 'libraryId',
|
||||
|
|
@ -23,10 +17,7 @@ class Routes {
|
|||
);
|
||||
|
||||
// Local settings
|
||||
static const settings = _SimpleRoute(
|
||||
pathName: 'config',
|
||||
name: 'settings',
|
||||
);
|
||||
static const settings = _SimpleRoute(pathName: 'config', name: 'settings');
|
||||
static const themeSettings = _SimpleRoute(
|
||||
pathName: 'theme',
|
||||
name: 'themeSettings',
|
||||
|
|
@ -64,10 +55,7 @@ class Routes {
|
|||
name: 'search',
|
||||
// parentRoute: library,
|
||||
);
|
||||
static const explore = _SimpleRoute(
|
||||
pathName: 'explore',
|
||||
name: 'explore',
|
||||
);
|
||||
static const explore = _SimpleRoute(pathName: 'explore', name: 'explore');
|
||||
|
||||
// downloads
|
||||
static const downloads = _SimpleRoute(
|
||||
|
|
@ -83,10 +71,7 @@ class Routes {
|
|||
);
|
||||
|
||||
// you page for the user
|
||||
static const you = _SimpleRoute(
|
||||
pathName: 'you',
|
||||
name: 'you',
|
||||
);
|
||||
static const you = _SimpleRoute(pathName: 'you', name: 'you');
|
||||
|
||||
// user management
|
||||
static const userManagement = _SimpleRoute(
|
||||
|
|
@ -102,10 +87,7 @@ class Routes {
|
|||
);
|
||||
|
||||
// logs page
|
||||
static const logs = _SimpleRoute(
|
||||
pathName: 'logs',
|
||||
name: 'logs',
|
||||
);
|
||||
static const logs = _SimpleRoute(pathName: 'logs', name: 'logs');
|
||||
}
|
||||
|
||||
// a class to store path
|
||||
|
|
|
|||
|
|
@ -25,8 +25,9 @@ import 'transitions/slide.dart';
|
|||
|
||||
part 'constants.dart';
|
||||
|
||||
final GlobalKey<NavigatorState> rootNavigatorKey =
|
||||
GlobalKey<NavigatorState>(debugLabel: 'root');
|
||||
final GlobalKey<NavigatorState> rootNavigatorKey = GlobalKey<NavigatorState>(
|
||||
debugLabel: 'root',
|
||||
);
|
||||
final GlobalKey<NavigatorState> sectionHomeNavigatorKey =
|
||||
GlobalKey<NavigatorState>(debugLabel: 'HomeNavigator');
|
||||
|
||||
|
|
@ -35,34 +36,35 @@ class MyAppRouter {
|
|||
const MyAppRouter();
|
||||
|
||||
GoRouter get config => GoRouter(
|
||||
initialLocation: Routes.home.localPath,
|
||||
debugLogDiagnostics: true,
|
||||
initialLocation: Routes.home.localPath,
|
||||
debugLogDiagnostics: true,
|
||||
routes: [
|
||||
// sign in page
|
||||
GoRoute(
|
||||
path: Routes.onboarding.localPath,
|
||||
name: Routes.onboarding.name,
|
||||
builder: (context, state) => const OnboardingSinglePage(),
|
||||
routes: [
|
||||
// sign in page
|
||||
// open id callback
|
||||
GoRoute(
|
||||
path: Routes.onboarding.localPath,
|
||||
name: Routes.onboarding.name,
|
||||
builder: (context, state) => const OnboardingSinglePage(),
|
||||
routes: [
|
||||
// open id callback
|
||||
GoRoute(
|
||||
path: Routes.openIDCallback.pathName,
|
||||
name: Routes.openIDCallback.name,
|
||||
pageBuilder: handleCallback,
|
||||
),
|
||||
],
|
||||
),
|
||||
// callback for open id
|
||||
// need to duplicate because of https://github.com/flutter/flutter/issues/100624
|
||||
GoRoute(
|
||||
path: Routes.openIDCallback.localPath,
|
||||
// name: Routes.openIDCallback.name,
|
||||
// builder: handleCallback,
|
||||
path: Routes.openIDCallback.pathName,
|
||||
name: Routes.openIDCallback.name,
|
||||
pageBuilder: handleCallback,
|
||||
),
|
||||
// The main app shell
|
||||
StatefulShellRoute.indexedStack(
|
||||
builder: (
|
||||
],
|
||||
),
|
||||
// callback for open id
|
||||
// need to duplicate because of https://github.com/flutter/flutter/issues/100624
|
||||
GoRoute(
|
||||
path: Routes.openIDCallback.localPath,
|
||||
// name: Routes.openIDCallback.name,
|
||||
// builder: handleCallback,
|
||||
pageBuilder: handleCallback,
|
||||
),
|
||||
// The main app shell
|
||||
StatefulShellRoute.indexedStack(
|
||||
builder:
|
||||
(
|
||||
BuildContext context,
|
||||
GoRouterState state,
|
||||
StatefulNavigationShell navigationShell,
|
||||
|
|
@ -73,188 +75,187 @@ class MyAppRouter {
|
|||
// branches in a stateful way.
|
||||
return ScaffoldWithNavBar(navigationShell: navigationShell);
|
||||
},
|
||||
branches: <StatefulShellBranch>[
|
||||
// The route branch for the first tab of the bottom navigation bar.
|
||||
StatefulShellBranch(
|
||||
navigatorKey: sectionHomeNavigatorKey,
|
||||
routes: <RouteBase>[
|
||||
GoRoute(
|
||||
path: Routes.home.localPath,
|
||||
name: Routes.home.name,
|
||||
// builder: (context, state) => const HomePage(),
|
||||
pageBuilder: defaultPageBuilder(const HomePage()),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.libraryItem.localPath,
|
||||
name: Routes.libraryItem.name,
|
||||
// builder: (context, state) {
|
||||
// final itemId = state
|
||||
// .pathParameters[Routes.libraryItem.pathParamName]!;
|
||||
// return LibraryItemPage(
|
||||
// itemId: itemId, extra: state.extra);
|
||||
// },
|
||||
pageBuilder: (context, state) {
|
||||
final itemId = state
|
||||
.pathParameters[Routes.libraryItem.pathParamName]!;
|
||||
final child =
|
||||
LibraryItemPage(itemId: itemId, extra: state.extra);
|
||||
return buildPageWithDefaultTransition(
|
||||
context: context,
|
||||
state: state,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
),
|
||||
// downloads page
|
||||
GoRoute(
|
||||
path: Routes.downloads.localPath,
|
||||
name: Routes.downloads.name,
|
||||
pageBuilder: defaultPageBuilder(const DownloadsPage()),
|
||||
),
|
||||
],
|
||||
branches: <StatefulShellBranch>[
|
||||
// The route branch for the first tab of the bottom navigation bar.
|
||||
StatefulShellBranch(
|
||||
navigatorKey: sectionHomeNavigatorKey,
|
||||
routes: <RouteBase>[
|
||||
GoRoute(
|
||||
path: Routes.home.localPath,
|
||||
name: Routes.home.name,
|
||||
// builder: (context, state) => const HomePage(),
|
||||
pageBuilder: defaultPageBuilder(const HomePage()),
|
||||
),
|
||||
|
||||
// Library page
|
||||
StatefulShellBranch(
|
||||
routes: <RouteBase>[
|
||||
GoRoute(
|
||||
path: Routes.libraryBrowser.localPath,
|
||||
name: Routes.libraryBrowser.name,
|
||||
pageBuilder: defaultPageBuilder(const LibraryBrowserPage()),
|
||||
),
|
||||
],
|
||||
GoRoute(
|
||||
path: Routes.libraryItem.localPath,
|
||||
name: Routes.libraryItem.name,
|
||||
// builder: (context, state) {
|
||||
// final itemId = state
|
||||
// .pathParameters[Routes.libraryItem.pathParamName]!;
|
||||
// return LibraryItemPage(
|
||||
// itemId: itemId, extra: state.extra);
|
||||
// },
|
||||
pageBuilder: (context, state) {
|
||||
final itemId =
|
||||
state.pathParameters[Routes.libraryItem.pathParamName]!;
|
||||
final child = LibraryItemPage(
|
||||
itemId: itemId,
|
||||
extra: state.extra,
|
||||
);
|
||||
return buildPageWithDefaultTransition(
|
||||
context: context,
|
||||
state: state,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
),
|
||||
// search/explore page
|
||||
StatefulShellBranch(
|
||||
routes: <RouteBase>[
|
||||
GoRoute(
|
||||
path: Routes.explore.localPath,
|
||||
name: Routes.explore.name,
|
||||
// builder: (context, state) => const ExplorePage(),
|
||||
pageBuilder: defaultPageBuilder(const ExplorePage()),
|
||||
),
|
||||
// search page
|
||||
GoRoute(
|
||||
path: Routes.search.localPath,
|
||||
name: Routes.search.name,
|
||||
// builder: (context, state) {
|
||||
// final libraryId = state
|
||||
// .pathParameters[Routes.library.pathParamName]!;
|
||||
// return LibrarySearchPage(
|
||||
// libraryId: libraryId,
|
||||
// extra: state.extra,
|
||||
// );
|
||||
// },
|
||||
pageBuilder: (context, state) {
|
||||
final queryParam = state.uri.queryParameters['q']!;
|
||||
final category = state.uri.queryParameters['category'];
|
||||
final child = SearchResultPage(
|
||||
extra: state.extra,
|
||||
query: queryParam,
|
||||
category: category != null
|
||||
? SearchResultCategory.values.firstWhere(
|
||||
(e) => e.toString().split('.').last == category,
|
||||
)
|
||||
: null,
|
||||
);
|
||||
return buildPageWithDefaultTransition(
|
||||
context: context,
|
||||
state: state,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
// you page
|
||||
StatefulShellBranch(
|
||||
routes: <RouteBase>[
|
||||
GoRoute(
|
||||
path: Routes.you.localPath,
|
||||
name: Routes.you.name,
|
||||
pageBuilder: defaultPageBuilder(const YouPage()),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.settings.localPath,
|
||||
name: Routes.settings.name,
|
||||
// builder: (context, state) => const AppSettingsPage(),
|
||||
pageBuilder: defaultPageBuilder(const AppSettingsPage()),
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: Routes.themeSettings.pathName,
|
||||
name: Routes.themeSettings.name,
|
||||
pageBuilder: defaultPageBuilder(
|
||||
const ThemeSettingsPage(),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.autoSleepTimerSettings.pathName,
|
||||
name: Routes.autoSleepTimerSettings.name,
|
||||
pageBuilder: defaultPageBuilder(
|
||||
const AutoSleepTimerSettingsPage(),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.notificationSettings.pathName,
|
||||
name: Routes.notificationSettings.name,
|
||||
pageBuilder: defaultPageBuilder(
|
||||
const NotificationSettingsPage(),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.playerSettings.pathName,
|
||||
name: Routes.playerSettings.name,
|
||||
pageBuilder:
|
||||
defaultPageBuilder(const PlayerSettingsPage()),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.shakeDetectorSettings.pathName,
|
||||
name: Routes.shakeDetectorSettings.name,
|
||||
pageBuilder: defaultPageBuilder(
|
||||
const ShakeDetectorSettingsPage(),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.homePageSettings.pathName,
|
||||
name: Routes.homePageSettings.name,
|
||||
pageBuilder: defaultPageBuilder(
|
||||
const HomePageSettingsPage(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.userManagement.localPath,
|
||||
name: Routes.userManagement.name,
|
||||
// builder: (context, state) => const UserManagementPage(),
|
||||
pageBuilder: defaultPageBuilder(const ServerManagerPage()),
|
||||
),
|
||||
],
|
||||
// downloads page
|
||||
GoRoute(
|
||||
path: Routes.downloads.localPath,
|
||||
name: Routes.downloads.name,
|
||||
pageBuilder: defaultPageBuilder(const DownloadsPage()),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
// loggers page
|
||||
GoRoute(
|
||||
path: Routes.logs.localPath,
|
||||
name: Routes.logs.name,
|
||||
// builder: (context, state) => const LogsPage(),
|
||||
pageBuilder: defaultPageBuilder(const LogsPage()),
|
||||
// Library page
|
||||
StatefulShellBranch(
|
||||
routes: <RouteBase>[
|
||||
GoRoute(
|
||||
path: Routes.libraryBrowser.localPath,
|
||||
name: Routes.libraryBrowser.name,
|
||||
pageBuilder: defaultPageBuilder(const LibraryBrowserPage()),
|
||||
),
|
||||
],
|
||||
),
|
||||
// search/explore page
|
||||
StatefulShellBranch(
|
||||
routes: <RouteBase>[
|
||||
GoRoute(
|
||||
path: Routes.explore.localPath,
|
||||
name: Routes.explore.name,
|
||||
// builder: (context, state) => const ExplorePage(),
|
||||
pageBuilder: defaultPageBuilder(const ExplorePage()),
|
||||
),
|
||||
// search page
|
||||
GoRoute(
|
||||
path: Routes.search.localPath,
|
||||
name: Routes.search.name,
|
||||
// builder: (context, state) {
|
||||
// final libraryId = state
|
||||
// .pathParameters[Routes.library.pathParamName]!;
|
||||
// return LibrarySearchPage(
|
||||
// libraryId: libraryId,
|
||||
// extra: state.extra,
|
||||
// );
|
||||
// },
|
||||
pageBuilder: (context, state) {
|
||||
final queryParam = state.uri.queryParameters['q']!;
|
||||
final category = state.uri.queryParameters['category'];
|
||||
final child = SearchResultPage(
|
||||
extra: state.extra,
|
||||
query: queryParam,
|
||||
category: category != null
|
||||
? SearchResultCategory.values.firstWhere(
|
||||
(e) => e.toString().split('.').last == category,
|
||||
)
|
||||
: null,
|
||||
);
|
||||
return buildPageWithDefaultTransition(
|
||||
context: context,
|
||||
state: state,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
// you page
|
||||
StatefulShellBranch(
|
||||
routes: <RouteBase>[
|
||||
GoRoute(
|
||||
path: Routes.you.localPath,
|
||||
name: Routes.you.name,
|
||||
pageBuilder: defaultPageBuilder(const YouPage()),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.settings.localPath,
|
||||
name: Routes.settings.name,
|
||||
// builder: (context, state) => const AppSettingsPage(),
|
||||
pageBuilder: defaultPageBuilder(const AppSettingsPage()),
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: Routes.themeSettings.pathName,
|
||||
name: Routes.themeSettings.name,
|
||||
pageBuilder: defaultPageBuilder(const ThemeSettingsPage()),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.autoSleepTimerSettings.pathName,
|
||||
name: Routes.autoSleepTimerSettings.name,
|
||||
pageBuilder: defaultPageBuilder(
|
||||
const AutoSleepTimerSettingsPage(),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.notificationSettings.pathName,
|
||||
name: Routes.notificationSettings.name,
|
||||
pageBuilder: defaultPageBuilder(
|
||||
const NotificationSettingsPage(),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.playerSettings.pathName,
|
||||
name: Routes.playerSettings.name,
|
||||
pageBuilder: defaultPageBuilder(const PlayerSettingsPage()),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.shakeDetectorSettings.pathName,
|
||||
name: Routes.shakeDetectorSettings.name,
|
||||
pageBuilder: defaultPageBuilder(
|
||||
const ShakeDetectorSettingsPage(),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.homePageSettings.pathName,
|
||||
name: Routes.homePageSettings.name,
|
||||
pageBuilder: defaultPageBuilder(
|
||||
const HomePageSettingsPage(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.userManagement.localPath,
|
||||
name: Routes.userManagement.name,
|
||||
// builder: (context, state) => const UserManagementPage(),
|
||||
pageBuilder: defaultPageBuilder(const ServerManagerPage()),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
),
|
||||
|
||||
Page handleCallback(
|
||||
BuildContext context,
|
||||
GoRouterState state,
|
||||
) {
|
||||
// loggers page
|
||||
GoRoute(
|
||||
path: Routes.logs.localPath,
|
||||
name: Routes.logs.name,
|
||||
// builder: (context, state) => const LogsPage(),
|
||||
pageBuilder: defaultPageBuilder(const LogsPage()),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Page handleCallback(BuildContext context, GoRouterState state) {
|
||||
// extract the code and state from the uri
|
||||
final code = state.uri.queryParameters['code'];
|
||||
final stateParam = state.uri.queryParameters['state'];
|
||||
appLogger.fine('deep linking callback: code: $code, state: $stateParam');
|
||||
|
||||
var callbackPage =
|
||||
CallbackPage(code: code, state: stateParam, key: ValueKey(stateParam));
|
||||
var callbackPage = CallbackPage(
|
||||
code: code,
|
||||
state: stateParam,
|
||||
key: ValueKey(stateParam),
|
||||
);
|
||||
return buildPageWithDefaultTransition(
|
||||
context: context,
|
||||
state: state,
|
||||
|
|
|
|||
|
|
@ -33,29 +33,26 @@ CustomTransitionPage buildPageWithDefaultTransition<T>({
|
|||
child: child,
|
||||
transitionsBuilder: (context, animation, secondaryAnimation, child) =>
|
||||
FadeTransition(
|
||||
opacity: animation,
|
||||
child: SlideTransition(
|
||||
position: animation.drive(
|
||||
Tween(
|
||||
begin: const Offset(0, 1.50),
|
||||
end: Offset.zero,
|
||||
).chain(
|
||||
CurveTween(curve: Curves.easeOut),
|
||||
opacity: animation,
|
||||
child: SlideTransition(
|
||||
position: animation.drive(
|
||||
Tween(
|
||||
begin: const Offset(0, 1.50),
|
||||
end: Offset.zero,
|
||||
).chain(CurveTween(curve: Curves.easeOut)),
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Page<dynamic> Function(BuildContext, GoRouterState) defaultPageBuilder<T>(
|
||||
Widget child,
|
||||
) =>
|
||||
(BuildContext context, GoRouterState state) {
|
||||
return buildPageWithDefaultTransition<T>(
|
||||
context: context,
|
||||
state: state,
|
||||
child: child,
|
||||
);
|
||||
};
|
||||
) => (BuildContext context, GoRouterState state) {
|
||||
return buildPageWithDefaultTransition<T>(
|
||||
context: context,
|
||||
state: state,
|
||||
child: child,
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue