feat:"初始化仓库,并更新基础代码。"

This commit is contained in:
2026-01-14 09:25:52 +08:00
commit 9a91c40a97
140 changed files with 6513 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
class TransactionModel {
final String id;
final double amount;
final String type; // 'income' or 'expense'
final int categoryId;
final DateTime date;
final String? note;
final DateTime createdAt;
final DateTime updatedAt;
TransactionModel({
required this.id,
required this.amount,
required this.type,
required this.categoryId,
required this.date,
this.note,
required this.createdAt,
required this.updatedAt,
});
Map<String, dynamic> toMap() {
return {
'id': id,
'amount': amount,
'type': type,
'categoryId': categoryId,
'date': date.millisecondsSinceEpoch,
'note': note,
'createdAt': createdAt.millisecondsSinceEpoch,
'updatedAt': updatedAt.millisecondsSinceEpoch,
};
}
factory TransactionModel.fromMap(Map<String, dynamic> map) {
return TransactionModel(
id: map['id'],
amount: map['amount'],
type: map['type'],
categoryId: map['categoryId'],
date: DateTime.fromMillisecondsSinceEpoch(map['date']),
note: map['note'],
createdAt: DateTime.fromMillisecondsSinceEpoch(map['createdAt']),
updatedAt: DateTime.fromMillisecondsSinceEpoch(map['updatedAt']),
);
}
}