simplified code across the app and consolidated duplicated helpers
This commit is contained in:
@@ -32,25 +32,14 @@ class _LoginCardState extends State<LoginCard> {
|
||||
final _passwordController = TextEditingController();
|
||||
final _passwordFocus = FocusNode();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
widget.controller.addListener(_onControllerChange);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
widget.controller.removeListener(_onControllerChange);
|
||||
_usernameController.dispose();
|
||||
_passwordController.dispose();
|
||||
_passwordFocus.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _onControllerChange() {
|
||||
if (mounted) setState(() {});
|
||||
}
|
||||
|
||||
String? _required(String? value) =>
|
||||
(value ?? '').trim().isEmpty ? 'Eingabe erforderlich' : null;
|
||||
|
||||
@@ -81,7 +70,10 @@ class _LoginCardState extends State<LoginCard> {
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget build(BuildContext context) =>
|
||||
ListenableBuilder(listenable: widget.controller, builder: _buildForm);
|
||||
|
||||
Widget _buildForm(BuildContext context, Widget? _) {
|
||||
final theme = Theme.of(context);
|
||||
final loading = widget.controller.loading;
|
||||
return Form(
|
||||
|
||||
Reference in New Issue
Block a user