Skip to content

Commit

Permalink
Rework homework page for teacher and parents (#1644)
Browse files Browse the repository at this point in the history
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
Jonas-Sander authored Jul 31, 2024
1 parent 31326e9 commit 3679017
Show file tree
Hide file tree
Showing 157 changed files with 2,200 additions and 3,925 deletions.
2 changes: 1 addition & 1 deletion app/lib/dashboard/bloc/dashboard_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import 'package:bloc_base/bloc_base.dart';
import 'package:clock/clock.dart';
import 'package:date/date.dart';
import 'package:design/design.dart';
import 'package:firebase_hausaufgabenheft_logik/firebase_hausaufgabenheft_logik.dart';
import 'package:group_domain_models/group_domain_models.dart';
import 'package:hausaufgabenheft_logik/hausaufgabenheft_logik.dart' hide Date;
import 'package:rxdart/rxdart.dart';
import 'package:sharezone/blackboard/blackboard_item.dart';
import 'package:sharezone/blackboard/blackboard_view.dart';
Expand Down
2 changes: 1 addition & 1 deletion app/lib/dashboard/dashboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import 'package:sharezone/dashboard/update_reminder/update_reminder_bloc.dart';
import 'package:sharezone/dashboard/widgets/blackboard_card_dashboard.dart';
import 'package:sharezone/download_app_tip/widgets/download_app_tip_card.dart';
import 'package:sharezone/holidays/holiday_bloc.dart';
import 'package:sharezone/homework/parent/homework_page.dart';
import 'package:sharezone/homework/homework_page.dart';
import 'package:sharezone/homework/shared/homework_card.dart';
import 'package:sharezone/keys.dart';
import 'package:sharezone/main/application_bloc.dart';
Expand Down
3 changes: 2 additions & 1 deletion app/lib/dashboard/models/homework_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
// SPDX-License-Identifier: EUPL-1.2

import 'package:clock/clock.dart';
import 'package:firebase_hausaufgabenheft_logik/firebase_hausaufgabenheft_logik.dart';

import 'package:flutter/material.dart';
import 'package:group_domain_models/group_domain_models.dart';
import 'package:hausaufgabenheft_logik/hausaufgabenheft_logik.dart';
import 'package:intl/intl.dart';
import 'package:sharezone/util/api/course_gateway.dart';

Expand Down
7 changes: 4 additions & 3 deletions app/lib/homework/homework_details/homework_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@

import 'package:bloc_provider/bloc_provider.dart';
import 'package:common_domain_models/common_domain_models.dart';
import 'package:firebase_hausaufgabenheft_logik/firebase_hausaufgabenheft_logik.dart';

import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:hausaufgabenheft_logik/hausaufgabenheft_logik.dart';
import 'package:sharezone/main/application_bloc.dart';
import 'package:sharezone/comments/comments_gateway.dart';
import 'package:sharezone/comments/widgets/comment_section_builder.dart';
import 'package:sharezone/filesharing/dialog/attachment_list.dart';
import 'package:sharezone/homework/teacher/homework_done_by_users_list/homework_completion_user_list_page.dart';
import 'package:sharezone/homework/teacher_and_parent/homework_done_by_users_list/homework_completion_user_list_page.dart';
import 'package:sharezone/navigation/logic/navigation_bloc.dart';
import 'package:sharezone/navigation/models/navigation_item.dart';
import 'package:sharezone/homework/homework_details/homework_details_view_factory.dart';
import 'package:sharezone/homework/homework_dialog/homework_dialog.dart';
import 'package:sharezone/homework/parent/homework_page.dart';
import 'package:sharezone/homework/homework_page.dart';
import 'package:sharezone/report/report_icon.dart';
import 'package:sharezone/report/report_item.dart';
import 'package:sharezone/submissions/homework_list_submissions_page.dart';
Expand Down
3 changes: 2 additions & 1 deletion app/lib/homework/homework_details/homework_details_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
// SPDX-License-Identifier: EUPL-1.2

import 'package:filesharing_logic/filesharing_logic_models.dart';
import 'package:firebase_hausaufgabenheft_logik/firebase_hausaufgabenheft_logik.dart';
import 'package:hausaufgabenheft_logik/hausaufgabenheft_logik.dart';

import 'package:user/user.dart';

class HomeworkDetailsView {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// SPDX-License-Identifier: EUPL-1.2

import 'package:bloc_base/bloc_base.dart';
import 'package:firebase_hausaufgabenheft_logik/firebase_hausaufgabenheft_logik.dart';

import 'package:group_domain_models/group_domain_models.dart';
import 'package:hausaufgabenheft_logik/hausaufgabenheft_logik.dart';
import 'package:intl/intl.dart';
Expand Down
3 changes: 2 additions & 1 deletion app/lib/homework/homework_dialog/homework_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ import 'package:collection/collection.dart';
import 'package:common_domain_models/common_domain_models.dart';
import 'package:date/date.dart';
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
import 'package:firebase_hausaufgabenheft_logik/firebase_hausaufgabenheft_logik.dart';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart' as bloc_lib show BlocProvider;
import 'package:flutter_bloc/flutter_bloc.dart' hide BlocProvider;
import 'package:hausaufgabenheft_logik/hausaufgabenheft_logik.dart' hide Date;
import 'package:platform_check/platform_check.dart';
import 'package:provider/provider.dart';
import 'package:sharezone/filesharing/dialog/attach_file.dart';
Expand Down
3 changes: 2 additions & 1 deletion app/lib/homework/homework_dialog/homework_dialog_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import 'package:fast_immutable_collections/fast_immutable_collections.dart';
import 'package:files_basics/files_models.dart';
import 'package:files_basics/local_file.dart';
import 'package:filesharing_logic/filesharing_logic_models.dart';
import 'package:firebase_hausaufgabenheft_logik/firebase_hausaufgabenheft_logik.dart';

import 'package:group_domain_models/group_domain_models.dart';
import 'package:hausaufgabenheft_logik/hausaufgabenheft_logik.dart' hide Date;
import 'package:meta/meta.dart';
import 'package:sharezone/markdown/markdown_analytics.dart';
import 'package:sharezone/util/api.dart';
Expand Down
3 changes: 2 additions & 1 deletion app/lib/homework/homework_dialog/open_homework_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
// SPDX-License-Identifier: EUPL-1.2

import 'package:common_domain_models/common_domain_models.dart';
import 'package:firebase_hausaufgabenheft_logik/firebase_hausaufgabenheft_logik.dart';

import 'package:flutter/material.dart';
import 'package:hausaufgabenheft_logik/hausaufgabenheft_logik.dart';
import 'package:sharezone/homework/homework_dialog/homework_dialog.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';

Expand Down
74 changes: 74 additions & 0 deletions app/lib/homework/homework_page.dart
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();
}
}
}
50 changes: 0 additions & 50 deletions app/lib/homework/homework_page_new.dart

This file was deleted.

Loading

0 comments on commit 3679017

Please sign in to comment.