style(app): остальные экраны под новый визуальный язык и форматирование
Доходы, ребалансировка, налоги, импорт, цели, здоровье данных, правила, транзакции, категории, cashflow, pending: новые виджеты и токены темы, dart format. Тесты подстроены под новые модели.
This commit is contained in:
@@ -7,12 +7,22 @@ import '../../core/widgets/money_text.dart';
|
||||
/// The amount/currency/RUB-equivalent a transaction is shown with, chosen by
|
||||
/// its [FlowType]: the outgoing leg for expenses and transfers out, the
|
||||
/// incoming leg for income.
|
||||
({String amount, String currency, String? rub}) primaryAmount(TransactionOut t) {
|
||||
({String amount, String currency, String? rub}) primaryAmount(
|
||||
TransactionOut t,
|
||||
) {
|
||||
switch (t.flowType) {
|
||||
case FlowType.income:
|
||||
return (amount: t.income, currency: t.incomeCurrency ?? 'RUB', rub: t.incomeRub);
|
||||
return (
|
||||
amount: t.income,
|
||||
currency: t.incomeCurrency ?? 'RUB',
|
||||
rub: t.incomeRub,
|
||||
);
|
||||
case FlowType.expense:
|
||||
return (amount: t.outcome, currency: t.outcomeCurrency ?? 'RUB', rub: t.outcomeRub);
|
||||
return (
|
||||
amount: t.outcome,
|
||||
currency: t.outcomeCurrency ?? 'RUB',
|
||||
rub: t.outcomeRub,
|
||||
);
|
||||
case FlowType.internalTransfer:
|
||||
case FlowType.savingsTransfer:
|
||||
case FlowType.brokerExternalFlow:
|
||||
@@ -20,22 +30,33 @@ import '../../core/widgets/money_text.dart';
|
||||
case FlowType.deleted:
|
||||
case FlowType.unknownDefaultOpenApi:
|
||||
if (t.outcome != '0' && t.outcomeCurrency != null) {
|
||||
return (amount: t.outcome, currency: t.outcomeCurrency!, rub: t.outcomeRub);
|
||||
return (
|
||||
amount: t.outcome,
|
||||
currency: t.outcomeCurrency!,
|
||||
rub: t.outcomeRub,
|
||||
);
|
||||
}
|
||||
return (amount: t.income, currency: t.incomeCurrency ?? 'RUB', rub: t.incomeRub);
|
||||
return (
|
||||
amount: t.income,
|
||||
currency: t.incomeCurrency ?? 'RUB',
|
||||
rub: t.incomeRub,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
(IconData, Color) flowTypeIcon(FlowType type, ColorScheme scheme) => switch (type) {
|
||||
(IconData, Color) flowTypeIcon(FlowType type, ColorScheme scheme) =>
|
||||
switch (type) {
|
||||
FlowType.income => (Icons.arrow_circle_down_outlined, Colors.green),
|
||||
FlowType.expense => (Icons.arrow_circle_up_outlined, scheme.error),
|
||||
FlowType.internalTransfer => (Icons.swap_horiz, scheme.primary),
|
||||
FlowType.savingsTransfer => (Icons.savings_outlined, Colors.amber.shade800),
|
||||
FlowType.savingsTransfer => (
|
||||
Icons.savings_outlined,
|
||||
Colors.amber.shade800,
|
||||
),
|
||||
FlowType.brokerExternalFlow => (Icons.trending_up, Colors.deepPurple),
|
||||
FlowType.other || FlowType.deleted || FlowType.unknownDefaultOpenApi => (
|
||||
Icons.help_outline,
|
||||
scheme.outline,
|
||||
),
|
||||
FlowType.other ||
|
||||
FlowType.deleted ||
|
||||
FlowType.unknownDefaultOpenApi => (Icons.help_outline, scheme.outline),
|
||||
};
|
||||
|
||||
/// One row of the Операции list: date, payee, category, native amount with
|
||||
@@ -59,7 +80,9 @@ class TransactionRow extends StatelessWidget {
|
||||
final (icon, color) = flowTypeIcon(t.flowType, scheme);
|
||||
final amount = primaryAmount(t);
|
||||
final showRub = amount.currency != 'RUB' && amount.rub != null;
|
||||
final payee = t.payeeCanonical?.isNotEmpty == true ? t.payeeCanonical! : (t.payee ?? '—');
|
||||
final payee = t.payeeCanonical?.isNotEmpty == true
|
||||
? t.payeeCanonical!
|
||||
: (t.payee ?? '—');
|
||||
|
||||
return ListTile(
|
||||
onTap: onTap,
|
||||
@@ -74,7 +97,8 @@ class TransactionRow extends StatelessWidget {
|
||||
if (showRub)
|
||||
Text(
|
||||
MoneyText.format(amount.rub!, 'RUB'),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(color: scheme.outline),
|
||||
style: Theme.of(context).textTheme.bodySmall
|
||||
?.copyWith(color: scheme.outline),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user