Add login page

This commit is contained in:
Reimar 2024-08-20 14:04:40 +02:00
parent d2bfcc4692
commit 3bd2ba5cbc
Signed by: Reimar
GPG Key ID: 93549FA07F0AE268
2 changed files with 49 additions and 18 deletions

41
Mobile/lib/login.dart Normal file
View File

@ -0,0 +1,41 @@
import 'package:flutter/material.dart';
class LoginPage extends StatefulWidget {
const LoginPage({super.key, required this.title});
final String title;
@override
State<LoginPage> createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
@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('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('Login'), onPressed: () => Navigator.pop(context)),
const SizedBox(height: 10),
TextButton(child: const Text('Registrer konto'), onPressed: () {})
]
)
)
)
);
}
}

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_map/flutter_map.dart';
import "package:latlong2/latlong.dart"; import "package:latlong2/latlong.dart";
import "login.dart";
void main() { void main() {
runApp(const MyApp()); runApp(const MyApp());
@ -30,10 +31,10 @@ class MyApp extends StatelessWidget {
// //
// This works for code too, not just values: Most code changes can be // This works for code too, not just values: Most code changes can be
// tested with just a hot reload. // tested with just a hot reload.
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
useMaterial3: true, useMaterial3: true,
), ),
home: const MyHomePage(title: 'H4 med Flutter'), home: const MyHomePage(title: 'SkanTravels'),
); );
} }
} }
@ -57,19 +58,6 @@ class MyHomePage extends StatefulWidget {
} }
class _MyHomePageState extends State<MyHomePage> { class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -90,9 +78,11 @@ class _MyHomePageState extends State<MyHomePage> {
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
FloatingActionButton( FloatingActionButton(
onPressed: _incrementCounter, onPressed: () {
tooltip: 'Increment', Navigator.push(context, MaterialPageRoute(builder: (context) => const LoginPage(title: "Login")));
child: const Icon(Icons.add), },
tooltip: 'Login',
child: const Icon(Icons.login),
), ),
], ],
), ),