Skip to content

Commit f014c63

Browse files
Complete go_router migration
1 parent 270c9d0 commit f014c63

57 files changed

Lines changed: 590 additions & 686 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

school_data_hub_flutter/lib/core/router/app_router.dart

Lines changed: 106 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import 'package:school_data_hub_flutter/features/books/presentation/book_infos_s
5858
import 'package:school_data_hub_flutter/features/books/presentation/edit_book_screen/edit_book_controller.dart';
5959
import 'package:school_data_hub_flutter/features/books/domain/models/library_book_proxy.dart';
6060
import 'package:school_data_hub_flutter/features/learning/competence_report/presentation/competence_report_item_list_screen/competence_report_item_list_scope.dart';
61+
import 'package:school_data_hub_flutter/features/learning/competence/presentation/pupil_list_learning_screen/widgets/pupil_competence_goals/new_competence_goal_page.dart';
6162
// School lists
6263
import 'package:school_data_hub_flutter/features/school_lists/presentation/school_lists_screen/school_lists_screen.dart';
6364
import 'package:school_data_hub_flutter/features/school_lists/presentation/new_list_screen/new_school_list_screen.dart';
@@ -67,6 +68,7 @@ import 'package:school_data_hub_flutter/features/authorizations/presentation/new
6768
import 'package:school_data_hub_flutter/features/authorizations/presentation/authorization_pupils_screen/authorization_pupils_screen.dart';
6869
// School calendar
6970
import 'package:school_data_hub_flutter/features/school_calendar/presentation/school_semester_list_screen/school_semester_list_screen.dart';
71+
import 'package:school_data_hub_flutter/features/school_calendar/presentation/new_school_semester_screen/new_school_semester_screen.dart';
7072
// Tools
7173
import 'package:school_data_hub_flutter/features/timetable/presentation/timetable_screen/timetable_screen.dart';
7274
import 'package:school_data_hub_flutter/features/timetable/presentation/new_timetable_screen/new_timetable_screen.dart';
@@ -91,6 +93,7 @@ import 'package:school_data_hub_flutter/features/matrix/rooms/presentation/matri
9193
import 'package:school_data_hub_flutter/features/matrix/rooms/presentation/new_matrix_room_screen/new_matrix_room_screen.dart';
9294
import 'package:school_data_hub_flutter/features/matrix/policy/presentation/matrix_event_reports_screen/matrix_event_reports_screen.dart';
9395
import 'package:school_data_hub_flutter/features/matrix/users/presentation/select_matrix_users_list_screen/controller/select_matrix_users_list_controller.dart';
96+
import 'package:school_data_hub_flutter/features/matrix/rooms/presentation/select_matrix_rooms_list_screen/controller/select_matrix_rooms_list_controller.dart';
9497
import 'package:school_data_hub_flutter/features/matrix/rooms/domain/models/matrix_room.dart';
9598
import 'package:school_data_hub_flutter/features/matrix/users/domain/models/matrix_user.dart';
9699
// Admin / User
@@ -109,6 +112,12 @@ import 'package:school_data_hub_flutter/features/school/presentation/edit_school
109112
import 'package:school_data_hub_flutter/app_utils/logger/presentation/logs_screen/logs_screen.dart';
110113
import 'package:school_data_hub_flutter/features/user/presentation/change_password/change_password_screen.dart';
111114
import 'package:school_data_hub_flutter/features/books/presentation/book_search_form_screen/book_search_form_screen.dart';
115+
import 'package:school_data_hub_flutter/features/books/presentation/book_search_form_screen/select_book_tags_screen.dart';
116+
import 'package:school_data_hub_flutter/features/books/presentation/book_search_screen/book_search_results_screen.dart';
117+
import 'package:school_data_hub_flutter/features/books/presentation/book_tag_management_screen/book_tag_management_controller.dart';
118+
import 'package:school_data_hub_flutter/features/books/presentation/new_book_screen/new_book_controller.dart';
119+
import 'package:school_data_hub_flutter/features/books/presentation/edit_book_screen/book_tag_selection_screen.dart';
120+
import 'package:school_data_hub_flutter/features/books/domain/models/enums.dart';
112121
import 'package:school_data_hub_flutter/features/statistics/chart_screen/chart_page_controller.dart';
113122
import 'package:school_data_hub_flutter/features/statistics/statistics_screen/controller/statistics.dart';
114123
import 'package:school_data_hub_flutter/app_utils/shorebird_code_push_screen.dart';
@@ -283,6 +292,12 @@ class AppRouter {
283292
path: RoutePaths.schoolSemesters,
284293
builder: (_, __) => const SchoolSemesterListScreen(),
285294
),
295+
GoRoute(
296+
path: RoutePaths.schoolSemesterNew,
297+
builder: (_, state) => NewSchoolSemesterScreen(
298+
semester: state.extra as SchoolSemester?,
299+
),
300+
),
286301
GoRoute(
287302
path: RoutePaths.learningCompetencesSortable,
288303
builder: (_, __) => const CompetenceSortableListScreen(),
@@ -297,7 +312,9 @@ class AppRouter {
297312
),
298313
GoRoute(
299314
path: RoutePaths.adminUsersNew,
300-
builder: (_, __) => const CreateOrEditUserScreen(),
315+
builder: (_, state) => CreateOrEditUserScreen(
316+
userWithDevices: state.extra as UserWithDevices?,
317+
),
301318
),
302319
GoRoute(
303320
path: RoutePaths.adminUsersResetPassword,
@@ -389,6 +406,17 @@ class AppRouter {
389406
as void Function(BuildContext, Competence)?,
390407
),
391408
),
409+
GoRoute(
410+
path: RoutePaths.learningCompetenceGoalNew,
411+
builder: (_, state) {
412+
final args = state.extra as Map<String, dynamic>?;
413+
return NewCompetenceGoalScreen(
414+
pupilId: args?['pupilId'] as int?,
415+
competenceId: args?['competenceId'] as int?,
416+
existingGoal: args?['existingGoal'] as CompetenceGoal?,
417+
);
418+
},
419+
),
392420

393421
// --- Learning Competence Report ---
394422
GoRoute(
@@ -521,6 +549,15 @@ class AppRouter {
521549
);
522550
},
523551
),
552+
GoRoute(
553+
path: RoutePaths.adminMatrixSelectRooms,
554+
builder: (_, state) {
555+
final args = state.extra! as Map<String, dynamic>;
556+
return SelectMatrixRoomsList(
557+
args['selectableRooms'] as List<String>?,
558+
);
559+
},
560+
),
524561

525562
// --- Admin / User ---
526563
GoRoute(
@@ -542,6 +579,71 @@ class AppRouter {
542579
libraryId: state.extra! as String,
543580
),
544581
),
582+
GoRoute(
583+
path: RoutePaths.learningBooksTags,
584+
builder: (_, __) => const BookTagManagement(),
585+
),
586+
GoRoute(
587+
path: RoutePaths.learningBooksSelectTags,
588+
builder: (_, state) {
589+
final args = state.extra as Map<String, dynamic>?;
590+
return SelectBookTagsScreen(
591+
initialSelectedTags:
592+
(args?['initialSelectedTags'] as List<dynamic>?)
593+
?.cast<BookTag>() ??
594+
const [],
595+
);
596+
},
597+
),
598+
GoRoute(
599+
path: RoutePaths.learningBooksNew,
600+
builder: (_, state) {
601+
final args = state.extra! as Map<String, dynamic>;
602+
return NewBook(
603+
isEdit: args['isEdit'] as bool,
604+
isbn: args['isbn'] as int,
605+
libraryId: args['libraryId'] as String?,
606+
bookTitle: args['bookTitle'] as String?,
607+
bookAuthor: args['bookAuthor'] as String?,
608+
bookDescription: args['bookDescription'] as String?,
609+
bookReadingLevel: args['bookReadingLevel'] as String?,
610+
location: args['location'] as LibraryBookLocation?,
611+
bookAvailable: args['bookAvailable'] as bool?,
612+
imageId: args['imageId'] as String?,
613+
bookTags: (args['bookTags'] as List<dynamic>?)
614+
?.cast<BookTagging>(),
615+
);
616+
},
617+
),
618+
GoRoute(
619+
path: RoutePaths.learningBooksTagSelection,
620+
builder: (_, state) {
621+
final args = state.extra! as Map<String, dynamic>;
622+
return BookTagSelectionScreen(
623+
allTags: (args['allTags'] as List<dynamic>).cast<BookTag>(),
624+
selectedTagIds: (args['selectedTagIds'] as Set<dynamic>)
625+
.cast<int>(),
626+
);
627+
},
628+
),
629+
GoRoute(
630+
path: RoutePaths.learningBooksResults,
631+
builder: (_, state) {
632+
final args = state.extra as Map<String, dynamic>?;
633+
return BookSearchResultsScreen(
634+
title: args?['title'] as String?,
635+
author: args?['author'] as String?,
636+
keywords: args?['keywords'] as String?,
637+
location: args?['location'] as LibraryBookLocation?,
638+
readingLevel: args?['readingLevel'] as String?,
639+
borrowStatus: args?['borrowStatus'] as BorrowedStatus?,
640+
selectedTags:
641+
(args?['selectedTags'] as List<dynamic>?)
642+
?.cast<BookTag>() ??
643+
const [],
644+
);
645+
},
646+
),
545647

546648
// --- Timetable ---
547649
GoRoute(
@@ -653,6 +755,9 @@ class AppRouter {
653755
return PdfViewerScreen(
654756
pdfGenerator: args['pdfGenerator'] as Future<File> Function(),
655757
title: (args['title'] as String?) ?? 'PDF Vorschau',
758+
iconData:
759+
(args['iconData'] as IconData?) ?? Icons.picture_as_pdf,
760+
showZoomButton: (args['showZoomButton'] as bool?) ?? false,
656761
);
657762
},
658763
),

school_data_hub_flutter/lib/core/router/route_paths.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ abstract final class RoutePaths {
3939
static const schoolEdit = '/school/edit';
4040
static const schoolCalendar = '/school/calendar';
4141
static const schoolSemesters = '/school/semesters';
42+
static const schoolSemesterNew = '/school/semesters/new';
4243

4344
// --- Authorizations ---
4445
static const authorizationNew = '/authorizations/new';
@@ -102,6 +103,7 @@ abstract final class RoutePaths {
102103
// --- Books (additional) ---
103104
static const learningBooksEdit = '/learning/books/edit';
104105
static const learningBooksInfo = '/learning/books/info';
106+
static const learningBooksTagSelection = '/learning/books/tag-selection';
105107

106108
// --- Tools ---
107109
static const toolsTimetable = '/tools/timetable';
@@ -139,6 +141,7 @@ abstract final class RoutePaths {
139141
static const adminMatrixRoomNew = '/admin/matrix/rooms/new';
140142
static const adminMatrixEventReports = '/admin/matrix/event-reports';
141143
static const adminMatrixSelectUsers = '/admin/matrix/select-users';
144+
static const adminMatrixSelectRooms = '/admin/matrix/select-rooms';
142145

143146
// --- Admin (additional) ---
144147
static const adminUsersBatchImport = '/admin/users/batch-import';

school_data_hub_flutter/lib/features/_pupil/presentation/pupil_identity_stream_screen/connection_code_dialog.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import 'package:flutter/material.dart';
22
import 'package:gap/gap.dart';
3+
import 'package:go_router/go_router.dart';
34
import 'package:school_data_hub_flutter/common/widgets/orient_ui/style.dart';
5+
import 'package:school_data_hub_flutter/core/router/route_paths.dart';
46
import 'package:school_data_hub_flutter/features/_pupil/domain/models/enums.dart';
5-
import 'package:school_data_hub_flutter/features/_pupil/presentation/pupil_identity_stream_screen/pupil_identity_stream_screen.dart';
67

78
Future<void> showConnectionCodeDialog(BuildContext context) async {
89
final controller = TextEditingController();
@@ -42,14 +43,13 @@ Future<void> showConnectionCodeDialog(BuildContext context) async {
4243
final code = controller.text.trim();
4344
if (code.isNotEmpty) {
4445
Navigator.of(context).pop();
45-
Navigator.of(context, rootNavigator: true).push(
46-
MaterialPageRoute<void>(
47-
builder: (context) => PupilIdentityStreamScreen(
48-
role: PupilIdentityStreamRole.receiver,
49-
encryptedData: null,
50-
importedChannelName: code,
51-
),
52-
),
46+
context.push(
47+
RoutePaths.pupilIdentityStream,
48+
extra: {
49+
'role': PupilIdentityStreamRole.receiver,
50+
'encryptedData': null,
51+
'importedChannelName': code,
52+
},
5353
);
5454
}
5555
},

school_data_hub_flutter/lib/features/_pupil/presentation/pupil_profile_screen/pupil_profile_screen_content/authorization_content/pupil_profile_authorization_entry_card.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'dart:io';
33
import 'package:flutter/material.dart';
44
import 'package:flutter_it/flutter_it.dart';
55
import 'package:gap/gap.dart';
6+
import 'package:go_router/go_router.dart';
67
import 'package:school_data_hub_client/school_data_hub_client.dart';
78
import 'package:school_data_hub_flutter/app_utils/create_and_crop_image_file.dart';
89
import 'package:school_data_hub_flutter/common/widgets/buttons_switches/custom_checkbox_either_or.dart';
@@ -11,8 +12,8 @@ import 'package:school_data_hub_flutter/common/widgets/dialogs/long_textfield_di
1112
import 'package:school_data_hub_flutter/common/widgets/hub_document/encrypted_document_image.dart';
1213
import 'package:school_data_hub_flutter/common/widgets/orient_ui/card_box.dart';
1314
import 'package:school_data_hub_flutter/common/widgets/orient_ui/style.dart';
15+
import 'package:school_data_hub_flutter/core/router/route_paths.dart';
1416
import 'package:school_data_hub_flutter/features/authorizations/domain/authorization_manager.dart';
15-
import 'package:school_data_hub_flutter/features/authorizations/presentation/authorization_pupils_screen/authorization_pupils_screen.dart';
1617
import 'package:school_data_hub_flutter/features/_pupil/domain/models/pupil_proxy.dart';
1718

1819
class PupilProfileAuthorizationCard extends WatchingWidget {
@@ -51,11 +52,9 @@ class PupilProfileAuthorizationCard extends WatchingWidget {
5152
children: [
5253
GestureDetector(
5354
onTap: () {
54-
Navigator.of(context, rootNavigator: true).push(
55-
MaterialPageRoute<void>(
56-
builder: (ctx) =>
57-
AuthorizationPupilsScreen(authorization),
58-
),
55+
context.push(
56+
RoutePaths.authorizationPupils,
57+
extra: authorization,
5958
);
6059
},
6160
onLongPress: () async {

0 commit comments

Comments
 (0)