From ffdc06bb772fc8086b1cc5e3a53c5b85656c6d4f Mon Sep 17 00:00:00 2001 From: JokerZenDev Date: Sun, 4 Feb 2024 23:59:40 +0100 Subject: [PATCH] fix on tap more frequent catogories/accounts --- .../add_page/widgets/account_selector.dart | 58 ++++++++++-------- .../add_page/widgets/category_selector.dart | 59 +++++++++++-------- 2 files changed, 65 insertions(+), 52 deletions(-) diff --git a/lib/pages/add_page/widgets/account_selector.dart b/lib/pages/add_page/widgets/account_selector.dart index 97b5ffa..fb65154 100644 --- a/lib/pages/add_page/widgets/account_selector.dart +++ b/lib/pages/add_page/widgets/account_selector.dart @@ -71,33 +71,39 @@ class _AccountSelectorState extends ConsumerState with Function BankAccount account = accounts[i]; IconData? icon = accountIconList[account.symbol]; Color? color = accountColorListTheme[account.color]; - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - color: color, + return GestureDetector( + onTap: () => { + ref.read(widget.provider.notifier).state = account, + Navigator.of(context).pop(), + }, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: color, + ), + padding: const EdgeInsets.all(10.0), + child: icon != null + ? Icon( + icon, + size: 24.0, + color: Theme.of(context).colorScheme.background, + ) + : const SizedBox(), ), - padding: const EdgeInsets.all(10.0), - child: icon != null - ? Icon( - icon, - size: 24.0, - color: Theme.of(context).colorScheme.background, - ) - : const SizedBox(), - ), - Text( - account.name, - style: Theme.of(context) - .textTheme - .labelLarge! - .copyWith(color: Theme.of(context).colorScheme.primary), - ), - ], + Text( + account.name, + style: Theme.of(context) + .textTheme + .labelLarge! + .copyWith(color: Theme.of(context).colorScheme.primary), + ), + ], + ), ), ); }, diff --git a/lib/pages/add_page/widgets/category_selector.dart b/lib/pages/add_page/widgets/category_selector.dart index 4bbba57..45b0527 100644 --- a/lib/pages/add_page/widgets/category_selector.dart +++ b/lib/pages/add_page/widgets/category_selector.dart @@ -67,33 +67,40 @@ class _CategorySelectorState extends ConsumerState with Functi CategoryTransaction category = categories[i]; IconData? icon = iconList[category.symbol]; Color? color = categoryColorListTheme[category.color]; - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - color: color, + return GestureDetector( + onTap: () => { + ref.read(categoryProvider.notifier).state = + category, + Navigator.of(context).pop(), + }, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: color, + ), + padding: const EdgeInsets.all(10.0), + child: icon != null + ? Icon( + icon, + size: 24.0, + color: Theme.of(context).colorScheme.background, + ) + : const SizedBox(), ), - padding: const EdgeInsets.all(10.0), - child: icon != null - ? Icon( - icon, - size: 24.0, - color: Theme.of(context).colorScheme.background, - ) - : const SizedBox(), - ), - Text( - category.name, - style: Theme.of(context) - .textTheme - .labelLarge! - .copyWith(color: Theme.of(context).colorScheme.primary), - ), - ], + Text( + category.name, + style: Theme.of(context) + .textTheme + .labelLarge! + .copyWith(color: Theme.of(context).colorScheme.primary), + ), + ], + ), ), ); },