From 771f7a355582bb8d53eade857fdd4d2916c32d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Caras?= Date: Sat, 10 Feb 2024 15:42:05 +0100 Subject: [PATCH] fix: move new category button to the top --- lib/views/settings/edit_categories.dart | 42 ++++++++++---------- lib/views/setup.dart | 52 ++++++++++++------------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/lib/views/settings/edit_categories.dart b/lib/views/settings/edit_categories.dart index b1ec924..1de0cf8 100644 --- a/lib/views/settings/edit_categories.dart +++ b/lib/views/settings/edit_categories.dart @@ -120,6 +120,27 @@ class _EditCategoriesViewState extends State { AppLocalizations.of(context).setupCategoriesEditHint, textAlign: TextAlign.center, ), + IconButton( + onPressed: () async { + selectedWallet!.categories.add( + WalletCategory( + name: AppLocalizations.of(context) + .setupWalletNamePlaceholder, + id: selectedWallet!.nextCategoryId, + icon: IconData( + Icons.question_mark.codePoint, + fontFamily: 'MaterialIcons', + ), + color: Colors.blueGrey.harmonizeWith( + Theme.of(context).colorScheme.primary, + ), + ), + ); + await WalletManager.saveWallet(selectedWallet!); + setState(() {}); + }, + icon: const Icon(Icons.add), + ), SizedBox( height: MediaQuery.of(context).size.height * 0.64, child: ListView.builder( @@ -260,27 +281,6 @@ class _EditCategoriesViewState extends State { itemCount: selectedWallet!.categories.length, ), ), - IconButton( - onPressed: () async { - selectedWallet!.categories.add( - WalletCategory( - name: AppLocalizations.of(context) - .setupWalletNamePlaceholder, - id: selectedWallet!.nextCategoryId, - icon: IconData( - Icons.question_mark.codePoint, - fontFamily: 'MaterialIcons', - ), - color: Colors.blueGrey.harmonizeWith( - Theme.of(context).colorScheme.primary, - ), - ), - ); - await WalletManager.saveWallet(selectedWallet!); - setState(() {}); - }, - icon: const Icon(Icons.add), - ), ], ), ); diff --git a/lib/views/setup.dart b/lib/views/setup.dart index dee951a..37a34ac 100644 --- a/lib/views/setup.dart +++ b/lib/views/setup.dart @@ -303,6 +303,32 @@ class _SetupViewState extends State { AppLocalizations.of(context).setupCategoriesEditHint, textAlign: TextAlign.center, ), + IconButton( + onPressed: () { + var id = 0; + while (categories + .where((element) => element.id == id) + .isNotEmpty) { + id++; // create unique ID + } + categories.add( + WalletCategory( + name: AppLocalizations.of(context) + .setupWalletNamePlaceholder, + id: id, + icon: IconData( + Icons.question_mark.codePoint, + fontFamily: 'MaterialIcons', + ), + color: Colors.blueGrey.harmonizeWith( + Theme.of(context).colorScheme.primary, + ), + ), + ); + setState(() {}); + }, + icon: const Icon(Icons.add), + ), SizedBox( height: MediaQuery.of(context).size.height * 0.64, child: ListView.builder( @@ -439,32 +465,6 @@ class _SetupViewState extends State { itemCount: categories.length, ), ), - IconButton( - onPressed: () { - var id = 0; - while (categories - .where((element) => element.id == id) - .isNotEmpty) { - id++; // create unique ID - } - categories.add( - WalletCategory( - name: AppLocalizations.of(context) - .setupWalletNamePlaceholder, - id: id, - icon: IconData( - Icons.question_mark.codePoint, - fontFamily: 'MaterialIcons', - ), - color: Colors.blueGrey.harmonizeWith( - Theme.of(context).colorScheme.primary, - ), - ), - ); - setState(() {}); - }, - icon: const Icon(Icons.add), - ), ], ), ),