Skip to content

Commit

Permalink
Hide invested value on editing investment page
Browse files Browse the repository at this point in the history
  • Loading branch information
praslnx8 committed Mar 30, 2024
1 parent edbdd90 commit cd5385c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 0 additions & 2 deletions lib/presentation/create_investment_presenter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ class CreateInvestmentPresenter extends Presenter<CreateInvestmentViewState> {
viewState.investedOn = investmentToUpdate.getLastInvestedOn();
viewState.basketId = investmentToUpdate.basketId;
viewState.value = value;
viewState.oneTimeInvestment = investmentToUpdate.transactions.length == 1;
viewState.riskLevel = investmentToUpdate.riskLevel;
viewState.onInvestmentFetched = SingleEvent(null);
});
Expand All @@ -154,7 +153,6 @@ class CreateInvestmentViewState {
DateTime? investedOn = DateTime.now();
double? value;
DateTime? maturityDate;
bool oneTimeInvestment = false;
SingleEvent<void>? onInvestmentCreated;
SingleEvent<void>? onInvestmentFetched;
SingleEvent<void>? onIRRCleared;
Expand Down
8 changes: 5 additions & 3 deletions lib/ui/widgets/create_investment_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ class _CreateInvestmentPage extends PageState<CreateInvestmentViewState,
labelText: 'Description', border: OutlineInputBorder()),
),
const SizedBox(height: AppDimen.defaultPadding),
_getInvestedAmountWidget(snapshot.oneTimeInvestment),
_getInvestedAmountWidget(
showInvestmentAmountField: widget.investmentIdToUpdate != null),
Container(
decoration: BoxDecoration(
border: Border.all(color: Theme.of(context).dividerColor),
Expand Down Expand Up @@ -279,8 +280,9 @@ class _CreateInvestmentPage extends PageState<CreateInvestmentViewState,
return CreateInvestmentPresenter();
}

Widget _getInvestedAmountWidget(bool containsTransactions) {
if (containsTransactions) {
Widget _getInvestedAmountWidget(
{required final bool showInvestmentAmountField}) {
if (showInvestmentAmountField) {
return Container();
} else {
return Column(
Expand Down

0 comments on commit cd5385c

Please sign in to comment.