From 1c6fc39b14af239b908eb57cd9fd96d10602f741 Mon Sep 17 00:00:00 2001 From: Reimar Date: Tue, 20 Aug 2024 14:53:06 +0200 Subject: [PATCH] Add register page --- Mobile/lib/login.dart | 8 +++++-- Mobile/lib/register.dart | 48 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 Mobile/lib/register.dart diff --git a/Mobile/lib/login.dart b/Mobile/lib/login.dart index 26b35ec..b3800c2 100644 --- a/Mobile/lib/login.dart +++ b/Mobile/lib/login.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'register.dart'; class LoginPage extends StatefulWidget { const LoginPage({super.key, required this.title}); @@ -29,9 +30,12 @@ class _LoginPageState extends State { const Text('Password'), const TextField(obscureText: true, enableSuggestions: false, autocorrect: false), const SizedBox(height: 30), - ElevatedButton(child: const Text('Login'), onPressed: () => Navigator.pop(context)), + ElevatedButton(child: const Text('Log ind'), onPressed: () => Navigator.pop(context)), const SizedBox(height: 10), - TextButton(child: const Text('Registrer konto'), onPressed: () {}) + TextButton( + child: const Text('Registrer konto'), + onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => const RegisterPage(title: 'Registrer'))), + ) ] ) ) diff --git a/Mobile/lib/register.dart b/Mobile/lib/register.dart new file mode 100644 index 0000000..c3cba7e --- /dev/null +++ b/Mobile/lib/register.dart @@ -0,0 +1,48 @@ +import 'package:flutter/material.dart'; +import 'login.dart'; + +class RegisterPage extends StatefulWidget { + const RegisterPage({super.key, required this.title}); + + final String title; + + @override + State createState() => _RegisterPageState(); +} + +class _RegisterPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: Theme.of(context).colorScheme.inversePrimary, + title: Text(widget.title), + ), + body: Center( + child: Container( + constraints: const BoxConstraints(minWidth: 100, maxWidth: 400), + child: Column( + children: [ + const SizedBox(height: 80), + const Text('Brugernavn'), + const TextField(), + const SizedBox(height: 30), + const Text('Email'), + const TextField(), + const SizedBox(height: 30), + const Text('Password'), + const TextField(obscureText: true, enableSuggestions: false, autocorrect: false), + const SizedBox(height: 30), + ElevatedButton(child: const Text('Registrer'), onPressed: () => Navigator.pop(context)), + const SizedBox(height: 10), + TextButton( + child: const Text('Log ind'), + onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => const LoginPage(title: 'Log ind'))) + ), + ] + ) + ) + ) + ); + } +}