forked from mgl_crew/Mitgliederladen
added Pfand to sample data
This commit is contained in:
parent
4bbd70464f
commit
7c9d449c63
4 changed files with 91 additions and 64 deletions
|
@ -4,7 +4,6 @@ import 'sample_data.dart';
|
|||
/* todo:
|
||||
- Flag für Ansicht/Bearbeitung
|
||||
- individuelle Icons je nach Kategorie
|
||||
- Pfand
|
||||
- Gesamtpreis
|
||||
*/
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import 'sample_data.dart';
|
|||
todo:
|
||||
- Einkauf und Settings
|
||||
- Warenkorb
|
||||
- Aufladungen?
|
||||
- farbliche Hervorhebungen
|
||||
- semanticLabels, Screenreader
|
||||
- monatliche Aufladung: ausstehende Beträge
|
||||
|
|
|
@ -76,11 +76,20 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||
],
|
||||
),
|
||||
body: <Widget>[
|
||||
Container(
|
||||
color: Colors.red,
|
||||
alignment: Alignment.center,
|
||||
child: Text('Page $test'),
|
||||
),
|
||||
Scaffold(
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: const Icon(Icons.shopping_cart),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
test++;
|
||||
});
|
||||
},
|
||||
),
|
||||
body: Container(
|
||||
color: Colors.green,
|
||||
alignment: Alignment.center,
|
||||
child: Text('Page $test'),
|
||||
)),
|
||||
const Finance(),
|
||||
ListView(children: const <Widget>[
|
||||
ListTile(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
final now = DateTime.now();
|
||||
final DateTime now = DateTime.now();
|
||||
|
||||
enum TransaktionArt { monatlBeitrag, aufladung, einkauf, korrektur }
|
||||
|
||||
|
@ -11,7 +11,8 @@ enum Category {
|
|||
drogerieUndHaushalt,
|
||||
kochenUndBacken,
|
||||
oeleSossenUndGewuerze,
|
||||
suessesUndKnabbereien
|
||||
suessesUndKnabbereien,
|
||||
pfand
|
||||
}
|
||||
|
||||
class Transaction {
|
||||
|
@ -21,8 +22,12 @@ class Transaction {
|
|||
DateTime date;
|
||||
List<Basket>? basket;
|
||||
String? description;
|
||||
Transaction(this.type, this.amount, this.date,
|
||||
{this.description, this.basket});
|
||||
Transaction(
|
||||
{required this.type,
|
||||
required this.amount,
|
||||
required this.date,
|
||||
this.description,
|
||||
this.basket});
|
||||
}
|
||||
|
||||
class Product {
|
||||
|
@ -49,7 +54,8 @@ class SampleData {
|
|||
Product('Milch', Unit.stueck, 2.23, 3, Category.getraenke),
|
||||
Product('Zahnpasta', Unit.stueck, 0.23, 7, Category.drogerieUndHaushalt),
|
||||
Product('Pfeffer', Unit.stueck, 0.23, 7, Category.oeleSossenUndGewuerze),
|
||||
Product('Schokolade', Unit.menge, 0.23, 7, Category.suessesUndKnabbereien)
|
||||
Product('Schokolade', Unit.menge, 0.23, 7, Category.suessesUndKnabbereien),
|
||||
Product('Flaschenpfand', Unit.stueck, -0.15, 0, Category.pfand)
|
||||
];
|
||||
|
||||
static List<Basket> basket = [
|
||||
|
@ -67,7 +73,8 @@ class SampleData {
|
|||
Basket(products[1], 2241),
|
||||
Basket(products[3], 2),
|
||||
Basket(products[4], 4),
|
||||
Basket(products[6], 2)
|
||||
Basket(products[6], 2),
|
||||
Basket(products[7], 5)
|
||||
];
|
||||
|
||||
static List<Basket> basket3 = [
|
||||
|
@ -80,94 +87,107 @@ class SampleData {
|
|||
|
||||
List<Transaction> transactions = [
|
||||
Transaction(
|
||||
TransaktionArt.monatlBeitrag,
|
||||
0,
|
||||
now,
|
||||
type: TransaktionArt.monatlBeitrag,
|
||||
amount: 0,
|
||||
date: now,
|
||||
),
|
||||
Transaction(
|
||||
TransaktionArt.aufladung,
|
||||
2042,
|
||||
now,
|
||||
type: TransaktionArt.aufladung,
|
||||
amount: 2042,
|
||||
date: now,
|
||||
),
|
||||
Transaction(
|
||||
TransaktionArt.einkauf,
|
||||
-2442,
|
||||
now.subtract(const Duration(days: 2)),
|
||||
),
|
||||
type: TransaktionArt.einkauf,
|
||||
amount: -2442,
|
||||
date: now.subtract(const Duration(days: 2)),
|
||||
basket: basket),
|
||||
Transaction(
|
||||
TransaktionArt.korrektur,
|
||||
2332,
|
||||
now.subtract(const Duration(hours: 5)),
|
||||
type: TransaktionArt.korrektur,
|
||||
amount: 2332,
|
||||
date: now.subtract(const Duration(hours: 5)),
|
||||
description: 'Korrektur des Warenkorbs',
|
||||
basket: basket3,
|
||||
),
|
||||
Transaction(
|
||||
TransaktionArt.monatlBeitrag,
|
||||
0,
|
||||
now,
|
||||
type: TransaktionArt.monatlBeitrag,
|
||||
amount: 0,
|
||||
date: now,
|
||||
),
|
||||
Transaction(
|
||||
TransaktionArt.aufladung,
|
||||
2042,
|
||||
now,
|
||||
type: TransaktionArt.aufladung,
|
||||
amount: 2042,
|
||||
date: now,
|
||||
),
|
||||
Transaction(
|
||||
TransaktionArt.einkauf, -2442, now.subtract(const Duration(days: 2)),
|
||||
type: TransaktionArt.einkauf,
|
||||
amount: -2442,
|
||||
date: now.subtract(const Duration(days: 2)),
|
||||
basket: basket2),
|
||||
Transaction(
|
||||
TransaktionArt.korrektur, 2332, now.subtract(const Duration(hours: 5)),
|
||||
description: 'Korrektur des Warenkorbs'),
|
||||
type: TransaktionArt.korrektur,
|
||||
amount: 2332,
|
||||
date: now.subtract(const Duration(hours: 5)),
|
||||
description: 'Korrektur des FinanzAK'),
|
||||
Transaction(
|
||||
TransaktionArt.monatlBeitrag,
|
||||
0,
|
||||
now,
|
||||
type: TransaktionArt.monatlBeitrag,
|
||||
amount: 0,
|
||||
date: now,
|
||||
),
|
||||
Transaction(
|
||||
TransaktionArt.aufladung,
|
||||
2042,
|
||||
now,
|
||||
type: TransaktionArt.aufladung,
|
||||
amount: 2042,
|
||||
date: now,
|
||||
),
|
||||
Transaction(
|
||||
TransaktionArt.einkauf,
|
||||
-2442,
|
||||
now.subtract(const Duration(days: 2)),
|
||||
type: TransaktionArt.einkauf,
|
||||
amount: -2442,
|
||||
date: now.subtract(const Duration(days: 2)),
|
||||
basket: basket,
|
||||
),
|
||||
Transaction(
|
||||
TransaktionArt.korrektur, 2332, now.subtract(const Duration(hours: 5)),
|
||||
type: TransaktionArt.korrektur,
|
||||
amount: 2332,
|
||||
date: now.subtract(const Duration(hours: 5)),
|
||||
description: 'Korrektur des Warenkorbs'),
|
||||
Transaction(
|
||||
TransaktionArt.monatlBeitrag,
|
||||
0,
|
||||
now,
|
||||
type: TransaktionArt.monatlBeitrag,
|
||||
amount: 0,
|
||||
date: now,
|
||||
),
|
||||
Transaction(
|
||||
TransaktionArt.aufladung,
|
||||
2042,
|
||||
now,
|
||||
type: TransaktionArt.aufladung,
|
||||
amount: 2042,
|
||||
date: now,
|
||||
),
|
||||
Transaction(
|
||||
TransaktionArt.einkauf, -2442, now.subtract(const Duration(days: 2))),
|
||||
type: TransaktionArt.einkauf,
|
||||
amount: -2442,
|
||||
date: now.subtract(const Duration(days: 2)),
|
||||
basket: basket),
|
||||
Transaction(
|
||||
TransaktionArt.korrektur, 2332, now.subtract(const Duration(hours: 5)),
|
||||
type: TransaktionArt.korrektur,
|
||||
amount: 2332,
|
||||
date: now.subtract(const Duration(hours: 5)),
|
||||
description: 'Korrektur des Warenkorbs'),
|
||||
Transaction(
|
||||
TransaktionArt.monatlBeitrag,
|
||||
0,
|
||||
now,
|
||||
type: TransaktionArt.monatlBeitrag,
|
||||
amount: 0,
|
||||
date: now,
|
||||
),
|
||||
Transaction(
|
||||
TransaktionArt.aufladung,
|
||||
2042,
|
||||
now,
|
||||
type: TransaktionArt.aufladung,
|
||||
amount: 2042,
|
||||
date: now,
|
||||
),
|
||||
Transaction(
|
||||
TransaktionArt.einkauf,
|
||||
-2442,
|
||||
now.subtract(const Duration(days: 2)),
|
||||
),
|
||||
type: TransaktionArt.einkauf,
|
||||
amount: -2442,
|
||||
date: now.subtract(const Duration(days: 2)),
|
||||
basket: basket2),
|
||||
Transaction(
|
||||
TransaktionArt.korrektur, 2332, now.subtract(const Duration(hours: 5)),
|
||||
type: TransaktionArt.korrektur,
|
||||
amount: 2332,
|
||||
date: now.subtract(const Duration(hours: 5)),
|
||||
description: 'Korrektur des Warenkorbs'),
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue