-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework homework page for teacher and parents (#1644)
This reworks the homework page for teachers and parents in a way that is very similar to the current student page. Small difference: There is no overflow button in the bottom action bar (overflow is used by students where they can select "mark all overdue homeworks as completed") I also added the `firebase_hausaufgabenheft_logik` into the `hausaufgabenheft_logik`, since I don't really see that much benefit to separate it. | Parents | Teacher | |--------|--------| | ![image](https://github.com/user-attachments/assets/3c40814a-c568-4a04-bcb2-50a29e390943) | ![image](https://github.com/user-attachments/assets/7ff7b38a-a5d9-4ca7-9969-03c69b30a3c7) | | ![image](https://github.com/user-attachments/assets/8dfbd5bd-d9ea-44ed-b638-67f15f12a346) | ![image](https://github.com/user-attachments/assets/7ba21a86-b00b-4c29-a5ae-f96d048086e9) |
- Loading branch information
1 parent
31326e9
commit 3679017
Showing
157 changed files
with
2,200 additions
and
3,925 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright (c) 2022 Sharezone UG (haftungsbeschränkt) | ||
// Licensed under the EUPL-1.2-or-later. | ||
// | ||
// You may obtain a copy of the Licence at: | ||
// https://joinup.ec.europa.eu/software/page/eupl | ||
// | ||
// SPDX-License-Identifier: EUPL-1.2 | ||
|
||
import 'dart:async'; | ||
|
||
import 'package:common_domain_models/common_domain_models.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:hausaufgabenheft_logik/hausaufgabenheft_logik.dart' | ||
hide StudentHomeworkPageBloc; | ||
import 'package:provider/provider.dart'; | ||
import 'package:sharezone/homework/homework_dialog/homework_dialog.dart'; | ||
import 'package:sharezone_widgets/sharezone_widgets.dart'; | ||
import 'package:user/user.dart'; | ||
|
||
import 'student/student_homework_page.dart'; | ||
import 'teacher_and_parent/teacher_and_parent_homework_page.dart'; | ||
|
||
enum SortBy { date, subject } | ||
|
||
Map<SortBy, String> sortByAsString = { | ||
SortBy.date: "Datum", | ||
SortBy.subject: "Fach", | ||
}; | ||
|
||
Future<void> openHomeworkDialogAndShowConfirmationIfSuccessful( | ||
BuildContext context, { | ||
HomeworkDto? homework, | ||
}) async { | ||
final successful = await Navigator.push<bool>( | ||
context, | ||
IgnoreWillPopScopeWhenIosSwipeBackRoute( | ||
builder: (context) => HomeworkDialog( | ||
id: homework?.id != null ? HomeworkId(homework!.id) : null, | ||
), | ||
settings: const RouteSettings(name: HomeworkDialog.tag), | ||
), | ||
); | ||
if (successful == true && context.mounted) { | ||
await showUserConfirmationOfHomeworkArrival(context: context); | ||
} | ||
} | ||
|
||
Future<void> showUserConfirmationOfHomeworkArrival({ | ||
required BuildContext context, | ||
}) async { | ||
await waitingForPopAnimation(); | ||
if (!context.mounted) return; | ||
showDataArrivalConfirmedSnackbar(context: context); | ||
} | ||
|
||
class HomeworkPage extends StatelessWidget { | ||
const HomeworkPage({super.key}); | ||
static const String tag = 'homework-page'; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final typeOfUser = Provider.of<TypeOfUser>(context); | ||
|
||
switch (typeOfUser) { | ||
case TypeOfUser.student: | ||
return const StudentHomeworkPage(); | ||
case TypeOfUser.teacher: | ||
case TypeOfUser.parent: | ||
return const TeacherAndParentHomeworkPage(); | ||
case TypeOfUser.unknown: | ||
throw UnimplementedError(); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.