Compare commits
No commits in common. "e06d75d1404855510c2451d7948023f3a318570a" and "943631043fe304d8377e525633f1c3c9b3b676a6" have entirely different histories.
e06d75d140
...
943631043f
6 changed files with 12 additions and 12 deletions
|
@ -14,7 +14,7 @@ class WalletCategory {
|
||||||
required this.color,
|
required this.color,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Connects the generated fromJson method
|
/// Connects generated fromJson method
|
||||||
factory WalletCategory.fromJson(Map<String, dynamic> json) =>
|
factory WalletCategory.fromJson(Map<String, dynamic> json) =>
|
||||||
_$WalletCategoryFromJson(json);
|
_$WalletCategoryFromJson(json);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class WalletCategory {
|
||||||
@JsonKey(fromJson: _colorFromJson, toJson: _colorToJson)
|
@JsonKey(fromJson: _colorFromJson, toJson: _colorToJson)
|
||||||
Color color;
|
Color color;
|
||||||
|
|
||||||
/// Connects the generated toJson method
|
/// Connects generated toJson method
|
||||||
Map<String, dynamic> toJson() => _$WalletCategoryToJson(this);
|
Map<String, dynamic> toJson() => _$WalletCategoryToJson(this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -7,7 +7,7 @@ class EntryData {
|
||||||
/// Contains raw data
|
/// Contains raw data
|
||||||
EntryData({required this.name, required this.amount, this.description = ""});
|
EntryData({required this.name, required this.amount, this.description = ""});
|
||||||
|
|
||||||
/// Connects the generated fromJson method
|
/// Connects generated fromJson method
|
||||||
factory EntryData.fromJson(Map<String, dynamic> json) =>
|
factory EntryData.fromJson(Map<String, dynamic> json) =>
|
||||||
_$EntryDataFromJson(json);
|
_$EntryDataFromJson(json);
|
||||||
|
|
||||||
|
@ -20,6 +20,6 @@ class EntryData {
|
||||||
/// Amount for entry
|
/// Amount for entry
|
||||||
double amount;
|
double amount;
|
||||||
|
|
||||||
/// Connects the generated toJson method
|
/// Connects generated toJson method
|
||||||
Map<String, dynamic> toJson() => _$EntryDataToJson(this);
|
Map<String, dynamic> toJson() => _$EntryDataToJson(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,11 @@ class RecurringWalletEntry extends WalletSingleEntry {
|
||||||
this.repeatAfter = 1,
|
this.repeatAfter = 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Connects the generated fromJson method
|
/// Connects generated fromJson method
|
||||||
factory RecurringWalletEntry.fromJson(Map<String, dynamic> json) =>
|
factory RecurringWalletEntry.fromJson(Map<String, dynamic> json) =>
|
||||||
_$RecurringWalletEntryFromJson(json);
|
_$RecurringWalletEntryFromJson(json);
|
||||||
|
|
||||||
/// Connects the generated toJson method
|
/// Connects generated toJson method
|
||||||
@override
|
@override
|
||||||
Map<String, dynamic> toJson() => _$RecurringWalletEntryToJson(this);
|
Map<String, dynamic> toJson() => _$RecurringWalletEntryToJson(this);
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Wallet {
|
||||||
this.starterBalance = 0,
|
this.starterBalance = 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Connects the generated fromJson method
|
/// Connects generated fromJson method
|
||||||
factory Wallet.fromJson(Map<String, dynamic> json) => _$WalletFromJson(json);
|
factory Wallet.fromJson(Map<String, dynamic> json) => _$WalletFromJson(json);
|
||||||
|
|
||||||
/// A list of all [RecurringWalletEntry]s
|
/// A list of all [RecurringWalletEntry]s
|
||||||
|
@ -54,7 +54,7 @@ class Wallet {
|
||||||
@JsonKey(fromJson: _currencyFromJson)
|
@JsonKey(fromJson: _currencyFromJson)
|
||||||
final Currency currency;
|
final Currency currency;
|
||||||
|
|
||||||
/// Connects the generated toJson method
|
/// Connects generated toJson method
|
||||||
Map<String, dynamic> toJson() => _$WalletToJson(this);
|
Map<String, dynamic> toJson() => _$WalletToJson(this);
|
||||||
|
|
||||||
/// Getter for the next unused unique number ID in the wallet's **entry** list
|
/// Getter for the next unused unique number ID in the wallet's **entry** list
|
||||||
|
@ -163,7 +163,7 @@ class Wallet {
|
||||||
/// Returns the current balance
|
/// Returns the current balance
|
||||||
///
|
///
|
||||||
/// Basically just takes *starterBalance* and adds all the entries to it
|
/// Basically just takes *starterBalance* and adds all the entries to it
|
||||||
double get currentBalance {
|
double calculateCurrentBalance() {
|
||||||
var toAdd = 0.0;
|
var toAdd = 0.0;
|
||||||
for (final e in entries) {
|
for (final e in entries) {
|
||||||
toAdd += (e.type == EntryType.income) ? e.data.amount : -e.data.amount;
|
toAdd += (e.type == EntryType.income) ? e.data.amount : -e.data.amount;
|
||||||
|
|
|
@ -17,7 +17,7 @@ class WalletSingleEntry {
|
||||||
required this.id,
|
required this.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Connects the generated fromJson method
|
/// Connects generated fromJson method
|
||||||
factory WalletSingleEntry.fromJson(Map<String, dynamic> json) =>
|
factory WalletSingleEntry.fromJson(Map<String, dynamic> json) =>
|
||||||
_$WalletSingleEntryFromJson(json);
|
_$WalletSingleEntryFromJson(json);
|
||||||
|
|
||||||
|
@ -36,6 +36,6 @@ class WalletSingleEntry {
|
||||||
/// Unique entry ID
|
/// Unique entry ID
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
/// Connects the generated toJson method
|
/// Connects generated toJson method
|
||||||
Map<String, dynamic> toJson() => _$WalletSingleEntryToJson(this);
|
Map<String, dynamic> toJson() => _$WalletSingleEntryToJson(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,7 +298,7 @@ class _HomeViewState extends State<HomeView> {
|
||||||
locale: locale,
|
locale: locale,
|
||||||
symbol: selectedWallet!.currency.symbol,
|
symbol: selectedWallet!.currency.symbol,
|
||||||
).format(
|
).format(
|
||||||
selectedWallet!.currentBalance,
|
selectedWallet!.calculateCurrentBalance(),
|
||||||
),
|
),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
|
Loading…
Reference in a new issue