Browse Source

neon_files: add app route

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

0
packages/neon/neon_files/build.yaml

9
packages/neon/neon_files/lib/neon_files.dart

@ -9,6 +9,7 @@ import 'package:file_icons/file_icons.dart';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:filesize/filesize.dart'; import 'package:filesize/filesize.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:intersperse/intersperse.dart'; import 'package:intersperse/intersperse.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
@ -21,6 +22,7 @@ import 'package:neon/theme.dart';
import 'package:neon/utils.dart'; import 'package:neon/utils.dart';
import 'package:neon/widgets.dart'; import 'package:neon/widgets.dart';
import 'package:neon_files/l10n/localizations.dart'; import 'package:neon_files/l10n/localizations.dart';
import 'package:neon_files/routes.dart';
import 'package:nextcloud/nextcloud.dart'; import 'package:nextcloud/nextcloud.dart';
import 'package:open_file/open_file.dart'; import 'package:open_file/open_file.dart';
import 'package:path/path.dart' as p; import 'package:path/path.dart' as p;
@ -47,7 +49,9 @@ class FilesApp extends AppImplementation<FilesBloc, FilesAppSpecificOptions> {
FilesApp(super.sharedPreferences, super.requestManager, super.platform); FilesApp(super.sharedPreferences, super.requestManager, super.platform);
@override @override
String id = 'files'; String id = appId;
static const String appId = 'files';
@override @override
LocalizationsDelegate localizationsDelegate = AppLocalizations.delegate; LocalizationsDelegate localizationsDelegate = AppLocalizations.delegate;
@ -68,4 +72,7 @@ class FilesApp extends AppImplementation<FilesBloc, FilesAppSpecificOptions> {
@override @override
Widget get page => const FilesMainPage(); Widget get page => const FilesMainPage();
@override
RouteBase get route => $filesAppRoute;
} }

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

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

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

3
packages/neon/neon_files/pubspec.yaml

@ -16,6 +16,7 @@ dependencies:
filesize: ^2.0.1 filesize: ^2.0.1
flutter: flutter:
sdk: flutter sdk: flutter
go_router: ^8.0.3
image_picker: ^0.8.7+5 image_picker: ^0.8.7+5
intersperse: ^2.0.0 intersperse: ^2.0.0
material_design_icons_flutter: ^7.0.7296 material_design_icons_flutter: ^7.0.7296
@ -35,6 +36,8 @@ dependencies:
share_plus: ^7.0.0 share_plus: ^7.0.0
dev_dependencies: dev_dependencies:
build_runner: ^2.4.4
go_router_builder: ^2.0.2
nit_picking: nit_picking:
git: git:
url: https://github.com/stack11/dart_nit_picking url: https://github.com/stack11/dart_nit_picking

Loading…
Cancel
Save