Skip to content

Commit

Permalink
Hide investment already tagged
Browse files Browse the repository at this point in the history
  • Loading branch information
praslnx8 committed Mar 29, 2024
1 parent 4df614c commit 3c38d9e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
13 changes: 11 additions & 2 deletions lib/presentation/tag_investment_presenter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,17 @@ class TagInvestmentPresenter extends Presenter<TagInvestmentViewState> {
}

void fetchInvestments() {
_investmentService.get().then((investments) =>
updateViewState((viewState) => viewState.investments = investments));
_goalInvestmentService.getBy(goalId: _goalId).then((goalInvestments) {
final List<int> investmentIds =
goalInvestments.map((e) => e.investmentId).toList();
_investmentService.get().then((investments) {
updateViewState((viewState) {
viewState.investments = investments
.where((element) => !investmentIds.contains(element.id))
.toList();
});
});
});
}

void tagInvestment({final int? idToUpdate}) {
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/custom/currency_text_input_formatter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:intl/intl.dart';

class CurrencyTextInputFormatter extends TextInputFormatter {
CurrencyTextInputFormatter() {
_format = NumberFormat.currency(symbol: '', decimalDigits: 0);
_format = NumberFormat.currency(locale: 'en_IN', symbol: '', decimalDigits: 0);
}

late NumberFormat _format;
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/ui_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ String formatDecimal(double value) {
return value == value.round() ? '${value.round()}' : value.toStringAsFixed(2);
}

String formatToCurrency(double value, { locale = 'en'}) {
return NumberFormat.currency(locale: locale, symbol: '', decimalDigits: 2).format(value);
String formatToCurrency(double value, { locale = 'en_IN'}) {
return NumberFormat.currency(locale: locale, symbol: '', decimalDigits: 0).format(value);
}

double? parseCurrency(String value) {
Expand Down

0 comments on commit 3c38d9e

Please sign in to comment.