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
+36 -33
View File
@@ -40,33 +40,33 @@ class Goal {
/// The create/patch body. `id` is never sent; `null` fields are omitted so a PATCH that
/// touches one field does not blank the rest.
Map<String, dynamic> toJson() => {
'name': name,
'scope': scope,
'target_amount': targetAmount,
'currency': currency,
'target_date': ?_isoDate(targetDate),
'monthly_contribution': ?monthlyContribution,
'note': ?note,
'archived': archived,
};
'name': name,
'scope': scope,
'target_amount': targetAmount,
'currency': currency,
'target_date': ?_isoDate(targetDate),
'monthly_contribution': ?monthlyContribution,
'note': ?note,
'archived': archived,
};
static Goal fromJson(Map<String, dynamic> json) => Goal(
id: asInt(json['id']) ?? 0,
name: asString(json['name']) ?? 'Без названия',
scope: asString(json['scope']) ?? 'all',
targetAmount: asString(json['target_amount']) ?? '0',
currency: asString(json['currency']) ?? 'RUB',
targetDate: asDate(json['target_date']),
monthlyContribution: asString(json['monthly_contribution']),
note: asString(json['note']),
archived: asBool(json['archived']),
);
id: asInt(json['id']) ?? 0,
name: asString(json['name']) ?? 'Без названия',
scope: asString(json['scope']) ?? 'all',
targetAmount: asString(json['target_amount']) ?? '0',
currency: asString(json['currency']) ?? 'RUB',
targetDate: asDate(json['target_date']),
monthlyContribution: asString(json['monthly_contribution']),
note: asString(json['note']),
archived: asBool(json['archived']),
);
static String? _isoDate(DateTime? d) => d == null
? null
: '${d.year.toString().padLeft(4, '0')}-'
'${d.month.toString().padLeft(2, '0')}-'
'${d.day.toString().padLeft(2, '0')}';
'${d.month.toString().padLeft(2, '0')}-'
'${d.day.toString().padLeft(2, '0')}';
}
class GoalProgress {
@@ -106,17 +106,17 @@ class GoalProgress {
bool get isUnreachable => projectedDate == null && basis != 'none';
static GoalProgress fromJson(Map<String, dynamic> json) => GoalProgress(
goalId: asInt(json['goal_id']) ?? 0,
asOf: asDate(json['as_of']),
currentValueRub: asString(json['current_value_rub']),
targetAmountRub: asString(json['target_amount_rub']),
progress: asString(json['progress']),
projectedDate: asDate(json['projected_date']),
basis: asString(json['basis']) ?? 'none',
assumedRate: asString(json['assumed_rate']),
monthlyNeededRub: asString(json['monthly_needed_rub']),
onTrack: asBool(json['on_track']),
);
goalId: asInt(json['goal_id']) ?? 0,
asOf: asDate(json['as_of']),
currentValueRub: asString(json['current_value_rub']),
targetAmountRub: asString(json['target_amount_rub']),
progress: asString(json['progress']),
projectedDate: asDate(json['projected_date']),
basis: asString(json['basis']) ?? 'none',
assumedRate: asString(json['assumed_rate']),
monthlyNeededRub: asString(json['monthly_needed_rub']),
onTrack: asBool(json['on_track']),
);
}
class GoalsApi {
@@ -142,7 +142,10 @@ class GoalsApi {
}
Future<Goal> patch(int id, Map<String, dynamic> changes) async {
final r = await _dio.patch<Map<String, dynamic>>('$_base/$id', data: changes);
final r = await _dio.patch<Map<String, dynamic>>(
'$_base/$id',
data: changes,
);
return Goal.fromJson(r.data ?? const {});
}