64 lines
1.8 KiB
Dart
64 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'login_form_parts.dart';
|
|
|
|
enum LoginAudience { school, guardian }
|
|
|
|
/// First login step: who is signing in. School accounts and guardians use
|
|
/// entirely different forms, so the choice comes before any input.
|
|
class LoginAudienceCard extends StatelessWidget {
|
|
final ValueChanged<LoginAudience> onSelected;
|
|
|
|
const LoginAudienceCard({required this.onSelected, super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) => LoginCardFrame(
|
|
title: 'Anmelden',
|
|
hint: 'Bite wähle deine Anmeldemethode',
|
|
children: [
|
|
_AudienceButton(
|
|
key: const Key('login-audience-school'),
|
|
icon: Icons.school_outlined,
|
|
label: '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',
|
|
onPressed: () => onSelected(LoginAudience.guardian),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
class _AudienceButton extends StatelessWidget {
|
|
final IconData icon;
|
|
final String label;
|
|
final VoidCallback onPressed;
|
|
|
|
const _AudienceButton({
|
|
required this.icon,
|
|
required this.label,
|
|
required this.onPressed,
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) => SizedBox(
|
|
height: 64,
|
|
child: FilledButton.tonalIcon(
|
|
onPressed: onPressed,
|
|
icon: Icon(icon, size: 26),
|
|
label: Text(label),
|
|
style: FilledButton.styleFrom(
|
|
alignment: Alignment.centerLeft,
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
|
textStyle: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
|
|
),
|
|
),
|
|
);
|
|
}
|