From 186cec8e2ab48d7f359ee0a76d19bc0d84e58a81 Mon Sep 17 00:00:00 2001 From: kolo Date: Mon, 29 Jun 2026 11:18:32 +0300 Subject: [PATCH] step --- .../account_editor_overlay.dart | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/lib/features/dashboard/widgets/account_editor_overlay/account_editor_overlay.dart b/lib/features/dashboard/widgets/account_editor_overlay/account_editor_overlay.dart index d2e8624..ecbfcea 100644 --- a/lib/features/dashboard/widgets/account_editor_overlay/account_editor_overlay.dart +++ b/lib/features/dashboard/widgets/account_editor_overlay/account_editor_overlay.dart @@ -2,6 +2,9 @@ import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../../../../core/constants.dart'; +import '../../../../core/l10n/app_strings.dart'; +import '../../../../core/l10n/locale_provider.dart'; +import '../../../../core/services/haptic_service.dart'; import '../../../../core/utils/card_layout.dart'; import '../../../../shared/models/account.dart'; import '../../../../shared/models/transaction.dart'; @@ -282,6 +285,104 @@ class _AccountEditorOverlayState extends State { ), ), ), + ] else ...[ + Positioned( + top: editorPanelTop + editorPanelHeight + layout.sectionGap, + left: 20, + right: 20, + child: GestureDetector( + onTap: () { + if (_showCurrencyDropdown) { + setState(() { + _showCurrencyDropdown = false; + }); + } + }, + behavior: HitTestBehavior.opaque, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 16, + vertical: layout.buttonVerticalPadding, + ), + decoration: BoxDecoration( + color: Theme.of(widget.context).colorScheme.surface, + borderRadius: BorderRadius.circular(20), + border: Border.all( + color: Theme.of( + widget.context, + ).colorScheme.onSurface.withOpacity(0.1), + width: 1.5, + ), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.3), + blurRadius: 24, + offset: const Offset(0, 8), + ), + ], + ), + child: SizedBox( + width: double.infinity, + child: ElevatedButton( + onPressed: + dash.tempAccountName.trim().isEmpty + ? null + : () { + final accounts = + ref.read(accountsProvider).value ?? []; + if (_isDuplicateName( + accounts, + dash.tempAccountName, + )) { + setState(() => _showDuplicateError = true); + Future.delayed( + const Duration(seconds: 3), + () { + if (mounted) { + setState(() => + _showDuplicateError = false); + } + }, + ); + return; + } + HapticService.light(); + dash.closeAccountOverlay(apply: true); + }, + style: ElevatedButton.styleFrom( + backgroundColor: const Color(0xFF7C6DED), + foregroundColor: Colors.white, + disabledBackgroundColor: Theme.of( + widget.context, + ).colorScheme.onSurface.withOpacity(0.12), + disabledForegroundColor: Theme.of( + widget.context, + ).colorScheme.onSurface.withOpacity(0.38), + padding: EdgeInsets.symmetric( + vertical: layout.buttonVerticalPadding, + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + ), + child: Text( + dash.isAddingAccount + ? AppStrings( + ref.read(localeProvider), + ).addAccount + : AppStrings( + ref.read(localeProvider), + ).apply, + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: layout.compact ? 13 : 14, + ), + ), + ), + ), + ), + ), + ), ], if (_showCurrencyDropdown) Positioned(