style(app): остальные экраны под новый визуальный язык и форматирование
Доходы, ребалансировка, налоги, импорт, цели, здоровье данных, правила, транзакции, категории, cashflow, pending: новые виджеты и токены темы, dart format. Тесты подстроены под новые модели.
This commit is contained in:
@@ -5,8 +5,9 @@ import '../../core/cache/cached.dart';
|
||||
import '../portfolio/providers.dart' show scopeProvider, scopesProvider;
|
||||
import 'data/rebalance_api.dart';
|
||||
|
||||
final rebalanceApiProvider =
|
||||
Provider<RebalanceApi>((ref) => RebalanceApi(ref.watch(apiProvider).dio));
|
||||
final rebalanceApiProvider = Provider<RebalanceApi>(
|
||||
(ref) => RebalanceApi(ref.watch(apiProvider).dio),
|
||||
);
|
||||
|
||||
/// A portfolio the user can rebalance, derived from the scope list the analytics API
|
||||
/// already publishes (`portfolio:<id>`): there is no separate portfolios endpoint, and
|
||||
@@ -17,7 +18,9 @@ class PortfolioRef {
|
||||
final String name;
|
||||
}
|
||||
|
||||
final portfoliosProvider = FutureProvider.autoDispose<List<PortfolioRef>>((ref) async {
|
||||
final portfoliosProvider = FutureProvider.autoDispose<List<PortfolioRef>>((
|
||||
ref,
|
||||
) async {
|
||||
final scopes = await ref.watch(scopesProvider.future);
|
||||
return [
|
||||
for (final s in scopes)
|
||||
@@ -41,20 +44,25 @@ final whatIfCashProvider = StateProvider<String?>((ref) => null);
|
||||
|
||||
/// See `docs/ai/offline-cache.md`. No portfolio selected yet is a live, empty answer — not a
|
||||
/// stale one — so it is wrapped with `fetchedAt: null` rather than left unwrapped.
|
||||
final targetsProvider = FutureProvider.autoDispose<Cached<TargetSet>>((ref) async {
|
||||
final targetsProvider = FutureProvider.autoDispose<Cached<TargetSet>>((
|
||||
ref,
|
||||
) async {
|
||||
final id = ref.watch(selectedPortfolioProvider);
|
||||
final dimension = ref.watch(targetDimensionProvider);
|
||||
if (id == null) return Cached(TargetSet(dimension: dimension));
|
||||
return ref.watch(rebalanceApiProvider).getTargets(id, dimension: dimension);
|
||||
});
|
||||
|
||||
final rebalancePlanProvider = FutureProvider.autoDispose<Cached<RebalancePlan?>>((ref) async {
|
||||
final id = ref.watch(selectedPortfolioProvider);
|
||||
final dimension = ref.watch(targetDimensionProvider);
|
||||
final cash = ref.watch(whatIfCashProvider);
|
||||
if (id == null) return const Cached(null);
|
||||
return ref.watch(rebalanceApiProvider).plan(id, dimension: dimension, cashAvailable: cash);
|
||||
});
|
||||
final rebalancePlanProvider =
|
||||
FutureProvider.autoDispose<Cached<RebalancePlan?>>((ref) async {
|
||||
final id = ref.watch(selectedPortfolioProvider);
|
||||
final dimension = ref.watch(targetDimensionProvider);
|
||||
final cash = ref.watch(whatIfCashProvider);
|
||||
if (id == null) return const Cached(null);
|
||||
return ref
|
||||
.watch(rebalanceApiProvider)
|
||||
.plan(id, dimension: dimension, cashAvailable: cash);
|
||||
});
|
||||
|
||||
/// After a successful PUT the numbers are recomputed on the server, so both sides of the
|
||||
/// screen are refetched rather than patched in place.
|
||||
|
||||
Reference in New Issue
Block a user