Browse Source

neon_notifications: add app route

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

0
packages/neon/neon_notifications/build.yaml

9
packages/neon/neon_notifications/lib/neon_notifications.dart

@ -3,6 +3,7 @@ library notifications;
import 'dart:async';
import 'package:flutter/material.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';
@ -10,6 +11,7 @@ import 'package:neon/settings.dart';
import 'package:neon/utils.dart';
import 'package:neon/widgets.dart';
import 'package:neon_notifications/l10n/localizations.dart';
import 'package:neon_notifications/routes.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:provider/provider.dart';
import 'package:rxdart/rxdart.dart';
@ -23,7 +25,9 @@ class NotificationsApp extends AppImplementation<NotificationsBloc, Notification
NotificationsApp(super.sharedPreferences, super.requestManager, super.platform);
@override
String id = 'notifications';
String id = appId;
static const String appId = 'notifications';
@override
LocalizationsDelegate localizationsDelegate = AppLocalizations.delegate;
@ -44,6 +48,9 @@ class NotificationsApp extends AppImplementation<NotificationsBloc, Notification
@override
Widget get page => const NotificationsMainPage();
@override
RouteBase get route => $notificationsAppRoute;
@override
BehaviorSubject<int> getUnreadCounter(final NotificationsBloc bloc) => bloc.unreadCounter;
}

18
packages/neon/neon_notifications/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_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();
}

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

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

3
packages/neon/neon_notifications/pubspec.yaml

@ -9,6 +9,7 @@ environment:
dependencies:
flutter:
sdk: flutter
go_router: ^8.0.3
material_design_icons_flutter: ^7.0.7296
neon:
git:
@ -22,6 +23,8 @@ dependencies:
rxdart: ^0.27.7
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