From 0f021cf55de4e2056ddc133945be15239285cec8 Mon Sep 17 00:00:00 2001 From: kolo Date: Fri, 20 Mar 2026 21:07:53 +0300 Subject: [PATCH] update --- lib/features/settings/screen.dart | 355 +++++++++++++++--------------- 1 file changed, 179 insertions(+), 176 deletions(-) diff --git a/lib/features/settings/screen.dart b/lib/features/settings/screen.dart index be646ee..74f3dba 100644 --- a/lib/features/settings/screen.dart +++ b/lib/features/settings/screen.dart @@ -191,6 +191,184 @@ class _SettingsScreenState extends ConsumerState { ), const SizedBox(height: 16), + const _BiometricSection(), + + Container( + padding: const EdgeInsets.all(20), + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.surface, + borderRadius: BorderRadius.circular(16), + border: isDark ? null : Border.all(color: const Color(0xFFDDDDEE), width: 1), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + color: AppColors.accent.withOpacity(0.15), + borderRadius: BorderRadius.circular(12), + ), + child: const Icon( + Icons.attach_money_rounded, + color: AppColors.accent, + size: 20, + ), + ), + const SizedBox(width: 12), + Expanded( + child: Text( + 'Currency', + style: Theme.of(context).textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.w600, + color: Theme.of(context).colorScheme.onSurface, + ), + ), + ), + ], + ), + const SizedBox(height: 16), + Row( + children: ['USD', 'EUR', 'BYN', 'RUB'].map((code) { + final info = currencyMap[code]!; + final isSelected = currencyInfo.code == code; + return Expanded( + child: Padding( + padding: const EdgeInsets.only(right: 8), + child: GestureDetector( + onTap: () { + final oldCode = ref.read(currencyProvider).code; + final rates = ref.read(exchangeRateServiceProvider); + ref.read(budgetProvider.notifier).onCurrencyChanged(oldCode, code, rates); + ref.read(currencyProvider.notifier).setCurrency(code); + }, + child: Container( + padding: const EdgeInsets.symmetric(vertical: 12), + decoration: BoxDecoration( + color: isSelected + ? AppColors.accent.withOpacity(0.2) + : Theme.of(context).scaffoldBackgroundColor, + borderRadius: BorderRadius.circular(12), + border: isSelected + ? Border.all(color: AppColors.accent, width: 1.5) + : (isDark ? null : Border.all(color: const Color(0xFFDDDDEE), width: 1)), + ), + child: Column( + children: [ + Text( + info.symbol, + style: Theme.of(context).textTheme.titleLarge?.copyWith( + color: isSelected ? AppColors.accent : Theme.of(context).colorScheme.onSurface.withOpacity(0.6), + fontWeight: isSelected ? FontWeight.w700 : FontWeight.normal, + ), + ), + const SizedBox(height: 2), + Text( + code, + style: Theme.of(context).textTheme.bodySmall?.copyWith( + color: isSelected ? AppColors.accent : Theme.of(context).colorScheme.onSurface.withOpacity(0.6), + fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal, + ), + ), + ], + ), + ), + ), + ), + ); + }).toList(), + ), + ], + ), + ), + + const SizedBox(height: 16), + + Container( + padding: const EdgeInsets.all(20), + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.surface, + borderRadius: BorderRadius.circular(16), + border: isDark ? null : Border.all(color: const Color(0xFFDDDDEE), width: 1), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + color: AppColors.accent.withOpacity(0.15), + borderRadius: BorderRadius.circular(12), + ), + child: const Icon( + Icons.format_list_numbered_rounded, + color: AppColors.accent, + size: 20, + ), + ), + const SizedBox(width: 12), + Expanded( + child: Text( + 'Amount Format', + style: Theme.of(context).textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.w600, + color: Theme.of(context).colorScheme.onSurface, + ), + ), + ), + ], + ), + const SizedBox(height: 16), + ...AmountFormat.values.map((format) { + final isSelected = fmt == format; + return Padding( + padding: const EdgeInsets.only(bottom: 8), + child: GestureDetector( + onTap: () => ref.read(amountFormatProvider.notifier).set(format), + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + decoration: BoxDecoration( + color: isSelected + ? AppColors.accent.withOpacity(0.2) + : Theme.of(context).scaffoldBackgroundColor, + borderRadius: BorderRadius.circular(12), + border: isSelected + ? Border.all(color: AppColors.accent, width: 1.5) + : (isDark ? null : Border.all(color: const Color(0xFFDDDDEE), width: 1)), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + format.label, + style: TextStyle( + color: isSelected ? AppColors.accent : Theme.of(context).colorScheme.onSurface, + fontWeight: isSelected ? FontWeight.w600 : FontWeight.w500, + ), + ), + Text( + format.example.replaceFirst('SYM', currencyInfo.symbol), + style: TextStyle( + color: Theme.of(context).colorScheme.onSurface.withOpacity(0.6), + fontSize: 12, + ), + ), + ], + ), + ), + ), + ); + }).toList(), + ], + ), + ), + + const SizedBox(height: 16), + Container( padding: const EdgeInsets.all(20), decoration: BoxDecoration( @@ -304,182 +482,7 @@ class _SettingsScreenState extends ConsumerState { ], ), ), - const SizedBox(height: 16), - - Container( - padding: const EdgeInsets.all(20), - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.surface, - borderRadius: BorderRadius.circular(16), - border: isDark ? null : Border.all(color: const Color(0xFFDDDDEE), width: 1), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Container( - padding: const EdgeInsets.all(10), - decoration: BoxDecoration( - color: AppColors.accent.withOpacity(0.15), - borderRadius: BorderRadius.circular(12), - ), - child: const Icon( - Icons.format_list_numbered_rounded, - color: AppColors.accent, - size: 20, - ), - ), - const SizedBox(width: 12), - Expanded( - child: Text( - 'Amount Format', - style: Theme.of(context).textTheme.titleMedium?.copyWith( - fontWeight: FontWeight.w600, - color: Theme.of(context).colorScheme.onSurface, - ), - ), - ), - ], - ), - const SizedBox(height: 16), - ...AmountFormat.values.map((format) { - final isSelected = fmt == format; - return Padding( - padding: const EdgeInsets.only(bottom: 8), - child: GestureDetector( - onTap: () => ref.read(amountFormatProvider.notifier).set(format), - child: Container( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), - decoration: BoxDecoration( - color: isSelected - ? AppColors.accent.withOpacity(0.2) - : Theme.of(context).scaffoldBackgroundColor, - borderRadius: BorderRadius.circular(12), - border: isSelected - ? Border.all(color: AppColors.accent, width: 1.5) - : (isDark ? null : Border.all(color: const Color(0xFFDDDDEE), width: 1)), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - format.label, - style: TextStyle( - color: isSelected ? AppColors.accent : Theme.of(context).colorScheme.onSurface, - fontWeight: isSelected ? FontWeight.w600 : FontWeight.w500, - ), - ), - Text( - format.example.replaceFirst('SYM', currencyInfo.symbol), - style: TextStyle( - color: Theme.of(context).colorScheme.onSurface.withOpacity(0.6), - fontSize: 12, - ), - ), - ], - ), - ), - ), - ); - }).toList(), - ], - ), - ), - const SizedBox(height: 16), - - const _BiometricSection(), - - Container( - padding: const EdgeInsets.all(20), - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.surface, - borderRadius: BorderRadius.circular(16), - border: isDark ? null : Border.all(color: const Color(0xFFDDDDEE), width: 1), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Container( - padding: const EdgeInsets.all(10), - decoration: BoxDecoration( - color: AppColors.accent.withOpacity(0.15), - borderRadius: BorderRadius.circular(12), - ), - child: const Icon( - Icons.attach_money_rounded, - color: AppColors.accent, - size: 20, - ), - ), - const SizedBox(width: 12), - Expanded( - child: Text( - 'Currency', - style: Theme.of(context).textTheme.titleMedium?.copyWith( - fontWeight: FontWeight.w600, - color: Theme.of(context).colorScheme.onSurface, - ), - ), - ), - ], - ), - const SizedBox(height: 16), - Row( - children: ['USD', 'EUR', 'BYN', 'RUB'].map((code) { - final info = currencyMap[code]!; - final isSelected = currencyInfo.code == code; - return Expanded( - child: Padding( - padding: const EdgeInsets.only(right: 8), - child: GestureDetector( - onTap: () { - final oldCode = ref.read(currencyProvider).code; - final rates = ref.read(exchangeRateServiceProvider); - ref.read(budgetProvider.notifier).onCurrencyChanged(oldCode, code, rates); - ref.read(currencyProvider.notifier).setCurrency(code); - }, - child: Container( - padding: const EdgeInsets.symmetric(vertical: 12), - decoration: BoxDecoration( - color: isSelected - ? AppColors.accent.withOpacity(0.2) - : Theme.of(context).scaffoldBackgroundColor, - borderRadius: BorderRadius.circular(12), - border: isSelected - ? Border.all(color: AppColors.accent, width: 1.5) - : (isDark ? null : Border.all(color: const Color(0xFFDDDDEE), width: 1)), - ), - child: Column( - children: [ - Text( - info.symbol, - style: Theme.of(context).textTheme.titleLarge?.copyWith( - color: isSelected ? AppColors.accent : Theme.of(context).colorScheme.onSurface.withOpacity(0.6), - fontWeight: isSelected ? FontWeight.w700 : FontWeight.normal, - ), - ), - const SizedBox(height: 2), - Text( - code, - style: Theme.of(context).textTheme.bodySmall?.copyWith( - color: isSelected ? AppColors.accent : Theme.of(context).colorScheme.onSurface.withOpacity(0.6), - fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal, - ), - ), - ], - ), - ), - ), - ), - ); - }).toList(), - ), - ], - ), - ), + const SizedBox(height: 24), Text(