40 lines
1.1 KiB
Dart
40 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
class SignInController extends GetxController {
|
|
final usernameController = TextEditingController();
|
|
final passwordController = TextEditingController();
|
|
|
|
@override
|
|
void onClose() {
|
|
usernameController.dispose();
|
|
passwordController.dispose();
|
|
super.onClose();
|
|
}
|
|
|
|
Future<void> registerUser() async {
|
|
final username = usernameController.text.trim();
|
|
final password = passwordController.text.trim();
|
|
|
|
if (username.isEmpty || password.isEmpty) {
|
|
Get.snackbar(
|
|
'Fehler',
|
|
'Bitte alle Felder ausfüllen',
|
|
snackPosition: SnackPosition.BOTTOM,
|
|
backgroundColor: Get.theme.colorScheme.error.withAlpha(26),
|
|
colorText: Get.theme.colorScheme.error,
|
|
);
|
|
return;
|
|
}
|
|
|
|
// TODO: Registrierungs-Logik implementieren
|
|
Get.snackbar(
|
|
'Erfolg',
|
|
'Benutzer "$username" wurde angelegt',
|
|
snackPosition: SnackPosition.BOTTOM,
|
|
backgroundColor: Get.theme.colorScheme.primary.withAlpha(26),
|
|
colorText: Get.theme.colorScheme.primary,
|
|
);
|
|
}
|
|
}
|