Start writing the web app
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
Signed-off-by: Nikolai Rodionov <allanger@posteo.com>
This commit was merged in pull request #5.
This commit is contained in:
105
lib/features/authorization/presentation/register_form.dart
Normal file
105
lib/features/authorization/presentation/register_form.dart
Normal file
@@ -0,0 +1,105 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:softplayer_web/features/authorization/application/authorization_application.dart';
|
||||
import 'package:softplayer_web/features/authorization/application/sign_up_data.dart';
|
||||
|
||||
class RegisterForm extends ConsumerStatefulWidget {
|
||||
const RegisterForm({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<RegisterForm> createState() => _RegisterForm();
|
||||
}
|
||||
|
||||
class _RegisterForm extends ConsumerState<RegisterForm> {
|
||||
final emailCtrl = TextEditingController();
|
||||
final nameCtrl = TextEditingController();
|
||||
final surnameCtrl = TextEditingController();
|
||||
final passwordCtrl = TextEditingController();
|
||||
final repeatPasswordCtrl = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final controller = ref.read(authorizationControllerProvider.notifier);
|
||||
return SizedBox(
|
||||
width: 400,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
alignment: Alignment.topLeft,
|
||||
child: SelectableText(
|
||||
"Welcome!",
|
||||
style: Theme.of(context).textTheme.headlineLarge,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
Container(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"Already have an account? ",
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
TextButton(
|
||||
onPressed: controller.toggleAuthMode,
|
||||
style: TextButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: Size(0, 0),
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
child: const Text(
|
||||
"Sign in",
|
||||
style: TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 36),
|
||||
TextField(
|
||||
controller: nameCtrl,
|
||||
decoration: InputDecoration(hintText: "Name"),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
TextField(
|
||||
controller: surnameCtrl,
|
||||
decoration: InputDecoration(hintText: "Surname"),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
TextField(
|
||||
controller: emailCtrl,
|
||||
decoration: InputDecoration(hintText: "Email address"),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
TextField(
|
||||
controller: passwordCtrl,
|
||||
obscureText: true,
|
||||
decoration: InputDecoration(hintText: "Password"),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
TextField(
|
||||
controller: repeatPasswordCtrl,
|
||||
obscureText: true,
|
||||
decoration: InputDecoration(hintText: "Repeat the password"),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
final form = SignUpData(
|
||||
email: emailCtrl.text,
|
||||
password: passwordCtrl.text,
|
||||
name: nameCtrl.text,
|
||||
surname: surnameCtrl.text,
|
||||
);
|
||||
|
||||
ref.read(authorizationControllerProvider.notifier).signup(form);
|
||||
},
|
||||
child: const Text('Sign up'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user