add separate history download screen

This commit is contained in:
Fabian Freund
2026-02-21 10:59:56 +01:00
parent 7c14e7b3a3
commit f8d497f991
6 changed files with 372 additions and 115 deletions
+28
View File
@@ -1143,6 +1143,13 @@ RouteBase get $historyRoute => GoRouteData.$route(
path: '/history',
name: 'HistoryRoute',
factory: $HistoryRoute._fromState,
routes: [
GoRouteData.$route(
path: 'downloads',
name: 'HistoryDownloadsRoute',
factory: $HistoryDownloadsRoute._fromState,
),
],
);
mixin $HistoryRoute on GoRouteData {
@@ -1165,6 +1172,27 @@ mixin $HistoryRoute on GoRouteData {
void replace(BuildContext context) => context.replace(location);
}
mixin $HistoryDownloadsRoute on GoRouteData {
static HistoryDownloadsRoute _fromState(GoRouterState state) =>
const HistoryDownloadsRoute();
@override
String get location => GoRouteData.$location('/history/downloads');
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
RouteBase get $profileListRoute => GoRouteData.$route(
path: '/profiles',
name: 'ProfileListRoute',
+19 -1
View File
@@ -19,7 +19,16 @@
*/
part of 'routes.dart';
@TypedGoRoute<HistoryRoute>(name: 'HistoryRoute', path: '/history')
@TypedGoRoute<HistoryRoute>(
name: 'HistoryRoute',
path: '/history',
routes: [
TypedGoRoute<HistoryDownloadsRoute>(
name: 'HistoryDownloadsRoute',
path: 'downloads',
),
],
)
class HistoryRoute extends GoRouteData with $HistoryRoute {
const HistoryRoute();
@@ -28,3 +37,12 @@ class HistoryRoute extends GoRouteData with $HistoryRoute {
return const HistoryScreen();
}
}
class HistoryDownloadsRoute extends GoRouteData with $HistoryDownloadsRoute {
const HistoryDownloadsRoute();
@override
Widget build(BuildContext context, GoRouterState state) {
return const HistoryScreen(mode: HistoryScreenMode.downloads);
}
}