added categories, import export, settings

This commit is contained in:
davmar
2026-08-29 16:45:27 +02:00
parent 2a5a922aab
commit 732a0dc14a
30 changed files with 3700 additions and 167 deletions
+36
View File
@@ -0,0 +1,36 @@
/// One time a product was bought, used for price and purchase history.
library;
class Purchase {
const Purchase({
required this.shopId,
required this.boughtAt,
required this.supermarket,
required this.price,
this.quantity,
this.unitPrice,
this.receiptImagePath,
});
final int shopId;
final DateTime boughtAt;
final String supermarket;
final double price;
final int? quantity;
final double? unitPrice;
final String? receiptImagePath;
double get unitOrLinePrice => unitPrice ?? price;
factory Purchase.fromMap(Map<String, Object?> map) {
return Purchase(
shopId: map['shop_id']! as int,
boughtAt: DateTime.parse(map['shopped_at']! as String),
supermarket: map['supermarket']! as String,
price: (map['price']! as num).toDouble(),
quantity: map['quantity'] as int?,
unitPrice: (map['unit_price'] as num?)?.toDouble(),
receiptImagePath: map['receipt_image_path'] as String?,
);
}
}