Display the list of expenses

This commit is contained in:
2025-07-14 16:49:32 +02:00
parent 547e9b7aad
commit 50812af2fc
7 changed files with 145 additions and 57 deletions

View File

@ -16,7 +16,7 @@ typedef ExpensesList = List<Expense>;
@freezed
abstract class BaseExpenseInfo with _$BaseExpenseInfo {
const factory BaseExpenseInfo({
required String label,
required String? label,
required double cost,
required DateTime time,
}) = _BaseExpenseInfo;
@ -53,6 +53,12 @@ abstract class Expense with _$Expense {
if (mimeType == "image/png") return "$id.png";
return id.toString();
}
/// Get expense label or null if empty
String? get labelOrNull => label == "" ? null : label;
/// Get expense date
DateTime get dateTime => DateTime.fromMillisecondsSinceEpoch(time * 1000);
}
@riverpod