From 1faa5e2f78e029e67b34af31b4a8dbb52542e3c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Caras?= Date: Mon, 22 Apr 2024 16:36:20 +0200 Subject: [PATCH] fix: don't display 'Add new wallet' when returning from a screen --- lib/views/graph_view.dart | 12 +++++++----- lib/views/home.dart | 6 +++++- lib/views/recurring_view.dart | 7 +++++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/views/graph_view.dart b/lib/views/graph_view.dart index 8531171..8f701b2 100644 --- a/lib/views/graph_view.dart +++ b/lib/views/graph_view.dart @@ -197,7 +197,9 @@ class _GraphViewState extends State { title: DropdownButton( value: (selectedWallet == null) ? -1 - : wallets.indexOf(selectedWallet!), + : wallets.indexOf( + wallets.where((w) => w.name == selectedWallet!.name).first, + ), items: [ ...wallets.map( (e) => DropdownMenuItem( @@ -333,7 +335,7 @@ class _GraphViewState extends State { ? Theme.of(context) .colorScheme .secondaryContainer - : Theme.of(context).colorScheme.background, + : Theme.of(context).colorScheme.surface, ), child: Padding( padding: const EdgeInsets.all(8), @@ -427,7 +429,7 @@ class _GraphViewState extends State { ? Theme.of(context) .colorScheme .secondaryContainer - : Theme.of(context).colorScheme.background, + : Theme.of(context).colorScheme.surface, ), width: MediaQuery.of(context).size.width * 0.95, height: MediaQuery.of(context).size.height * 0.4, @@ -557,7 +559,7 @@ class _GraphViewState extends State { ? Theme.of(context) .colorScheme .secondaryContainer - : Theme.of(context).colorScheme.background, + : Theme.of(context).colorScheme.surface, ), child: Padding( padding: const EdgeInsets.all(8), @@ -650,7 +652,7 @@ class _GraphViewState extends State { ? Theme.of(context) .colorScheme .secondaryContainer - : Theme.of(context).colorScheme.background, + : Theme.of(context).colorScheme.surface, ), width: MediaQuery.of(context).size.width * 0.95, height: MediaQuery.of(context).size.height * 0.4, diff --git a/lib/views/home.dart b/lib/views/home.dart index 8d0b840..64476ff 100644 --- a/lib/views/home.dart +++ b/lib/views/home.dart @@ -166,7 +166,11 @@ class _HomeViewState extends State { secondChild: DropdownButton( value: (selectedWallet == null) ? -1 - : wallets.indexOf(selectedWallet!), + : wallets.indexOf( + wallets + .where((w) => w.name == selectedWallet!.name) + .first, + ), items: [ ...wallets.map( (e) => DropdownMenuItem( diff --git a/lib/views/recurring_view.dart b/lib/views/recurring_view.dart index faa6cde..c5edbaa 100644 --- a/lib/views/recurring_view.dart +++ b/lib/views/recurring_view.dart @@ -63,8 +63,11 @@ class _RecurringEntriesViewState extends State { drawer: makeDrawer(context, 3), appBar: AppBar( title: DropdownButton( - value: - (selectedWallet == null) ? -1 : wallets.indexOf(selectedWallet!), + value: (selectedWallet == null) + ? -1 + : wallets.indexOf( + wallets.where((w) => w.name == selectedWallet!.name).first, + ), items: [ ...wallets.map( (e) => DropdownMenuItem(