Nikolas Rimikis
2 years ago
5 changed files with 62 additions and 1 deletions
@ -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); |
||||
} |
Loading…
Reference in new issue