mirror of
https://github.com/Mercantec-GHC/h4-projekt-gruppe-0-sm.git
synced 2025-04-27 16:24:07 +02:00
product list page
This commit is contained in:
parent
559df9494a
commit
f5d9507427
BIN
mobile/assets/boykisser.png
Normal file
BIN
mobile/assets/boykisser.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
@ -1,19 +1,98 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'global_components.dart';
|
||||
|
||||
class ProductListItem extends StatelessWidget {
|
||||
final String name;
|
||||
final int price;
|
||||
final String imagePath;
|
||||
const ProductListItem(
|
||||
{super.key,
|
||||
required this.name,
|
||||
required this.price,
|
||||
required this.imagePath});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.all(10),
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFFFFFFF),
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.all(Radius.circular(10))),
|
||||
child: ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all(Colors.transparent),
|
||||
elevation: WidgetStateProperty.all(0),
|
||||
shape: WidgetStateProperty.all(RoundedRectangleBorder()),
|
||||
padding: WidgetStateProperty.all(EdgeInsets.zero),
|
||||
splashFactory: NoSplash.splashFactory),
|
||||
onPressed: () {},
|
||||
child: Expanded(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.fromLTRB(10, 10, 0, 10),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
name,
|
||||
style: TextStyle(fontSize: 24, color: Colors.black),
|
||||
),
|
||||
Text(
|
||||
"${price.toString()} kr",
|
||||
style: TextStyle(fontSize: 16, color: Colors.black),
|
||||
)
|
||||
],
|
||||
)),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.only(
|
||||
topRight: Radius.circular(10),
|
||||
bottomRight: Radius.circular(10)),
|
||||
child:
|
||||
Image(image: AssetImage(imagePath), fit: BoxFit.contain))
|
||||
],
|
||||
))),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Dashboard extends StatelessWidget {
|
||||
const Dashboard({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Scaffold(
|
||||
body: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
Column(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
Text(
|
||||
"Not implemented",
|
||||
style: TextStyle(fontSize: 32),
|
||||
)
|
||||
])
|
||||
]));
|
||||
return Scaffold(
|
||||
body: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(children: [
|
||||
TextField(
|
||||
decoration: InputDecoration(
|
||||
label: Text("Search"),
|
||||
contentPadding: EdgeInsets.only(top: 20))),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: [
|
||||
ProductListItem(
|
||||
name: "idk",
|
||||
price: 12,
|
||||
imagePath: "assets/boykisser.png",
|
||||
),
|
||||
ProductListItem(
|
||||
name: "idk",
|
||||
price: 12,
|
||||
imagePath: "assets/boykisser.png",
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
]),
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,11 @@ class PrimaryButton extends StatelessWidget {
|
||||
final void Function()? onPressed;
|
||||
final Widget child;
|
||||
|
||||
const PrimaryButton(
|
||||
{super.key, required this.onPressed, required this.child});
|
||||
const PrimaryButton({
|
||||
super.key,
|
||||
required this.onPressed,
|
||||
required this.child,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -22,14 +25,15 @@ class PrimaryInput extends StatelessWidget {
|
||||
final double height;
|
||||
final String label;
|
||||
final String placeholderText;
|
||||
final bool obscure;
|
||||
|
||||
const PrimaryInput(
|
||||
{super.key,
|
||||
this.width = 300,
|
||||
this.height = 100,
|
||||
this.obscure = false,
|
||||
required this.label,
|
||||
required this.placeholderText});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
@ -40,6 +44,7 @@ class PrimaryInput extends StatelessWidget {
|
||||
border: const OutlineInputBorder(),
|
||||
label: Text(label),
|
||||
hintText: placeholderText),
|
||||
obscureText: obscure,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ class LogInPage extends StatelessWidget {
|
||||
),
|
||||
const PrimaryInput(
|
||||
label: "Mail/Tlf", placeholderText: "f.eks. example@example.com"),
|
||||
const PrimaryInput(label: "Password", placeholderText: "*********"),
|
||||
const PrimaryInput(
|
||||
label: "Password", placeholderText: "*********", obscure: true),
|
||||
PrimaryButton(
|
||||
onPressed: () => {
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
|
@ -14,6 +14,7 @@ class MyApp extends StatelessWidget {
|
||||
title: 'Fresh Plaza',
|
||||
theme: ThemeData(
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
|
||||
scaffoldBackgroundColor: const Color(0xECF6F0FF),
|
||||
useMaterial3: true,
|
||||
),
|
||||
home: const MyHomePage(title: 'Fresh Plaza'),
|
||||
|
@ -19,9 +19,12 @@ class RegisterPage extends StatelessWidget {
|
||||
const PrimaryInput(label: "Fornavn", placeholderText: "Fornavn"),
|
||||
const PrimaryInput(
|
||||
label: "Mail/Tlf", placeholderText: "f.eks. example@example.com"),
|
||||
const PrimaryInput(label: "Password", placeholderText: "*********"),
|
||||
const PrimaryInput(
|
||||
label: "Password (igen)", placeholderText: "*********"),
|
||||
label: "Password", placeholderText: "*********", obscure: true),
|
||||
const PrimaryInput(
|
||||
label: "Password (igen)",
|
||||
placeholderText: "*********",
|
||||
obscure: true),
|
||||
PrimaryButton(
|
||||
onPressed: () => {
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
|
@ -51,7 +51,8 @@ dev_dependencies:
|
||||
|
||||
# The following section is specific to Flutter packages.
|
||||
flutter:
|
||||
|
||||
assets:
|
||||
- assets/
|
||||
# The following line ensures that the Material Icons font is
|
||||
# included with your application, so that you can use the icons in
|
||||
# the material Icons class.
|
||||
|
Loading…
x
Reference in New Issue
Block a user