style(app): остальные экраны под новый визуальный язык и форматирование
Доходы, ребалансировка, налоги, импорт, цели, здоровье данных, правила, транзакции, категории, cashflow, pending: новые виджеты и токены темы, dart format. Тесты подстроены под новые модели.
This commit is contained in:
@@ -5,7 +5,9 @@ import '../../core/cache/cached.dart';
|
||||
import '../portfolio/providers.dart' show scopeProvider;
|
||||
import 'data/income_api.dart';
|
||||
|
||||
final incomeApiProvider = Provider<IncomeApi>((ref) => IncomeApi(ref.watch(apiProvider).dio));
|
||||
final incomeApiProvider = Provider<IncomeApi>(
|
||||
(ref) => IncomeApi(ref.watch(apiProvider).dio),
|
||||
);
|
||||
|
||||
/// How far the calendar looks ahead, in months. 12 is the contract default.
|
||||
final calendarMonthsProvider = StateProvider<int>((ref) => 12);
|
||||
@@ -14,41 +16,49 @@ final calendarIncludePaidProvider = StateProvider<bool>((ref) => false);
|
||||
|
||||
/// Доходы shares the portfolio-wide [scopeProvider]: switching the scope on Портфель must
|
||||
/// not leave the income calendar showing a different portfolio. See `docs/ai/offline-cache.md`.
|
||||
final incomeCalendarProvider = FutureProvider.autoDispose<Cached<IncomeCalendar>>((ref) async {
|
||||
final scope = ref.watch(scopeProvider);
|
||||
final months = ref.watch(calendarMonthsProvider);
|
||||
final includePaid = ref.watch(calendarIncludePaidProvider);
|
||||
final now = DateTime.now();
|
||||
return ref.watch(incomeApiProvider).calendar(
|
||||
scope: scope,
|
||||
dateFrom: DateTime(now.year, now.month, now.day),
|
||||
dateTo: DateTime(now.year, now.month + months, now.day),
|
||||
includePaid: includePaid,
|
||||
);
|
||||
});
|
||||
final incomeCalendarProvider =
|
||||
FutureProvider.autoDispose<Cached<IncomeCalendar>>((ref) async {
|
||||
final scope = ref.watch(scopeProvider);
|
||||
final months = ref.watch(calendarMonthsProvider);
|
||||
final includePaid = ref.watch(calendarIncludePaidProvider);
|
||||
final now = DateTime.now();
|
||||
return ref
|
||||
.watch(incomeApiProvider)
|
||||
.calendar(
|
||||
scope: scope,
|
||||
dateFrom: DateTime(now.year, now.month, now.day),
|
||||
dateTo: DateTime(now.year, now.month + months, now.day),
|
||||
includePaid: includePaid,
|
||||
);
|
||||
});
|
||||
|
||||
/// How far the history goes back, in months.
|
||||
final historyMonthsProvider = StateProvider<int>((ref) => 24);
|
||||
|
||||
final incomeHistoryProvider = FutureProvider.autoDispose<Cached<IncomeHistory>>((ref) async {
|
||||
final scope = ref.watch(scopeProvider);
|
||||
final months = ref.watch(historyMonthsProvider);
|
||||
final now = DateTime.now();
|
||||
return ref.watch(incomeApiProvider).history(
|
||||
scope: scope,
|
||||
dateFrom: DateTime(now.year, now.month - months + 1, 1),
|
||||
dateTo: DateTime(now.year, now.month + 1, 0),
|
||||
);
|
||||
});
|
||||
final incomeHistoryProvider = FutureProvider.autoDispose<Cached<IncomeHistory>>(
|
||||
(ref) async {
|
||||
final scope = ref.watch(scopeProvider);
|
||||
final months = ref.watch(historyMonthsProvider);
|
||||
final now = DateTime.now();
|
||||
return ref
|
||||
.watch(incomeApiProvider)
|
||||
.history(
|
||||
scope: scope,
|
||||
dateFrom: DateTime(now.year, now.month - months + 1, 1),
|
||||
dateTo: DateTime(now.year, now.month + 1, 0),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
final forecastMonthsProvider = StateProvider<int>((ref) => 12);
|
||||
|
||||
final incomeForecastProvider = FutureProvider.autoDispose<Cached<IncomeForecast>>((ref) async {
|
||||
final scope = ref.watch(scopeProvider);
|
||||
return ref
|
||||
.watch(incomeApiProvider)
|
||||
.forecast(scope: scope, months: ref.watch(forecastMonthsProvider));
|
||||
});
|
||||
final incomeForecastProvider =
|
||||
FutureProvider.autoDispose<Cached<IncomeForecast>>((ref) async {
|
||||
final scope = ref.watch(scopeProvider);
|
||||
return ref
|
||||
.watch(incomeApiProvider)
|
||||
.forecast(scope: scope, months: ref.watch(forecastMonthsProvider));
|
||||
});
|
||||
|
||||
void invalidateIncomeProviders(WidgetRef ref) {
|
||||
ref.invalidate(incomeCalendarProvider);
|
||||
|
||||
Reference in New Issue
Block a user