mirror of
https://github.com/koloideal/Casha.git
synced 2026-06-10 10:25:28 +03:00
update
This commit is contained in:
@@ -10,7 +10,7 @@ class AppStrings {
|
|||||||
String get appTitle => _ru ? 'Мои финансы' : 'My Finances';
|
String get appTitle => _ru ? 'Мои финансы' : 'My Finances';
|
||||||
String get totalBalance => _ru ? 'ОБЩИЙ БАЛАНС' : 'TOTAL BALANCE';
|
String get totalBalance => _ru ? 'ОБЩИЙ БАЛАНС' : 'TOTAL BALANCE';
|
||||||
String get tapAndHoldToEdit => _ru ? 'удерживайте для редактирования' : 'tap and hold to edit';
|
String get tapAndHoldToEdit => _ru ? 'удерживайте для редактирования' : 'tap and hold to edit';
|
||||||
String get add => _ru ? 'Добавить' : 'Add';
|
String get add => _ru ? 'Добавить счёт' : 'Add account';
|
||||||
String get transactions => _ru ? 'Транзакции' : 'Transactions';
|
String get transactions => _ru ? 'Транзакции' : 'Transactions';
|
||||||
String get searchHint => _ru ? 'Поиск транзакций...' : 'Search transactions...';
|
String get searchHint => _ru ? 'Поиск транзакций...' : 'Search transactions...';
|
||||||
String get filterAll => _ru ? 'Все' : 'All';
|
String get filterAll => _ru ? 'Все' : 'All';
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||||||
import '../../../core/l10n/app_strings.dart';
|
import '../../../core/l10n/app_strings.dart';
|
||||||
import '../../../core/l10n/locale_provider.dart';
|
import '../../../core/l10n/locale_provider.dart';
|
||||||
import '../../../core/services/card_color_service.dart';
|
import '../../../core/services/card_color_service.dart';
|
||||||
|
import '../../../core/services/haptic_service.dart';
|
||||||
import '../../../shared/models/transaction.dart';
|
import '../../../shared/models/transaction.dart';
|
||||||
import '../../settings/provider.dart';
|
import '../../settings/provider.dart';
|
||||||
import '../provider.dart';
|
import '../provider.dart';
|
||||||
@@ -89,8 +90,9 @@ class _AccountEditorOverlayState extends State<AccountEditorOverlay> {
|
|||||||
builder: (context, ref, _) {
|
builder: (context, ref, _) {
|
||||||
final exchangeService = ref.watch(exchangeRateServiceProvider);
|
final exchangeService = ref.watch(exchangeRateServiceProvider);
|
||||||
|
|
||||||
// Calculate preview balance fresh from raw transactions
|
// Fix: If adding a new account, the balance is strictly 0.0
|
||||||
double previewBalance = 0.0;
|
double previewBalance = 0.0;
|
||||||
|
if (!dash.isAddingAccount) {
|
||||||
if (dash.editingAccount != null) {
|
if (dash.editingAccount != null) {
|
||||||
final txs = ref.watch(accountFilteredTransactionsProvider);
|
final txs = ref.watch(accountFilteredTransactionsProvider);
|
||||||
final accountTxs = txs.where((t) => t.accountId == dash.editingAccount!.id);
|
final accountTxs = txs.where((t) => t.accountId == dash.editingAccount!.id);
|
||||||
@@ -103,9 +105,10 @@ class _AccountEditorOverlayState extends State<AccountEditorOverlay> {
|
|||||||
return t.type == TransactionType.income ? sum + converted : sum - converted;
|
return t.type == TransactionType.income ? sum + converted : sum - converted;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Fallback just in case, though editingAccount should never be null here
|
// Fallback for edge cases
|
||||||
previewBalance = ref.read(totalBalanceProvider);
|
previewBalance = ref.read(totalBalanceProvider);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Material(
|
return Material(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
@@ -863,7 +866,11 @@ class _AccountEditorOverlayState extends State<AccountEditorOverlay> {
|
|||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: _nameController.text.trim().isEmpty
|
onPressed: _nameController.text.trim().isEmpty
|
||||||
? null
|
? null
|
||||||
: () => dash.closeAccountOverlay(apply: true),
|
: () {
|
||||||
|
// Add haptic feedback here
|
||||||
|
HapticService.light();
|
||||||
|
dash.closeAccountOverlay(apply: true);
|
||||||
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: const Color(0xFF7C6DED),
|
backgroundColor: const Color(0xFF7C6DED),
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
@@ -880,7 +887,7 @@ class _AccountEditorOverlayState extends State<AccountEditorOverlay> {
|
|||||||
borderRadius: BorderRadius.circular(12)),
|
borderRadius: BorderRadius.circular(12)),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
dash.isAddingAccount ? 'Создать счёт' : s.apply,
|
dash.isAddingAccount ? s.add : s.apply,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.w700, fontSize: 14)),
|
fontWeight: FontWeight.w700, fontSize: 14)),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -180,12 +180,12 @@ class AddAccountCard extends StatelessWidget {
|
|||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 15), // makes it smaller
|
margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 10), // Reduced margins for larger size
|
||||||
child: CustomPaint(
|
child: CustomPaint(
|
||||||
painter: _DashedBorderPainter(),
|
painter: _DashedBorderPainter(),
|
||||||
child: Container(
|
child: Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 190, // reduced from 220
|
height: 205, // Increased height
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).colorScheme.surface.withOpacity(0.4),
|
color: Theme.of(context).colorScheme.surface.withOpacity(0.4),
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
@@ -195,14 +195,14 @@ class AddAccountCard extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
Icons.add_rounded,
|
Icons.add_rounded,
|
||||||
size: 32,
|
size: 36, // Slightly bigger icon
|
||||||
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.5),
|
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.5),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Text(
|
Text(
|
||||||
'Add account',
|
'Add account',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 15,
|
||||||
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.5),
|
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.5),
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user