Add view and logik
This commit is contained in:
39
lib/controllers/signin_controller.dart
Normal file
39
lib/controllers/signin_controller.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user