Skip to content

Commit

Permalink
fix extensions.dart to fulfill tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dreautall committed Feb 24, 2024
1 parent bd5793e commit 7d7a13d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ extension StringIgnoreCase on String {
}

extension AccountTypeFilterIcon on AccountTypeFilter {
IconData icon() {
IconData get icon {
switch (this) {
case AccountTypeFilter.asset:
return Icons.money_outlined;
Expand Down Expand Up @@ -433,7 +433,7 @@ extension AccountTypeFilterIcon on AccountTypeFilter {
}

extension BillAmountAvg on Bill {
double avgAmount() {
double get avgAmount {
final double amountMax = (double.tryParse(this.amountMax) ?? 0).abs();
final double amountMin = (double.tryParse(this.amountMin) ?? 0).abs();
if (amountMax == 0) {
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/home/accounts/search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class _AccountSearchState extends State<AccountSearch> {
_pagingController.refresh();
FocusScope.of(context).unfocus();
},
avatar: Icon(accType.icon()),
avatar: Icon(accType.icon),
visualDensity: const VisualDensity(vertical: -2),
)
: const SizedBox.shrink(),
Expand Down
6 changes: 2 additions & 4 deletions lib/pages/home/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1174,9 +1174,7 @@ class BillList extends StatelessWidget {
if (orderCompare != 0) {
return orderCompare;
}
return a.attributes
.avgAmount()
.compareTo(b.attributes.avgAmount());
return a.attributes.avgAmount.compareTo(b.attributes.avgAmount);
});

DateTime lastDate =
Expand Down Expand Up @@ -1243,7 +1241,7 @@ class BillList extends StatelessWidget {
),
),
Text(
currency.fmt(bill.attributes.avgAmount()),
currency.fmt(bill.attributes.avgAmount),
style: const TextStyle(
color: Colors.red,
fontWeight: FontWeight.bold,
Expand Down

0 comments on commit 7d7a13d

Please sign in to comment.