mirror of
https://github.com/Mercantec-GHC/h4-projekt-gruppe-0-sm.git
synced 2025-04-28 00:34:06 +02:00
home page
This commit is contained in:
parent
55b87419be
commit
11c6e9cad3
@ -65,15 +65,17 @@ class AllProductsPage extends StatelessWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(children: [
|
||||
const Row(
|
||||
Row(
|
||||
children: [
|
||||
BackButton(),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(left: 10, right: 10),
|
||||
child: const TextField(
|
||||
decoration: InputDecoration(
|
||||
label: Text("Search"),
|
||||
contentPadding: EdgeInsets.only(top: 20))),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
|
@ -135,7 +135,8 @@ class CartPage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
return SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Consumer<CartRepo>(
|
||||
@ -156,7 +157,8 @@ class CartPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: const BoxDecoration(color: Color(0xFFFFFFFF), boxShadow: [
|
||||
decoration:
|
||||
const BoxDecoration(color: Color(0xFFFFFFFF), boxShadow: [
|
||||
BoxShadow(
|
||||
blurRadius: 10,
|
||||
spreadRadius: -4,
|
||||
@ -171,7 +173,8 @@ class CartPage extends StatelessWidget {
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(right: 10),
|
||||
child: PrimaryButton(
|
||||
onPressed: () {}, child: const Text("Indtast vare")),
|
||||
onPressed: () {},
|
||||
child: const Text("Indtast vare")),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -205,6 +208,7 @@ class CartPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -5,17 +5,24 @@ import 'package:mobile/pages/all_receipts_page.dart';
|
||||
import 'package:mobile/pages/home_page.dart';
|
||||
import 'package:mobile/repos/bottom_navigation_bar.dart';
|
||||
import 'package:mobile/repos/cart.dart';
|
||||
import 'package:mobile/repos/user.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class Dashboard extends StatelessWidget {
|
||||
final List<StatelessWidget> pages = [
|
||||
const HomePage(),
|
||||
final User user;
|
||||
|
||||
final List<StatelessWidget> pages = [];
|
||||
|
||||
Dashboard({super.key, required this.user}) {
|
||||
pages.addAll([
|
||||
HomePage(
|
||||
user: user,
|
||||
),
|
||||
const AllProductsPage(),
|
||||
const CartPage(),
|
||||
const AllReceiptsPage(),
|
||||
];
|
||||
|
||||
Dashboard({super.key});
|
||||
]);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -1,10 +1,72 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mobile/repos/user.dart';
|
||||
|
||||
class HomePage extends StatelessWidget {
|
||||
const HomePage({super.key});
|
||||
final User user;
|
||||
const HomePage({super.key, required this.user});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Column();
|
||||
return SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.only(right: 10),
|
||||
child: const SettingsMenu()),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("Velkommen ${user.name}"),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SettingsMenu extends StatefulWidget {
|
||||
const SettingsMenu({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => SettingsMenuState();
|
||||
}
|
||||
|
||||
class SettingsMenuState extends State<SettingsMenu> {
|
||||
final FocusNode buttonFocusNode = FocusNode(debugLabel: 'Menu Button');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MenuAnchor(
|
||||
childFocusNode: buttonFocusNode,
|
||||
menuChildren: <Widget>[
|
||||
MenuItemButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Text('Log ud'),
|
||||
),
|
||||
],
|
||||
builder: (_, MenuController controller, Widget? child) {
|
||||
return IconButton(
|
||||
focusNode: buttonFocusNode,
|
||||
onPressed: () {
|
||||
if (controller.isOpen) {
|
||||
controller.close();
|
||||
} else {
|
||||
controller.open();
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.settings),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -64,8 +64,9 @@ class LogInFormState extends State<LogInForm> {
|
||||
final loginResult =
|
||||
usersRepo.login(mailController.text, passwordController.text);
|
||||
if (loginResult is Ok) {
|
||||
Navigator.of(context)
|
||||
.push(MaterialPageRoute(builder: (context) => Dashboard()));
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
Dashboard(user: (loginResult as Ok).value)));
|
||||
} else {
|
||||
setState(() {
|
||||
loginError = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user