Nikolas Rimikis
1 year ago
committed by
GitHub
26 changed files with 351 additions and 41 deletions
@ -0,0 +1,16 @@
|
||||
import 'package:flutter/widgets.dart'; |
||||
import 'package:go_router/go_router.dart'; |
||||
|
||||
/// [RouteData] for the initial page of an app. |
||||
/// |
||||
/// Subclasses must override one of [build] or [redirect]. |
||||
abstract class NeonAppRoute extends GoRouteData { |
||||
const NeonAppRoute(); |
||||
|
||||
@override |
||||
Page<void> buildPage(final BuildContext context, final GoRouterState state) => NoTransitionPage( |
||||
child: build(context, state), |
||||
); |
||||
} |
||||
|
||||
const appsRoutePrefix = '/apps/'; |
@ -0,0 +1,18 @@
|
||||
import 'package:flutter/widgets.dart'; |
||||
import 'package:go_router/go_router.dart'; |
||||
import 'package:neon/utils.dart'; |
||||
import 'package:neon_files/neon_files.dart'; |
||||
|
||||
part 'routes.g.dart'; |
||||
|
||||
@TypedGoRoute<FilesAppRoute>( |
||||
path: '$appsRoutePrefix${FilesApp.appId}', |
||||
name: FilesApp.appId, |
||||
) |
||||
@immutable |
||||
class FilesAppRoute extends NeonAppRoute { |
||||
const FilesAppRoute(); |
||||
|
||||
@override |
||||
Widget build(final BuildContext context, final GoRouterState state) => const FilesMainPage(); |
||||
} |
@ -0,0 +1,33 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND |
||||
|
||||
part of 'routes.dart'; |
||||
|
||||
// ************************************************************************** |
||||
// GoRouterGenerator |
||||
// ************************************************************************** |
||||
|
||||
List<RouteBase> get $appRoutes => [ |
||||
$filesAppRoute, |
||||
]; |
||||
|
||||
RouteBase get $filesAppRoute => GoRouteData.$route( |
||||
path: '/apps/files', |
||||
name: 'files', |
||||
factory: $FilesAppRouteExtension._fromState, |
||||
); |
||||
|
||||
extension $FilesAppRouteExtension on FilesAppRoute { |
||||
static FilesAppRoute _fromState(GoRouterState state) => const FilesAppRoute(); |
||||
|
||||
String get location => GoRouteData.$location( |
||||
'/apps/files', |
||||
); |
||||
|
||||
void go(BuildContext context) => context.go(location); |
||||
|
||||
Future<T?> push<T>(BuildContext context) => context.push<T>(location); |
||||
|
||||
void pushReplacement(BuildContext context) => context.pushReplacement(location); |
||||
|
||||
void replace(BuildContext context) => context.replace(location); |
||||
} |
@ -0,0 +1,18 @@
|
||||
import 'package:flutter/widgets.dart'; |
||||
import 'package:go_router/go_router.dart'; |
||||
import 'package:neon/utils.dart'; |
||||
import 'package:neon_news/neon_news.dart'; |
||||
|
||||
part 'routes.g.dart'; |
||||
|
||||
@TypedGoRoute<NewsAppRoute>( |
||||
path: '$appsRoutePrefix${NewsApp.appId}', |
||||
name: NewsApp.appId, |
||||
) |
||||
@immutable |
||||
class NewsAppRoute extends NeonAppRoute { |
||||
const NewsAppRoute(); |
||||
|
||||
@override |
||||
Widget build(final BuildContext context, final GoRouterState state) => const NewsMainPage(); |
||||
} |
@ -0,0 +1,33 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND |
||||
|
||||
part of 'routes.dart'; |
||||
|
||||
// ************************************************************************** |
||||
// GoRouterGenerator |
||||
// ************************************************************************** |
||||
|
||||
List<RouteBase> get $appRoutes => [ |
||||
$newsAppRoute, |
||||
]; |
||||
|
||||
RouteBase get $newsAppRoute => GoRouteData.$route( |
||||
path: '/apps/news', |
||||
name: 'news', |
||||
factory: $NewsAppRouteExtension._fromState, |
||||
); |
||||
|
||||
extension $NewsAppRouteExtension on NewsAppRoute { |
||||
static NewsAppRoute _fromState(GoRouterState state) => const NewsAppRoute(); |
||||
|
||||
String get location => GoRouteData.$location( |
||||
'/apps/news', |
||||
); |
||||
|
||||
void go(BuildContext context) => context.go(location); |
||||
|
||||
Future<T?> push<T>(BuildContext context) => context.push<T>(location); |
||||
|
||||
void pushReplacement(BuildContext context) => context.pushReplacement(location); |
||||
|
||||
void replace(BuildContext context) => context.replace(location); |
||||
} |
@ -0,0 +1,18 @@
|
||||
import 'package:flutter/widgets.dart'; |
||||
import 'package:go_router/go_router.dart'; |
||||
import 'package:neon/utils.dart'; |
||||
import 'package:neon_notes/neon_notes.dart'; |
||||
|
||||
part 'routes.g.dart'; |
||||
|
||||
@TypedGoRoute<NotesAppRoute>( |
||||
path: '$appsRoutePrefix${NotesApp.appId}', |
||||
name: NotesApp.appId, |
||||
) |
||||
@immutable |
||||
class NotesAppRoute extends NeonAppRoute { |
||||
const NotesAppRoute(); |
||||
|
||||
@override |
||||
Widget build(final BuildContext context, final GoRouterState state) => const NotesMainPage(); |
||||
} |
@ -0,0 +1,33 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND |
||||
|
||||
part of 'routes.dart'; |
||||
|
||||
// ************************************************************************** |
||||
// GoRouterGenerator |
||||
// ************************************************************************** |
||||
|
||||
List<RouteBase> get $appRoutes => [ |
||||
$notesAppRoute, |
||||
]; |
||||
|
||||
RouteBase get $notesAppRoute => GoRouteData.$route( |
||||
path: '/apps/notes', |
||||
name: 'notes', |
||||
factory: $NotesAppRouteExtension._fromState, |
||||
); |
||||
|
||||
extension $NotesAppRouteExtension on NotesAppRoute { |
||||
static NotesAppRoute _fromState(GoRouterState state) => const NotesAppRoute(); |
||||
|
||||
String get location => GoRouteData.$location( |
||||
'/apps/notes', |
||||
); |
||||
|
||||
void go(BuildContext context) => context.go(location); |
||||
|
||||
Future<T?> push<T>(BuildContext context) => context.push<T>(location); |
||||
|
||||
void pushReplacement(BuildContext context) => context.pushReplacement(location); |
||||
|
||||
void replace(BuildContext context) => context.replace(location); |
||||
} |
@ -0,0 +1,18 @@
|
||||
import 'package:flutter/widgets.dart'; |
||||
import 'package:go_router/go_router.dart'; |
||||
import 'package:neon/utils.dart'; |
||||
import 'package:neon_notifications/neon_notifications.dart'; |
||||
|
||||
part 'routes.g.dart'; |
||||
|
||||
@TypedGoRoute<NotificationsAppRoute>( |
||||
path: '$appsRoutePrefix${NotificationsApp.appId}', |
||||
name: NotificationsApp.appId, |
||||
) |
||||
@immutable |
||||
class NotificationsAppRoute extends NeonAppRoute { |
||||
const NotificationsAppRoute(); |
||||
|
||||
@override |
||||
Widget build(final BuildContext context, final GoRouterState state) => const NotificationsMainPage(); |
||||
} |
@ -0,0 +1,33 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND |
||||
|
||||
part of 'routes.dart'; |
||||
|
||||
// ************************************************************************** |
||||
// GoRouterGenerator |
||||
// ************************************************************************** |
||||
|
||||
List<RouteBase> get $appRoutes => [ |
||||
$notificationsAppRoute, |
||||
]; |
||||
|
||||
RouteBase get $notificationsAppRoute => GoRouteData.$route( |
||||
path: '/apps/notifications', |
||||
name: 'notifications', |
||||
factory: $NotificationsAppRouteExtension._fromState, |
||||
); |
||||
|
||||
extension $NotificationsAppRouteExtension on NotificationsAppRoute { |
||||
static NotificationsAppRoute _fromState(GoRouterState state) => const NotificationsAppRoute(); |
||||
|
||||
String get location => GoRouteData.$location( |
||||
'/apps/notifications', |
||||
); |
||||
|
||||
void go(BuildContext context) => context.go(location); |
||||
|
||||
Future<T?> push<T>(BuildContext context) => context.push<T>(location); |
||||
|
||||
void pushReplacement(BuildContext context) => context.pushReplacement(location); |
||||
|
||||
void replace(BuildContext context) => context.replace(location); |
||||
} |
Loading…
Reference in new issue