added guardian login with views for their assigned childs

This commit is contained in:
2026-09-20 11:11:58 +02:00
parent e4e2b1a4fb
commit 67c935c05b
117 changed files with 4784 additions and 1514 deletions
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import '../../../../access/user_role.dart';
import '../../../../api/marianumconnect/queries/user_search/user_search_response.dart';
import '../../../../widget/user_avatar.dart';
@@ -18,14 +19,14 @@ class UserSearchTile extends StatelessWidget {
leading: UserAvatar(id: user.username, isGroup: false),
title: Text('${user.firstName} ${user.lastName}'),
subtitle: Text(_subtitle),
trailing: RoleBadge(userType: user.userType),
trailing: RoleBadge(role: UserRole.parse(user.userType)),
onTap: onTap,
);
}
String get _subtitle {
final className = user.className;
if (user.userType == 'STUDENT' &&
if (UserRole.parse(user.userType) == UserRole.student &&
className != null &&
className.isNotEmpty) {
return '${user.username} · $className';
@@ -36,16 +37,17 @@ class UserSearchTile extends StatelessWidget {
/// Compact colour-coded badge distinguishing teachers, students and staff.
class RoleBadge extends StatelessWidget {
final String userType;
final UserRole role;
const RoleBadge({super.key, required this.userType});
const RoleBadge({super.key, required this.role});
@override
Widget build(BuildContext context) {
final (label, color) = switch (userType) {
'TEACHER' => ('Lehrkraft', Colors.blue),
'STUDENT' => ('Schüler:in', Colors.green),
_ => ('Personal', Colors.orange),
final (label, color) = switch (role) {
UserRole.teacher => ('Lehrkraft', Colors.blue),
UserRole.student => ('Schüler:in', Colors.green),
UserRole.parent => ('Elternteil', Colors.purple),
UserRole.staff || UserRole.unknown => ('Personal', Colors.orange),
};
return Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),