fixes before build

This commit is contained in:
gitea
2026-08-31 16:51:31 +02:00
parent 7692809219
commit 756f9db356
34 changed files with 3542 additions and 837 deletions
+8
View File
@@ -22,6 +22,14 @@ class LineItem {
/// Negative amount when a discount was folded into [price].
final double discount;
bool get hasDiscount => discount != 0;
/// List price before a folded discount. Equals [price] when there is none.
double get originalPrice {
if (!hasDiscount) return price;
return ((price - discount) * 100).round() / 100;
}
LineItem copyWith({
String? id,
String? name,
+1 -1
View File
@@ -72,4 +72,4 @@ class Product {
}
}
enum ProductSort { name, preferred }
enum ProductSort { name, preferred, start }
+5
View File
@@ -7,6 +7,7 @@ class ShoppingList {
required this.name,
required this.itemCount,
required this.checkedCount,
required this.createdAt,
required this.updatedAt,
});
@@ -14,6 +15,7 @@ class ShoppingList {
final String name;
final int itemCount;
final int checkedCount;
final DateTime createdAt;
final DateTime updatedAt;
factory ShoppingList.fromMap(Map<String, Object?> map) {
@@ -22,6 +24,9 @@ class ShoppingList {
name: map['name']! as String,
itemCount: (map['item_count'] as num?)?.toInt() ?? 0,
checkedCount: (map['checked_count'] as num?)?.toInt() ?? 0,
createdAt: DateTime.parse(
(map['created_at'] ?? map['updated_at'])! as String,
),
updatedAt: DateTime.parse(map['updated_at']! as String),
);
}
+8
View File
@@ -9,12 +9,14 @@ class Supermarket {
required this.name,
required this.colorValue,
this.sortOrder = 0,
this.bonusImagePath,
});
final int? id;
final String name;
final int colorValue;
final int sortOrder;
final String? bonusImagePath;
Color get color => Color(colorValue);
@@ -24,6 +26,7 @@ class Supermarket {
name: map['name']! as String,
colorValue: map['color']! as int,
sortOrder: map['sort_order'] as int? ?? 0,
bonusImagePath: map['bonus_image_path'] as String?,
);
}
@@ -32,12 +35,17 @@ class Supermarket {
String? name,
int? colorValue,
int? sortOrder,
String? bonusImagePath,
bool clearBonusImage = false,
}) {
return Supermarket(
id: id ?? this.id,
name: name ?? this.name,
colorValue: colorValue ?? this.colorValue,
sortOrder: sortOrder ?? this.sortOrder,
bonusImagePath: clearBonusImage
? null
: (bonusImagePath ?? this.bonusImagePath),
);
}
}