fix: don't display 'Add new wallet' when returning from a screen

This commit is contained in:
Matyáš Caras 2024-04-22 16:36:20 +02:00
parent 5cbb9a12dc
commit 1faa5e2f78
Signed by untrusted user who does not match committer: hernik
GPG key ID: 2A3175F98820C5C6
3 changed files with 17 additions and 8 deletions

View file

@ -197,7 +197,9 @@ class _GraphViewState extends State<GraphView> {
title: DropdownButton<int>(
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<GraphView> {
? 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<GraphView> {
? 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<GraphView> {
? 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<GraphView> {
? 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,

View file

@ -166,7 +166,11 @@ class _HomeViewState extends State<HomeView> {
secondChild: DropdownButton<int>(
value: (selectedWallet == null)
? -1
: wallets.indexOf(selectedWallet!),
: wallets.indexOf(
wallets
.where((w) => w.name == selectedWallet!.name)
.first,
),
items: [
...wallets.map(
(e) => DropdownMenuItem(

View file

@ -63,8 +63,11 @@ class _RecurringEntriesViewState extends State<RecurringEntriesView> {
drawer: makeDrawer(context, 3),
appBar: AppBar(
title: DropdownButton<int>(
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(