Browse Source

neon_notes: add app route

pull/466/head
Nikolas Rimikis 2 years ago
parent
commit
a0fd473ddd
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 0
      packages/neon/neon_notes/build.yaml
  2. 9
      packages/neon/neon_notes/lib/neon_notes.dart
  3. 18
      packages/neon/neon_notes/lib/routes.dart
  4. 33
      packages/neon/neon_notes/lib/routes.g.dart
  5. 3
      packages/neon/neon_notes/pubspec.yaml

0
packages/neon/neon_notes/build.yaml

9
packages/neon/neon_notes/lib/neon_notes.dart

@ -7,6 +7,7 @@ import 'package:built_collection/built_collection.dart';
import 'package:crypto/crypto.dart';
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:go_router/go_router.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:neon/blocs.dart';
import 'package:neon/models.dart';
@ -16,6 +17,7 @@ import 'package:neon/sort_box.dart';
import 'package:neon/utils.dart';
import 'package:neon/widgets.dart';
import 'package:neon_notes/l10n/localizations.dart';
import 'package:neon_notes/routes.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:provider/provider.dart';
import 'package:queue/queue.dart';
@ -44,7 +46,9 @@ class NotesApp extends AppImplementation<NotesBloc, NotesAppSpecificOptions> {
NotesApp(super.sharedPreferences, super.requestManager, super.platform);
@override
String id = 'notes';
String id = appId;
static const String appId = 'notes';
@override
List<Locale> supportedLocales = AppLocalizations.supportedLocales;
@ -64,4 +68,7 @@ class NotesApp extends AppImplementation<NotesBloc, NotesAppSpecificOptions> {
@override
Widget get page => const NotesMainPage();
@override
RouteBase get route => $notesAppRoute;
}

18
packages/neon/neon_notes/lib/routes.dart

@ -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();
}

33
packages/neon/neon_notes/lib/routes.g.dart

@ -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);
}

3
packages/neon/neon_notes/pubspec.yaml

@ -12,6 +12,7 @@ dependencies:
flutter:
sdk: flutter
flutter_markdown: ^0.6.14
go_router: ^8.0.3
material_design_icons_flutter: ^7.0.7296
neon:
git:
@ -28,6 +29,8 @@ dependencies:
wakelock: ^0.6.2
dev_dependencies:
build_runner: ^2.4.4
go_router_builder: ^2.0.2
nit_picking:
git:
url: https://github.com/stack11/dart_nit_picking

Loading…
Cancel
Save