Skip to content

Commit 3193212

Browse files
client: refactor, implement school list filter, added competence checks count in learning searchbar info
1 parent 5015946 commit 3193212

15 files changed

Lines changed: 234 additions & 59 deletions

File tree

school_data_hub_flutter/lib/common/widgets/custom_checkbox_either_or.dart renamed to school_data_hub_flutter/lib/common/widgets/buttons_switches/custom_checkbox_either_or.dart

File renamed without changes.

school_data_hub_flutter/lib/common/widgets/generic_async_action_button.dart renamed to school_data_hub_flutter/lib/common/widgets/buttons_switches/generic_async_action_button.dart

File renamed without changes.

school_data_hub_flutter/lib/common/widgets/media_capture_buttons.dart renamed to school_data_hub_flutter/lib/common/widgets/buttons_switches/media_capture_buttons.dart

File renamed without changes.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import 'package:flutter/material.dart';
2+
3+
/// A reusable round button that behaves like a switch with active/inactive states.
4+
///
5+
/// Displays an icon in a circular container with different colors based on
6+
/// the [isActive] state. Supports both tap and long press interactions.
7+
class RoundButtonSwitch extends StatelessWidget {
8+
const RoundButtonSwitch({
9+
super.key,
10+
required this.icon,
11+
required this.isActive,
12+
required this.onTap,
13+
this.onLongPress,
14+
required this.activeBackgroundColor,
15+
required this.inactiveBackgroundColor,
16+
required this.activeIconColor,
17+
required this.inactiveIconColor,
18+
this.iconSize = 16,
19+
this.padding = const EdgeInsets.all(8),
20+
});
21+
22+
/// The icon to display in the button.
23+
final IconData icon;
24+
25+
/// Whether the button is in active state.
26+
final bool isActive;
27+
28+
/// Callback executed when the button is tapped.
29+
final VoidCallback onTap;
30+
31+
/// Optional callback executed when the button is long pressed.
32+
final VoidCallback? onLongPress;
33+
34+
/// Background color when the button is active.
35+
final Color activeBackgroundColor;
36+
37+
/// Background color when the button is inactive.
38+
final Color inactiveBackgroundColor;
39+
40+
/// Icon color when the button is active.
41+
final Color activeIconColor;
42+
43+
/// Icon color when the button is inactive.
44+
final Color inactiveIconColor;
45+
46+
/// Size of the icon. Defaults to 16.
47+
final double iconSize;
48+
49+
/// Padding inside the button. Defaults to EdgeInsets.all(8).
50+
final EdgeInsets padding;
51+
52+
@override
53+
Widget build(BuildContext context) {
54+
return InkWell(
55+
onTap: onTap,
56+
onLongPress: onLongPress,
57+
borderRadius: BorderRadius.circular(50),
58+
child: Container(
59+
padding: padding,
60+
decoration: BoxDecoration(
61+
color: isActive ? activeBackgroundColor : inactiveBackgroundColor,
62+
shape: BoxShape.circle,
63+
),
64+
child: Icon(
65+
icon,
66+
size: iconSize,
67+
color: isActive ? activeIconColor : inactiveIconColor,
68+
),
69+
),
70+
);
71+
}
72+
}

school_data_hub_flutter/lib/common/widgets/hub_document/hub_documents_section.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import 'package:school_data_hub_flutter/common/services/notification_service.dar
99
import 'package:school_data_hub_flutter/common/theme/app_colors.dart';
1010
import 'package:school_data_hub_flutter/common/widgets/dialogs/confirmation_dialog.dart';
1111
import 'package:school_data_hub_flutter/common/widgets/hub_document/encrypted_document_image.dart';
12-
import 'package:school_data_hub_flutter/common/widgets/media_capture_buttons.dart';
12+
import 'package:school_data_hub_flutter/common/widgets/buttons_switches/media_capture_buttons.dart';
1313
import 'package:school_data_hub_flutter/core/auth/auth_clearance_helper.dart';
1414
import 'package:school_data_hub_flutter/core/models/datetime_extensions.dart';
1515

school_data_hub_flutter/lib/features/authorizations/presentation/authorization_pupils_page/widgets/authorization_pupil_card.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:gap/gap.dart';
55
import 'package:school_data_hub_client/school_data_hub_client.dart';
66
import 'package:school_data_hub_flutter/app_utils/create_and_crop_image_file.dart';
77
import 'package:school_data_hub_flutter/common/theme/app_colors.dart';
8-
import 'package:school_data_hub_flutter/common/widgets/custom_checkbox_either_or.dart';
8+
import 'package:school_data_hub_flutter/common/widgets/buttons_switches/custom_checkbox_either_or.dart';
99
import 'package:school_data_hub_flutter/common/widgets/dialogs/confirmation_dialog.dart';
1010
import 'package:school_data_hub_flutter/common/widgets/dialogs/long_textfield_dialog.dart';
1111
import 'package:school_data_hub_flutter/common/widgets/hub_document/encrypted_document_image.dart';

school_data_hub_flutter/lib/features/learning/presentation/pupil_list_learning_page/widgets/pupil_list_learning_search_bar/_pupil_list_learning_search_bar.dart

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import 'package:school_data_hub_flutter/features/learning/presentation/pupil_lis
88
import 'package:school_data_hub_flutter/features/learning/presentation/pupil_list_learning_page/widgets/pupil_list_learning_search_bar/learning_goals_infos.dart';
99
import 'package:school_data_hub_flutter/features/learning/presentation/pupil_list_learning_page/widgets/pupil_list_learning_search_bar/pupil_book_lendings_infos.dart';
1010
import 'package:school_data_hub_flutter/features/learning/presentation/pupil_list_learning_page/widgets/pupil_list_learning_search_bar/pupil_workbooks_infos.dart';
11-
import 'package:school_data_hub_flutter/features/learning_support/domain/learning_support_helper.dart';
1211
import 'package:school_data_hub_flutter/features/learning_support/presentation/learning_support_list_page/widgets/learning_support_list_filter_bottom_sheet.dart';
1312
import 'package:school_data_hub_flutter/features/pupil/domain/filters/pupils_filter.dart';
1413
import 'package:school_data_hub_flutter/features/pupil/presentation/widgets/pupil_search_text_field.dart';
@@ -88,6 +87,14 @@ class PupilListLearningSearchBarInfos extends WatchingWidget {
8887

8988
switch (selectedContent) {
9089
case SelectedContent.competenceStatuses:
90+
// Calculate total competence checks across all filtered pupils
91+
int totalCompetenceChecks = 0;
92+
for (final pupil in pupils) {
93+
if (pupil.competenceChecks != null) {
94+
totalCompetenceChecks += pupil.competenceChecks!.length;
95+
}
96+
}
97+
9198
return Row(
9299
crossAxisAlignment: CrossAxisAlignment.center,
93100
children: [
@@ -107,36 +114,8 @@ class PupilListLearningSearchBarInfos extends WatchingWidget {
107114
style: TextStyle(color: Colors.black, fontSize: 13),
108115
),
109116
const Gap(5),
110-
const Text(
111-
'Platzhalter',
112-
style: TextStyle(
113-
color: Colors.black,
114-
fontWeight: FontWeight.bold,
115-
fontSize: 20,
116-
),
117-
),
118-
const Gap(15),
119-
const Text(
120-
'2: ',
121-
style: TextStyle(color: Colors.black, fontSize: 13),
122-
),
123-
const Gap(5),
124-
Text(
125-
(LearningSupportHelper.developmentPlan2Pupils(pupils)).toString(),
126-
style: const TextStyle(
127-
color: Colors.black,
128-
fontWeight: FontWeight.bold,
129-
fontSize: 20,
130-
),
131-
),
132-
const Gap(15),
133-
const Text(
134-
'3: ',
135-
style: TextStyle(color: Colors.black, fontSize: 13),
136-
),
137-
const Gap(5),
138117
Text(
139-
(LearningSupportHelper.developmentPlan3Pupils(pupils)).toString(),
118+
totalCompetenceChecks.toString(),
140119
style: const TextStyle(
141120
color: Colors.black,
142121
fontWeight: FontWeight.bold,

school_data_hub_flutter/lib/features/pupil/presentation/pupil_profile_page/widgets/pupil_profile_page_content/authorization_content/pupil_content_authorization_entry_card.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:gap/gap.dart';
55
import 'package:school_data_hub_client/school_data_hub_client.dart';
66
import 'package:school_data_hub_flutter/app_utils/create_and_crop_image_file.dart';
77
import 'package:school_data_hub_flutter/common/theme/app_colors.dart';
8-
import 'package:school_data_hub_flutter/common/widgets/custom_checkbox_either_or.dart';
8+
import 'package:school_data_hub_flutter/common/widgets/buttons_switches/custom_checkbox_either_or.dart';
99
import 'package:school_data_hub_flutter/common/widgets/dialogs/confirmation_dialog.dart';
1010
import 'package:school_data_hub_flutter/common/widgets/dialogs/long_textfield_dialog.dart';
1111
import 'package:school_data_hub_flutter/common/widgets/hub_document/encrypted_document_image.dart';

school_data_hub_flutter/lib/features/pupil/presentation/pupil_profile_page/widgets/pupil_profile_page_content/school_list_content/widgets/pupil_profile_school_list_pupil_entry_card.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
22
import 'package:gap/gap.dart';
33
import 'package:school_data_hub_client/school_data_hub_client.dart';
44
import 'package:school_data_hub_flutter/common/theme/app_colors.dart';
5-
import 'package:school_data_hub_flutter/common/widgets/custom_checkbox_either_or.dart';
5+
import 'package:school_data_hub_flutter/common/widgets/buttons_switches/custom_checkbox_either_or.dart';
66
import 'package:school_data_hub_flutter/common/widgets/dialogs/confirmation_dialog.dart';
77
import 'package:school_data_hub_flutter/common/widgets/dialogs/long_textfield_dialog.dart';
88
import 'package:school_data_hub_flutter/features/school_lists/domain/models/pupil_list_entry_proxy.dart';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
enum SchoolListFilter { publicLists, myLists, otherLists }
2+
3+
Map<SchoolListFilter, bool> initialSchoolListFilterValues = {
4+
SchoolListFilter.publicLists: false,
5+
SchoolListFilter.myLists: false,
6+
SchoolListFilter.otherLists: false,
7+
};

0 commit comments

Comments
 (0)