add cancel transaction

This commit is contained in:
2026-10-05 17:17:29 +07:00
parent a12a27c7b5
commit 39131f05b8
7 changed files with 137 additions and 9 deletions

View File

@@ -26,6 +26,7 @@ class Transaksi {
final double harga;
final double fee;
final double total;
final String state; // done | cancel
Transaksi({
required this.id,
@@ -37,9 +38,11 @@ class Transaksi {
required this.harga,
required this.fee,
required this.total,
this.state = 'done',
});
bool get isBuy => tipe == 'buy';
bool get isCancelled => state == 'cancel';
factory Transaksi.fromOdoo(Map<String, dynamic> m) {
String ticker = '';
@@ -58,6 +61,7 @@ class Transaksi {
harga: (m['harga'] as num?)?.toDouble() ?? 0,
fee: (m['fee'] as num?)?.toDouble() ?? 0,
total: (m['total'] as num?)?.toDouble() ?? 0,
state: (m['state'] as String?) ?? 'done',
);
}
}