added support for multiple accounts, guardian login bugfixes, ui changes

This commit is contained in:
2026-09-23 20:50:12 +02:00
parent 630497abdd
commit 84098af7e2
37 changed files with 1759 additions and 376 deletions
@@ -14,9 +14,13 @@ class GuardianLoginCard extends StatefulWidget {
final GuardianLoginController controller;
final VoidCallback onSuccess;
/// Signs in an additional account instead of the first one.
final bool addingAccount;
const GuardianLoginCard({
required this.controller,
required this.onSuccess,
this.addingAccount = false,
super.key,
});
@@ -118,7 +122,9 @@ class _GuardianLoginCardState extends State<GuardianLoginCard> {
return Form(
key: _emailFormKey,
child: LoginCardFrame(
title: 'Anmeldung für Eltern',
title: widget.addingAccount
? 'Elternkonto hinzufügen'
: 'Anmeldung für Eltern',
hint:
'Gib die E-Mail-Adresse ein, die bei der Schule hinterlegt ist. '
'Du erhältst einen Anmeldecode per E-Mail.',
@@ -194,7 +200,7 @@ class _GuardianLoginCardState extends State<GuardianLoginCard> {
const SizedBox(height: 20),
LoginSubmitButton(
key: const Key('guardian-verify-button'),
label: 'Anmelden',
label: widget.addingAccount ? 'Hinzufügen' : 'Anmelden',
loading: _controller.loading,
onPressed: _submitCode,
),
@@ -9,24 +9,35 @@ enum LoginAudience { school, guardian }
class LoginAudienceCard extends StatelessWidget {
final ValueChanged<LoginAudience> onSelected;
const LoginAudienceCard({required this.onSelected, super.key});
/// Signs in an additional account instead of the first one.
final bool addingAccount;
const LoginAudienceCard({
required this.onSelected,
this.addingAccount = false,
super.key,
});
@override
Widget build(BuildContext context) => LoginCardFrame(
title: 'Anmelden',
hint: 'Bitte wähle deine Anmeldemethode',
title: addingAccount ? 'Konto hinzufügen' : 'Anmelden',
hint: addingAccount
? 'Welches Konto möchtest du hinzufügen?'
: 'Bitte wähle deine Anmeldemethode',
children: [
_AudienceButton(
key: const Key('login-audience-school'),
icon: Icons.school_outlined,
label: 'Login für Schülerschaft & Lehrkräfte',
label: addingAccount
? 'Schulkonto (Schülerschaft & Lehrkräfte)'
: 'Login für Schülerschaft & Lehrkräfte',
onPressed: () => onSelected(LoginAudience.school),
),
const SizedBox(height: 12),
_AudienceButton(
key: const Key('login-audience-guardian'),
icon: Icons.family_restroom_outlined,
label: 'Login für Eltern',
label: addingAccount ? 'Elternkonto' : 'Login für Eltern',
onPressed: () => onSelected(LoginAudience.guardian),
),
],
+8 -2
View File
@@ -1,7 +1,10 @@
import 'package:flutter/material.dart';
class LoginHeader extends StatelessWidget {
const LoginHeader({super.key});
/// Signs in an additional account instead of the first one.
final bool addingAccount;
const LoginHeader({this.addingAccount = false, super.key});
@override
Widget build(BuildContext context) => Column(
@@ -29,7 +32,10 @@ class LoginHeader extends StatelessWidget {
),
const SizedBox(height: 6),
Text(
'Stundenplan, Talk, Dateien und mehr - alles an einem Ort für deinen Schulalltag am Marianum Fulda.',
addingAccount
? 'Melde ein weiteres Konto an. In den Einstellungen kannst du '
'danach jederzeit zwischen deinen Konten wechseln.'
: 'Stundenplan, Talk, Dateien und mehr - alles an einem Ort für deinen Schulalltag am Marianum Fulda.',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white.withValues(alpha: 0.85),
+10 -3
View File
@@ -12,9 +12,13 @@ class LoginCard extends StatefulWidget {
final LoginController controller;
final VoidCallback onSuccess;
/// Signs in an additional account instead of the first one.
final bool addingAccount;
const LoginCard({
required this.controller,
required this.onSuccess,
this.addingAccount = false,
super.key,
});
@@ -83,8 +87,11 @@ class _LoginCardState extends State<LoginCard> {
return Form(
key: _formKey,
child: LoginCardFrame(
title: 'Anmelden',
hint: 'Melde dich mit deinen Marianum-Zugangsdaten an.',
title: widget.addingAccount ? 'Schulkonto hinzufügen' : 'Anmelden',
hint: widget.addingAccount
? 'Melde dich mit den Marianum-Zugangsdaten des Kontos an, das '
'du hinzufügen möchtest.'
: 'Melde dich mit deinen Marianum-Zugangsdaten an.',
children: [
TextFormField(
key: const Key('login-username-field'),
@@ -127,7 +134,7 @@ class _LoginCardState extends State<LoginCard> {
const SizedBox(height: 20),
LoginSubmitButton(
key: const Key('login-submit-button'),
label: 'Anmelden',
label: widget.addingAccount ? 'Hinzufügen' : 'Anmelden',
loading: loading,
onPressed: _submit,
),