mirror of
https://github.com/Mercantec-GHC/h4-projekt-gruppe-0-sm.git
synced 2025-04-28 08:44:06 +02:00
home page
This commit is contained in:
parent
55b87419be
commit
11c6e9cad3
@ -65,15 +65,17 @@ class AllProductsPage extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(children: [
|
child: Column(children: [
|
||||||
const Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
BackButton(),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: Container(
|
||||||
|
margin: const EdgeInsets.only(left: 10, right: 10),
|
||||||
|
child: const TextField(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
label: Text("Search"),
|
label: Text("Search"),
|
||||||
contentPadding: EdgeInsets.only(top: 20))),
|
contentPadding: EdgeInsets.only(top: 20))),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
@ -135,7 +135,8 @@ class CartPage extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return SafeArea(
|
||||||
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Consumer<CartRepo>(
|
child: Consumer<CartRepo>(
|
||||||
@ -156,7 +157,8 @@ class CartPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
decoration: const BoxDecoration(color: Color(0xFFFFFFFF), boxShadow: [
|
decoration:
|
||||||
|
const BoxDecoration(color: Color(0xFFFFFFFF), boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
blurRadius: 10,
|
blurRadius: 10,
|
||||||
spreadRadius: -4,
|
spreadRadius: -4,
|
||||||
@ -171,7 +173,8 @@ class CartPage extends StatelessWidget {
|
|||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.only(right: 10),
|
margin: const EdgeInsets.only(right: 10),
|
||||||
child: PrimaryButton(
|
child: PrimaryButton(
|
||||||
onPressed: () {}, child: const Text("Indtast vare")),
|
onPressed: () {},
|
||||||
|
child: const Text("Indtast vare")),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
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/pages/home_page.dart';
|
||||||
import 'package:mobile/repos/bottom_navigation_bar.dart';
|
import 'package:mobile/repos/bottom_navigation_bar.dart';
|
||||||
import 'package:mobile/repos/cart.dart';
|
import 'package:mobile/repos/cart.dart';
|
||||||
|
import 'package:mobile/repos/user.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class Dashboard extends StatelessWidget {
|
class Dashboard extends StatelessWidget {
|
||||||
final List<StatelessWidget> pages = [
|
final User user;
|
||||||
const HomePage(),
|
|
||||||
|
final List<StatelessWidget> pages = [];
|
||||||
|
|
||||||
|
Dashboard({super.key, required this.user}) {
|
||||||
|
pages.addAll([
|
||||||
|
HomePage(
|
||||||
|
user: user,
|
||||||
|
),
|
||||||
const AllProductsPage(),
|
const AllProductsPage(),
|
||||||
const CartPage(),
|
const CartPage(),
|
||||||
const AllReceiptsPage(),
|
const AllReceiptsPage(),
|
||||||
];
|
]);
|
||||||
|
}
|
||||||
Dashboard({super.key});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -1,10 +1,72 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:mobile/repos/user.dart';
|
||||||
|
|
||||||
class HomePage extends StatelessWidget {
|
class HomePage extends StatelessWidget {
|
||||||
const HomePage({super.key});
|
final User user;
|
||||||
|
const HomePage({super.key, required this.user});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
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 =
|
final loginResult =
|
||||||
usersRepo.login(mailController.text, passwordController.text);
|
usersRepo.login(mailController.text, passwordController.text);
|
||||||
if (loginResult is Ok) {
|
if (loginResult is Ok) {
|
||||||
Navigator.of(context)
|
Navigator.of(context).push(MaterialPageRoute(
|
||||||
.push(MaterialPageRoute(builder: (context) => Dashboard()));
|
builder: (context) =>
|
||||||
|
Dashboard(user: (loginResult as Ok).value)));
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
loginError = true;
|
loginError = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user