mirror of
https://github.com/koloideal/Casha.git
synced 2026-06-10 18:35:28 +03:00
update
This commit is contained in:
@@ -56,13 +56,15 @@ class _AddTransactionScreenState extends ConsumerState<AddTransactionScreen> {
|
|||||||
final currencyInfo = ref.read(currencyProvider);
|
final currencyInfo = ref.read(currencyProvider);
|
||||||
ref.read(addTransactionProvider(widget.initial).notifier).setSubmitting(true);
|
ref.read(addTransactionProvider(widget.initial).notifier).setSubmitting(true);
|
||||||
|
|
||||||
|
final note = _noteController.text.trim();
|
||||||
|
|
||||||
final tx = Transaction(
|
final tx = Transaction(
|
||||||
id: state.editingId ?? _uuid.v4(),
|
id: state.editingId ?? _uuid.v4(),
|
||||||
amount: state.amount!,
|
amount: state.amount!,
|
||||||
category: state.category,
|
category: state.category,
|
||||||
type: state.type,
|
type: state.type,
|
||||||
date: state.date,
|
date: state.date,
|
||||||
note: state.note.isEmpty ? null : state.note,
|
note: note.isEmpty ? null : note,
|
||||||
currency: currencyInfo.symbol,
|
currency: currencyInfo.symbol,
|
||||||
currencyCode: currencyInfo.code,
|
currencyCode: currencyInfo.code,
|
||||||
);
|
);
|
||||||
@@ -271,11 +273,12 @@ class _AddTransactionScreenState extends ConsumerState<AddTransactionScreen> {
|
|||||||
TextFormField(
|
TextFormField(
|
||||||
controller: _noteController,
|
controller: _noteController,
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
|
maxLength: 20,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
hintText: 'Add a note...',
|
hintText: 'Add a note...',
|
||||||
),
|
),
|
||||||
onChanged: (v) =>
|
onChanged: (v) =>
|
||||||
ref.read(addTransactionProvider(widget.initial).notifier).setNote(v),
|
ref.read(addTransactionProvider(widget.initial).notifier).setNote(v.trim()),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 32),
|
const SizedBox(height: 32),
|
||||||
|
|
||||||
|
|||||||
@@ -141,99 +141,6 @@ class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
|
||||||
// Currency Selector
|
|
||||||
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),
|
|
||||||
|
|
||||||
// Budget Setting
|
// Budget Setting
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
@@ -346,6 +253,99 @@ class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
|
||||||
|
// Currency Selector
|
||||||
|
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(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user