feat(app): новый визуальный язык, верхняя навигация, портфели, создание счетов и ручные события
Тема и общие виджеты (AssetIcon, ServiceMark, HelpTip, глоссарий), верхняя панель TopNav и вкладки Аналитики вместо NavSidebar, иконки PWA. Экраны: портфели, создание брокерского счёта, ручное событие, правка инструмента, Обзор карточками по скоупам и таблица активов, пересчёт метрик с опросом /metrics/status. design-system.md обновлён.
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
import 'package:fintracker_api/fintracker_api.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../core/cache/cached.dart';
|
||||
import '../../core/widgets/async_value_view.dart';
|
||||
import '../../core/widgets/stale_banner.dart';
|
||||
import 'allocation_tab.dart';
|
||||
import 'benchmarks_card.dart';
|
||||
import 'holdings_tab.dart';
|
||||
import 'providers.dart';
|
||||
import 'scope_selector.dart';
|
||||
|
||||
/// Портфель: позиции и аллокация as two tabs of one screen, sharing one scope.
|
||||
///
|
||||
@@ -37,9 +36,12 @@ class PortfolioPage extends ConsumerWidget {
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Портфель'),
|
||||
actions: const [_ScopeSelector(), SizedBox(width: 8)],
|
||||
actions: const [ScopeSelector(), SizedBox(width: 8)],
|
||||
bottom: const TabBar(
|
||||
tabs: [Tab(text: 'Позиции'), Tab(text: 'Аллокация')],
|
||||
tabs: [
|
||||
Tab(text: 'Позиции'),
|
||||
Tab(text: 'Аллокация'),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: Column(
|
||||
@@ -50,7 +52,12 @@ class PortfolioPage extends ConsumerWidget {
|
||||
child: StaleBanner(fetchedAt: stale),
|
||||
),
|
||||
const Expanded(
|
||||
child: TabBarView(children: [HoldingsTab(), AllocationTab()]),
|
||||
child: TabBarView(
|
||||
children: [
|
||||
HoldingsTab(sections: HoldingsSections.table),
|
||||
AllocationTab(),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -58,39 +65,3 @@ class PortfolioPage extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Switches every portfolio screen at once. Hidden while there is nothing to choose
|
||||
/// between — a dropdown with one option is furniture, not a control.
|
||||
class _ScopeSelector extends ConsumerWidget {
|
||||
const _ScopeSelector();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final scopes = ref.watch(scopesProvider);
|
||||
final current = ref.watch(scopeProvider);
|
||||
|
||||
return AsyncValueView<List<ScopeOut>>(
|
||||
value: scopes,
|
||||
data: (rows) {
|
||||
if (rows.length < 2) return const SizedBox.shrink();
|
||||
final known = rows.any((s) => s.scope == current) ? current : rows.first.scope;
|
||||
return DropdownButtonHideUnderline(
|
||||
child: DropdownButton<String>(
|
||||
value: known,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
items: [
|
||||
for (final s in rows)
|
||||
DropdownMenuItem(
|
||||
value: s.scope,
|
||||
child: Text(s.name, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
],
|
||||
onChanged: (value) {
|
||||
if (value != null) ref.read(scopeProvider.notifier).state = value;
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user