style(app): остальные экраны под новый визуальный язык и форматирование

Доходы, ребалансировка, налоги, импорт, цели, здоровье данных, правила, транзакции, категории, cashflow, pending: новые виджеты и токены темы, dart format. Тесты подстроены под новые модели.
This commit is contained in:
Dmitry
2026-09-19 22:14:27 +03:00
parent 62d36aa3e8
commit 322c60a359
55 changed files with 2158 additions and 1080 deletions
@@ -21,12 +21,15 @@ class _CreateInstrumentDialogState extends State<CreateInstrumentDialog> {
late final _ticker = TextEditingController(text: widget.pending.ticker ?? '');
late final _board = TextEditingController(text: widget.pending.board ?? '');
late final _name = TextEditingController(text: widget.pending.name ?? '');
late final _currency = TextEditingController(text: widget.pending.currency ?? 'RUB');
late final _currency = TextEditingController(
text: widget.pending.currency ?? 'RUB',
);
late final _lot = TextEditingController(text: '1');
/// `asset_class_hint` is what the report's own section said (e.g. the «Фонды» table), so
/// it is offered as the initial value of a control the user must still look at.
late String _assetClass = assetClassKeys.contains(widget.pending.assetClassHint)
late String _assetClass =
assetClassKeys.contains(widget.pending.assetClassHint)
? widget.pending.assetClassHint!
: 'share';
@@ -43,15 +46,17 @@ class _CreateInstrumentDialogState extends State<CreateInstrumentDialog> {
void _submit() {
if (!_formKey.currentState!.validate()) return;
Navigator.of(context).pop(NewInstrument(
assetClass: _assetClass,
name: _name.text.trim(),
currency: _currency.text.trim().toUpperCase(),
isin: _isin.text.trim(),
ticker: _ticker.text.trim(),
board: _board.text.trim(),
lot: int.tryParse(_lot.text.trim()),
));
Navigator.of(context).pop(
NewInstrument(
assetClass: _assetClass,
name: _name.text.trim(),
currency: _currency.text.trim().toUpperCase(),
isin: _isin.text.trim(),
ticker: _ticker.text.trim(),
board: _board.text.trim(),
lot: int.tryParse(_lot.text.trim()),
),
);
}
@override
@@ -72,27 +77,44 @@ class _CreateInstrumentDialogState extends State<CreateInstrumentDialog> {
decoration: const InputDecoration(labelText: 'Класс актива'),
items: [
for (final key in assetClassKeys)
DropdownMenuItem(value: key, child: Text('${assetClassLabel(key)} ($key)')),
DropdownMenuItem(
value: key,
child: Text('${assetClassLabel(key)} ($key)'),
),
],
onChanged: (v) => setState(() => _assetClass = v ?? _assetClass),
onChanged: (v) =>
setState(() => _assetClass = v ?? _assetClass),
),
_field(_name, 'Название', required: true),
_field(_isin, 'ISIN'),
_field(_ticker, 'Тикер'),
_field(_board, 'Доска (TQBR, TQTF…)'),
_field(_currency, 'Валюта', required: true),
_field(_lot, 'Лот', keyboard: TextInputType.number, validator: (v) {
if (v == null || v.trim().isEmpty) return null;
return int.tryParse(v.trim()) == null ? 'Целое число' : null;
}),
_field(
_lot,
'Лот',
keyboard: TextInputType.number,
validator: (v) {
if (v == null || v.trim().isEmpty) return null;
return int.tryParse(v.trim()) == null
? 'Целое число'
: null;
},
),
],
),
),
),
),
actions: [
TextButton(onPressed: () => Navigator.of(context).pop(), child: const Text('Отмена')),
FilledButton(onPressed: _submit, child: const Text('Создать и привязать')),
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('Отмена'),
),
FilledButton(
onPressed: _submit,
child: const Text('Создать и привязать'),
),
],
);
}
@@ -110,9 +132,12 @@ class _CreateInstrumentDialogState extends State<CreateInstrumentDialog> {
controller: controller,
keyboardType: keyboard,
decoration: InputDecoration(labelText: label, isDense: true),
validator: validator ??
validator:
validator ??
(required
? (v) => (v == null || v.trim().isEmpty) ? 'Обязательное поле' : null
? (v) => (v == null || v.trim().isEmpty)
? 'Обязательное поле'
: null
: null),
),
);