Skip to content

Commit 138f902

Browse files
app: new pages family language & religion lessons lists
1 parent 88ef9a4 commit 138f902

11 files changed

Lines changed: 992 additions & 71 deletions

school_data_hub_flutter/lib/features/app_main_navigation/widgets/pupil_lists_buttons.dart

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import 'package:school_data_hub_flutter/features/learning_support/presentation/l
1010
import 'package:school_data_hub_flutter/features/matrix/users/presentation/matrix_users_list_page/matrix_users_list_page.dart';
1111
import 'package:school_data_hub_flutter/features/ogs/ogs_list_page.dart';
1212
import 'package:school_data_hub_flutter/features/pupil/presentation/_credit/credit_list_page/credit_list_page.dart';
13+
import 'package:school_data_hub_flutter/features/pupil/presentation/family_language_lessons_page/family_language_lessons_list_page.dart';
14+
import 'package:school_data_hub_flutter/features/pupil/presentation/religion_page/religion_list_page.dart';
1315
import 'package:school_data_hub_flutter/features/pupil/presentation/special_info_page/special_info_list_page.dart';
1416
import 'package:school_data_hub_flutter/l10n/app_localizations.dart';
1517
import 'package:watch_it/watch_it.dart';
@@ -71,7 +73,7 @@ class PupilListButtons extends WatchingWidget {
7173
),
7274
buttonText: locale.pupilCredit,
7375
),
74-
if (isReady && isTester)
76+
if (isReady)
7577
MainMenuButton(
7678
destinationPage: const LearningPupilListPage(),
7779
buttonIcon: const Icon(
@@ -99,6 +101,41 @@ class PupilListButtons extends WatchingWidget {
99101
),
100102
buttonText: locale.specialInfo,
101103
),
104+
const MainMenuButton(
105+
destinationPage: const ReligionListPage(),
106+
buttonIcon: const Row(
107+
mainAxisAlignment: MainAxisAlignment.center,
108+
crossAxisAlignment: CrossAxisAlignment.end,
109+
children: [
110+
Icon(
111+
Icons.mosque_rounded,
112+
size: 50,
113+
color: AppColors.gridViewColor,
114+
),
115+
Icon(
116+
Icons.church_rounded,
117+
size: 50,
118+
color: AppColors.gridViewColor,
119+
),
120+
],
121+
),
122+
buttonText: 'Reli-Unterricht',
123+
),
124+
const MainMenuButton(
125+
destinationPage: const FamilyLanguageLessonsListPage(),
126+
buttonIcon: const Row(
127+
mainAxisAlignment: MainAxisAlignment.center,
128+
crossAxisAlignment: CrossAxisAlignment.end,
129+
children: [
130+
Icon(
131+
Icons.translate_rounded,
132+
size: 50,
133+
color: AppColors.gridViewColor,
134+
),
135+
],
136+
),
137+
buttonText: 'HKU',
138+
),
102139
MainMenuButton(
103140
destinationPage: const OgsListPage(),
104141
buttonIcon: Text(

school_data_hub_flutter/lib/features/learning/presentation/widgets/pupil_learning_content_expansion_tile_nav_bar.dart

Lines changed: 138 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:school_data_hub_flutter/common/theme/app_colors.dart';
3+
import 'package:school_data_hub_flutter/core/session/hub_session_manager.dart';
34
import 'package:school_data_hub_flutter/features/learning/presentation/pupil_competence_list_page/widgets/pupil_learning_content/pupil_learning_content_books.dart';
45
import 'package:school_data_hub_flutter/features/learning/presentation/pupil_competence_list_page/widgets/pupil_learning_content/pupil_learning_content_competence_goals.dart';
56
import 'package:school_data_hub_flutter/features/learning/presentation/pupil_competence_list_page/widgets/pupil_learning_content/pupil_learning_content_competence_statuses.dart';
@@ -86,79 +87,146 @@ class PupilLearningContentNavBar extends WatchingWidget {
8687
Row(
8788
mainAxisAlignment: MainAxisAlignment.spaceAround,
8889
children: [
89-
IconButton(
90-
isSelected: selectedContent == SelectedContent.competenceStatuses,
91-
icon: const Icon(
92-
Icons.lightbulb,
93-
color: AppColors.interactiveColor,
90+
if (di<HubSessionManager>().isTester)
91+
Column(
92+
mainAxisSize: MainAxisSize.min,
93+
children: [
94+
IconButton(
95+
isSelected:
96+
selectedContent == SelectedContent.competenceStatuses,
97+
icon: const Icon(
98+
Icons.lightbulb,
99+
color: AppColors.interactiveColor,
100+
),
101+
selectedIcon: const Icon(
102+
Icons.lightbulb,
103+
color: AppColors.accentColor,
104+
),
105+
onPressed: () {
106+
if (selectedContent !=
107+
SelectedContent.competenceStatuses) {
108+
selectedContentNotifier.select(
109+
SelectedContent.competenceStatuses,
110+
);
111+
112+
return;
113+
}
114+
},
115+
),
116+
Text(
117+
'Lernspuren',
118+
style: TextStyle(
119+
color:
120+
selectedContent == SelectedContent.competenceStatuses
121+
? AppColors.accentColor
122+
: AppColors.interactiveColor,
123+
fontSize: 12,
124+
),
125+
),
126+
],
94127
),
95-
selectedIcon: const Icon(
96-
Icons.lightbulb,
97-
color: AppColors.accentColor,
128+
if (di<HubSessionManager>().isTester)
129+
Column(
130+
mainAxisSize: MainAxisSize.min,
131+
children: [
132+
IconButton(
133+
isSelected:
134+
selectedContent == SelectedContent.competenceGoals,
135+
icon: const Icon(
136+
Icons.emoji_nature_rounded,
137+
color: AppColors.interactiveColor,
138+
),
139+
selectedIcon: const Icon(
140+
Icons.emoji_nature_rounded,
141+
color: AppColors.accentColor,
142+
),
143+
onPressed: () {
144+
if (selectedContent != SelectedContent.competenceGoals) {
145+
selectedContentNotifier.select(
146+
SelectedContent.competenceGoals,
147+
);
148+
149+
return;
150+
}
151+
},
152+
),
153+
Text(
154+
'Ziele',
155+
style: TextStyle(
156+
color: selectedContent == SelectedContent.competenceGoals
157+
? AppColors.accentColor
158+
: AppColors.interactiveColor,
159+
fontSize: 12,
160+
),
161+
),
162+
],
98163
),
99-
onPressed: () {
100-
if (selectedContent != SelectedContent.competenceStatuses) {
101-
selectedContentNotifier.select(
102-
SelectedContent.competenceStatuses,
103-
);
104-
105-
return;
106-
}
107-
},
108-
),
109-
// if (di<HubSessionManager>().isTester)
110-
// IconButton(
111-
// isSelected: selectedContent == SelectedContent.competenceGoals,
112-
// icon: const Icon(
113-
// Icons.emoji_nature_rounded,
114-
// color: AppColors.interactiveColor,
115-
// ),
116-
// selectedIcon: const Icon(
117-
// Icons.emoji_nature_rounded,
118-
// color: AppColors.accentColor,
119-
// ),
120-
// onPressed: () {
121-
// if (selectedContent != SelectedContent.competenceGoals) {
122-
// selectedContentNotifier.select(
123-
// SelectedContent.competenceGoals,
124-
// );
125-
126-
// return;
127-
// }
128-
// },
129-
// ),
130-
IconButton(
131-
isSelected: selectedContent == SelectedContent.workbooks,
132-
icon: const Icon(
133-
Icons.note_alt,
134-
color: AppColors.interactiveColor,
135-
),
136-
selectedIcon: const Icon(
137-
Icons.note_alt,
138-
color: AppColors.accentColor,
139-
),
140-
onPressed: () {
141-
if (selectedContent != SelectedContent.workbooks) {
142-
selectedContentNotifier.select(SelectedContent.workbooks);
143-
144-
return;
145-
}
146-
},
147-
),
148-
IconButton(
149-
isSelected: selectedContent == SelectedContent.books,
150-
icon: const Icon(Icons.book, color: AppColors.interactiveColor),
151-
selectedIcon: const Icon(
152-
Icons.book,
153-
color: AppColors.accentColor,
164+
if (di<HubSessionManager>().isTester)
165+
Column(
166+
mainAxisSize: MainAxisSize.min,
167+
children: [
168+
IconButton(
169+
isSelected: selectedContent == SelectedContent.workbooks,
170+
icon: const Icon(
171+
Icons.note_alt,
172+
color: AppColors.interactiveColor,
173+
),
174+
selectedIcon: const Icon(
175+
Icons.note_alt,
176+
color: AppColors.accentColor,
177+
),
178+
onPressed: () {
179+
if (selectedContent != SelectedContent.workbooks) {
180+
selectedContentNotifier.select(
181+
SelectedContent.workbooks,
182+
);
183+
184+
return;
185+
}
186+
},
187+
),
188+
Text(
189+
'Arbeitshefte',
190+
style: TextStyle(
191+
color: selectedContent == SelectedContent.workbooks
192+
? AppColors.accentColor
193+
: AppColors.interactiveColor,
194+
fontSize: 12,
195+
),
196+
),
197+
],
154198
),
155-
onPressed: () {
156-
if (selectedContent != SelectedContent.books) {
157-
selectedContentNotifier.select(SelectedContent.books);
158-
159-
return;
160-
}
161-
},
199+
Column(
200+
mainAxisSize: MainAxisSize.min,
201+
children: [
202+
IconButton(
203+
isSelected: selectedContent == SelectedContent.books,
204+
icon: const Icon(
205+
Icons.book,
206+
color: AppColors.interactiveColor,
207+
),
208+
selectedIcon: const Icon(
209+
Icons.book,
210+
color: AppColors.accentColor,
211+
),
212+
onPressed: () {
213+
if (selectedContent != SelectedContent.books) {
214+
selectedContentNotifier.select(SelectedContent.books);
215+
216+
return;
217+
}
218+
},
219+
),
220+
Text(
221+
'Bücher',
222+
style: TextStyle(
223+
color: selectedContent == SelectedContent.books
224+
? AppColors.accentColor
225+
: AppColors.interactiveColor,
226+
fontSize: 12,
227+
),
228+
),
229+
],
162230
),
163231
],
164232
),
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:gap/gap.dart';
3+
import 'package:school_data_hub_flutter/common/domain/filters/filters_state_manager.dart';
4+
import 'package:school_data_hub_flutter/common/theme/app_colors.dart';
5+
import 'package:school_data_hub_flutter/common/theme/styles.dart';
6+
import 'package:school_data_hub_flutter/common/widgets/generic_components/generic_sliver_list.dart';
7+
import 'package:school_data_hub_flutter/common/widgets/generic_components/generic_sliver_search_app_bar.dart';
8+
import 'package:school_data_hub_flutter/features/pupil/domain/filters/pupils_filter.dart';
9+
import 'package:school_data_hub_flutter/features/pupil/domain/models/pupil_proxy.dart';
10+
import 'package:school_data_hub_flutter/features/pupil/domain/pupil_manager.dart';
11+
import 'package:school_data_hub_flutter/features/pupil/presentation/family_language_lessons_page/widgets/family_language_lessons_card.dart';
12+
import 'package:school_data_hub_flutter/features/pupil/presentation/family_language_lessons_page/widgets/family_language_lessons_list_page_bottom_navbar.dart';
13+
import 'package:school_data_hub_flutter/features/pupil/presentation/family_language_lessons_page/widgets/family_language_lessons_list_search_bar.dart';
14+
import 'package:watch_it/watch_it.dart';
15+
16+
final _filterStateManager = di<FiltersStateManager>();
17+
18+
final _pupilManager = di<PupilManager>();
19+
20+
List<PupilProxy> familyLanguageLessonsFilter(List<PupilProxy> pupils) {
21+
List<PupilProxy> filteredPupils = [];
22+
bool filtersOn = false;
23+
for (PupilProxy pupil in pupils) {
24+
if (pupil.familyLanguageLessonsSince == null) {
25+
filtersOn = true;
26+
continue;
27+
}
28+
29+
filteredPupils.add(pupil);
30+
}
31+
if (filtersOn) {
32+
_filterStateManager.setFilterState(
33+
filterState: FilterState.pupil,
34+
value: true,
35+
);
36+
}
37+
return filteredPupils;
38+
}
39+
40+
void _onPop(bool didPop, dynamic result) {
41+
_filterStateManager.resetFilters();
42+
}
43+
44+
class FamilyLanguageLessonsListPage extends WatchingWidget {
45+
const FamilyLanguageLessonsListPage({super.key});
46+
47+
@override
48+
Widget build(BuildContext context) {
49+
List<PupilProxy> filteredPupils = watchValue(
50+
(PupilsFilter x) => x.filteredPupils,
51+
);
52+
List<PupilProxy> pupils = familyLanguageLessonsFilter(filteredPupils);
53+
onDispose(() {
54+
_filterStateManager.resetFilters();
55+
});
56+
return PopScope(
57+
onPopInvokedWithResult: (didPop, result) => _onPop(didPop, result),
58+
child: Scaffold(
59+
backgroundColor: AppColors.canvasColor,
60+
appBar: AppBar(
61+
centerTitle: true,
62+
backgroundColor: AppColors.backgroundColor,
63+
title: const Row(
64+
mainAxisAlignment: MainAxisAlignment.center,
65+
children: [
66+
Icon(Icons.translate, size: 25, color: Colors.white),
67+
Gap(10),
68+
Text(
69+
'Herkunftssprachlicher U.',
70+
style: AppStyles.appBarTextStyle,
71+
),
72+
],
73+
),
74+
automaticallyImplyLeading: false,
75+
),
76+
body: RefreshIndicator(
77+
onRefresh: () async => _pupilManager.updatePupilList(pupils),
78+
child: Center(
79+
child: ConstrainedBox(
80+
constraints: const BoxConstraints(maxWidth: 700),
81+
child: CustomScrollView(
82+
slivers: [
83+
const SliverGap(5),
84+
GenericSliverSearchAppBar(
85+
height: 110,
86+
title: FamilyLanguageLessonsListSearchBar(pupils: pupils),
87+
),
88+
GenericSliverListWithEmptyListCheck(
89+
items: pupils,
90+
itemBuilder: (_, pupil) => FamilyLanguageLessonsCard(pupil),
91+
),
92+
],
93+
),
94+
),
95+
),
96+
),
97+
bottomNavigationBar: FamilyLanguageLessonsListPageBottomNavBar(),
98+
),
99+
);
100+
}
101+
}

0 commit comments

Comments
 (0)