style(app): остальные экраны под новый визуальный язык и форматирование
Доходы, ребалансировка, налоги, импорт, цели, здоровье данных, правила, транзакции, категории, cashflow, pending: новые виджеты и токены темы, dart format. Тесты подстроены под новые модели.
This commit is contained in:
@@ -20,9 +20,12 @@ class GoalEditDialog extends ConsumerStatefulWidget {
|
||||
class _GoalEditDialogState extends ConsumerState<GoalEditDialog> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
late final _name = TextEditingController(text: widget.initial?.name ?? '');
|
||||
late final _amount = TextEditingController(text: widget.initial?.targetAmount ?? '');
|
||||
late final _contribution =
|
||||
TextEditingController(text: widget.initial?.monthlyContribution ?? '');
|
||||
late final _amount = TextEditingController(
|
||||
text: widget.initial?.targetAmount ?? '',
|
||||
);
|
||||
late final _contribution = TextEditingController(
|
||||
text: widget.initial?.monthlyContribution ?? '',
|
||||
);
|
||||
late final _note = TextEditingController(text: widget.initial?.note ?? '');
|
||||
late String _scope = widget.initial?.scope ?? 'all';
|
||||
late DateTime? _targetDate = widget.initial?.targetDate;
|
||||
@@ -71,7 +74,8 @@ class _GoalEditDialogState extends ConsumerState<GoalEditDialog> {
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
DropdownButtonFormField<String>(
|
||||
initialValue: scopes.any((s) => s.scope == _scope) || _scope == 'all'
|
||||
initialValue:
|
||||
scopes.any((s) => s.scope == _scope) || _scope == 'all'
|
||||
? _scope
|
||||
: 'all',
|
||||
decoration: const InputDecoration(labelText: 'Что считаем'),
|
||||
@@ -86,14 +90,20 @@ class _GoalEditDialogState extends ConsumerState<GoalEditDialog> {
|
||||
const SizedBox(height: 12),
|
||||
TextFormField(
|
||||
controller: _amount,
|
||||
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
||||
decoration: const InputDecoration(labelText: 'Целевая сумма, ₽'),
|
||||
keyboardType: const TextInputType.numberWithOptions(
|
||||
decimal: true,
|
||||
),
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Целевая сумма, ₽',
|
||||
),
|
||||
validator: _decimalValidator,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextFormField(
|
||||
controller: _contribution,
|
||||
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
||||
keyboardType: const TextInputType.numberWithOptions(
|
||||
decimal: true,
|
||||
),
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Ежемесячный взнос, ₽',
|
||||
helperText: 'необязательно',
|
||||
@@ -104,20 +114,25 @@ class _GoalEditDialogState extends ConsumerState<GoalEditDialog> {
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(_targetDate == null
|
||||
? 'Целевая дата не задана'
|
||||
: 'Целевая дата: ${ruDate(_targetDate!)}'),
|
||||
child: Text(
|
||||
_targetDate == null
|
||||
? 'Целевая дата не задана'
|
||||
: 'Целевая дата: ${ruDate(_targetDate!)}',
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
final now = DateTime.now();
|
||||
final picked = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: _targetDate ?? DateTime(now.year + 3, now.month, now.day),
|
||||
initialDate:
|
||||
_targetDate ??
|
||||
DateTime(now.year + 3, now.month, now.day),
|
||||
firstDate: DateTime(now.year - 1),
|
||||
lastDate: DateTime(now.year + 50),
|
||||
);
|
||||
if (picked != null) setState(() => _targetDate = picked);
|
||||
if (picked != null)
|
||||
setState(() => _targetDate = picked);
|
||||
},
|
||||
child: const Text('Выбрать'),
|
||||
),
|
||||
@@ -147,21 +162,26 @@ class _GoalEditDialogState extends ConsumerState<GoalEditDialog> {
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.of(context).pop(), child: const Text('Отмена')),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('Отмена'),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
if (!(_formKey.currentState?.validate() ?? false)) return;
|
||||
Navigator.of(context).pop(Goal(
|
||||
id: widget.initial?.id ?? 0,
|
||||
name: _name.text.trim(),
|
||||
scope: _scope,
|
||||
targetAmount: _decimal(_amount.text) ?? '0',
|
||||
currency: widget.initial?.currency ?? 'RUB',
|
||||
targetDate: _targetDate,
|
||||
monthlyContribution: _decimal(_contribution.text),
|
||||
note: _note.text.trim().isEmpty ? null : _note.text.trim(),
|
||||
archived: _archived,
|
||||
));
|
||||
Navigator.of(context).pop(
|
||||
Goal(
|
||||
id: widget.initial?.id ?? 0,
|
||||
name: _name.text.trim(),
|
||||
scope: _scope,
|
||||
targetAmount: _decimal(_amount.text) ?? '0',
|
||||
currency: widget.initial?.currency ?? 'RUB',
|
||||
targetDate: _targetDate,
|
||||
monthlyContribution: _decimal(_contribution.text),
|
||||
note: _note.text.trim().isEmpty ? null : _note.text.trim(),
|
||||
archived: _archived,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Text('Сохранить'),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user