Initial and done prolly

This commit is contained in:
Andrew 2025-01-05 16:01:21 +07:00
commit 6f88b9966f
175 changed files with 15445 additions and 0 deletions

View file

@ -0,0 +1,93 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'login_controller.dart';
class LoginPage extends GetView<LoginController> {
const LoginPage({super.key});
@override
Widget build(BuildContext context) {
final size = Get.size;
return Obx(
() => Scaffold(
body: switch (controller.loginState.value) {
LoginState.idle => Center(
child: SizedBox(
width: max(size.width * 0.3, 300),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text(
"Представьтесь!",
style: TextStyle(
fontSize: 20,
),
),
const SizedBox(height: 16),
TextFormField(
controller: controller.loginController,
decoration: const InputDecoration(
label: Text("Логин"),
),
onChanged: (value) {
controller.loginController.text =
controller.sanitize(value);
},
),
const SizedBox(height: 4),
TextFormField(
controller: controller.passwordController,
decoration: const InputDecoration(
label: Text("Пароль"),
),
obscureText: true,
onChanged: (value) {
controller.passwordController.text =
controller.sanitize(value);
},
),
const SizedBox(height: 16),
Wrap(
spacing: 8,
runSpacing: 8,
children: [
ElevatedButton(
onPressed: () => controller.register(),
child: const Text("Зарегистрироваться"),
),
if (controller.anyUserExists.value)
ElevatedButton(
onPressed: () => controller.login(),
child: const Text("Войти"),
),
],
),
],
),
),
),
LoginState.loading => const Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"GM",
style: TextStyle(
fontSize: 20,
),
),
Text("Проверяем штуки..."),
SizedBox(height: 16),
CircularProgressIndicator(),
],
),
),
},
),
);
}
}