chore: cosmetic changes

Change some comment text, also change current balance to a getter
This commit is contained in:
Matyáš Caras 2024-01-31 07:54:29 +01:00
parent a62c334342
commit cfd4d6200e
Signed by untrusted user who does not match committer: hernik
GPG key ID: 2A3175F98820C5C6
6 changed files with 12 additions and 12 deletions

View file

@ -14,7 +14,7 @@ class WalletCategory {
required this.color,
});
/// Connects generated fromJson method
/// Connects the generated fromJson method
factory WalletCategory.fromJson(Map<String, dynamic> json) =>
_$WalletCategoryFromJson(json);
@ -32,7 +32,7 @@ class WalletCategory {
@JsonKey(fromJson: _colorFromJson, toJson: _colorToJson)
Color color;
/// Connects generated toJson method
/// Connects the generated toJson method
Map<String, dynamic> toJson() => _$WalletCategoryToJson(this);
@override

View file

@ -7,7 +7,7 @@ class EntryData {
/// Contains raw data
EntryData({required this.name, required this.amount, this.description = ""});
/// Connects generated fromJson method
/// Connects the generated fromJson method
factory EntryData.fromJson(Map<String, dynamic> json) =>
_$EntryDataFromJson(json);
@ -20,6 +20,6 @@ class EntryData {
/// Amount for entry
double amount;
/// Connects generated toJson method
/// Connects the generated toJson method
Map<String, dynamic> toJson() => _$EntryDataToJson(this);
}

View file

@ -20,11 +20,11 @@ class RecurringWalletEntry extends WalletSingleEntry {
this.repeatAfter = 1,
});
/// Connects generated fromJson method
/// Connects the generated fromJson method
factory RecurringWalletEntry.fromJson(Map<String, dynamic> json) =>
_$RecurringWalletEntryFromJson(json);
/// Connects generated toJson method
/// Connects the generated toJson method
@override
Map<String, dynamic> toJson() => _$RecurringWalletEntryToJson(this);

View file

@ -30,7 +30,7 @@ class Wallet {
this.starterBalance = 0,
});
/// Connects generated fromJson method
/// Connects the generated fromJson method
factory Wallet.fromJson(Map<String, dynamic> json) => _$WalletFromJson(json);
/// A list of all [RecurringWalletEntry]s
@ -54,7 +54,7 @@ class Wallet {
@JsonKey(fromJson: _currencyFromJson)
final Currency currency;
/// Connects generated toJson method
/// Connects the generated toJson method
Map<String, dynamic> toJson() => _$WalletToJson(this);
/// Getter for the next unused unique number ID in the wallet's **entry** list
@ -163,7 +163,7 @@ class Wallet {
/// Returns the current balance
///
/// Basically just takes *starterBalance* and adds all the entries to it
double calculateCurrentBalance() {
double get currentBalance {
var toAdd = 0.0;
for (final e in entries) {
toAdd += (e.type == EntryType.income) ? e.data.amount : -e.data.amount;

View file

@ -17,7 +17,7 @@ class WalletSingleEntry {
required this.id,
});
/// Connects generated fromJson method
/// Connects the generated fromJson method
factory WalletSingleEntry.fromJson(Map<String, dynamic> json) =>
_$WalletSingleEntryFromJson(json);
@ -36,6 +36,6 @@ class WalletSingleEntry {
/// Unique entry ID
int id;
/// Connects generated toJson method
/// Connects the generated toJson method
Map<String, dynamic> toJson() => _$WalletSingleEntryToJson(this);
}

View file

@ -298,7 +298,7 @@ class _HomeViewState extends State<HomeView> {
locale: locale,
symbol: selectedWallet!.currency.symbol,
).format(
selectedWallet!.calculateCurrentBalance(),
selectedWallet!.currentBalance,
),
style: const TextStyle(
fontWeight: FontWeight.bold,