From 42cab049b9c085a394bdea6d11e09c2e31f6162a Mon Sep 17 00:00:00 2001 From: Prasanna Anbazhagan Date: Sat, 20 Jan 2024 09:32:44 +0530 Subject: [PATCH] save commit --- lib/presentation/create_basket_presenter.dart | 2 ++ ...eate_investment_transaction_presenter.dart | 7 ++-- lib/presentation/create_sip_presenter.dart | 6 ++-- lib/ui/pages/investments_page.dart | 2 +- lib/ui/widgets/create_basket_dialog.dart | 8 +++++ lib/ui/widgets/create_goal_dialog.dart | 33 +++++++++++-------- lib/ui/widgets/create_investment_dialog.dart | 8 +++++ lib/ui/widgets/create_sip_dialog.dart | 14 ++++++++ lib/ui/widgets/create_transaction_dialog.dart | 14 ++++++-- pubspec.lock | 22 +++++++++---- 10 files changed, 88 insertions(+), 28 deletions(-) diff --git a/lib/presentation/create_basket_presenter.dart b/lib/presentation/create_basket_presenter.dart index 41c2b3d..a056645 100644 --- a/lib/presentation/create_basket_presenter.dart +++ b/lib/presentation/create_basket_presenter.dart @@ -51,6 +51,7 @@ class CreateBasketPresenter extends Presenter { updateViewState((viewState) { viewState.name = basketToUpdate.name; viewState.description = basketToUpdate.description ?? ''; + viewState.onBasketFetched = SingleEvent(null); }); } } @@ -59,6 +60,7 @@ class CreateBasketViewState { String name = ''; String description = ''; SingleEvent? onBasketCreated; + SingleEvent? onBasketFetched; bool isValid() { return name.isNotEmpty; diff --git a/lib/presentation/create_investment_transaction_presenter.dart b/lib/presentation/create_investment_transaction_presenter.dart index c67bebe..0ebac38 100644 --- a/lib/presentation/create_investment_transaction_presenter.dart +++ b/lib/presentation/create_investment_transaction_presenter.dart @@ -64,17 +64,19 @@ class CreateInvestmentTransactionPresenter updateViewState((viewState) => viewState.investedDate = date); } - void setTransaction(Transaction transactionToUpdate) { + void _setTransaction(Transaction transactionToUpdate) { updateViewState((viewState) { viewState.amount = transactionToUpdate.amount; viewState.investedDate = transactionToUpdate.createdOn; + viewState.description = transactionToUpdate.description ?? ''; + viewState.onTransactionLoaded = SingleEvent(null); }); } void fetchTransaction({required int id}) { _transactionService .getBy(id: id) - .then((transaction) => setTransaction(transaction)); + .then((transaction) => _setTransaction(transaction)); } } @@ -83,6 +85,7 @@ class CreateTransactionViewState { double amount = 0; DateTime investedDate = DateTime.now(); SingleEvent? onTransactionCreated; + SingleEvent? onTransactionLoaded; bool isValid() { return amount > 0; diff --git a/lib/presentation/create_sip_presenter.dart b/lib/presentation/create_sip_presenter.dart index c32817a..f510954 100644 --- a/lib/presentation/create_sip_presenter.dart +++ b/lib/presentation/create_sip_presenter.dart @@ -78,18 +78,19 @@ class CreateSipPresenter extends Presenter { updateViewState((viewState) => viewState.frequency = frequency); } - void setSip(SIP sipToUpdate) { + void _setSip(SIP sipToUpdate) { updateViewState((viewState) { viewState.description = sipToUpdate.description ?? ''; viewState.amount = sipToUpdate.amount; viewState.startDate = sipToUpdate.startDate; viewState.endDate = sipToUpdate.endDate; viewState.frequency = sipToUpdate.frequency; + viewState.onSipLoaded = SingleEvent(null); }); } void fetchSip({required int id}) { - _sipService.getBy(id: id).then((sip) => setSip(sip)); + _sipService.getBy(id: id).then((sip) => _setSip(sip)); } } @@ -100,6 +101,7 @@ class CreateSipViewState { DateTime? endDate = DateTime.now().add(const Duration(days: 365)); SipFrequency frequency = SipFrequency.monthly; SingleEvent? onSipCreated; + SingleEvent? onSipLoaded; bool isValid() { final endDate = this.endDate; diff --git a/lib/ui/pages/investments_page.dart b/lib/ui/pages/investments_page.dart index 6606673..e0f2069 100644 --- a/lib/ui/pages/investments_page.dart +++ b/lib/ui/pages/investments_page.dart @@ -152,7 +152,7 @@ class _InvestmentsPage extends PageState=3.0.6 <4.0.0" + dart: ">=3.2.0-194.0.dev <4.0.0" flutter: ">=3.10.0"