111
This commit is contained in:
@@ -5,7 +5,6 @@ import '../../../core/theme/app_spacing.dart';
|
||||
import '../../../core/theme/app_theme.dart';
|
||||
import '../../../core/event/app_event_bus.dart';
|
||||
import '../../../providers/asset_provider.dart';
|
||||
import 'components/account_tab_switcher.dart';
|
||||
import 'components/action_buttons_row.dart';
|
||||
import 'components/asset_dialogs.dart';
|
||||
import 'components/balance_card.dart';
|
||||
@@ -23,7 +22,6 @@ class AssetPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _AssetPageState extends State<AssetPage> with AutomaticKeepAliveClientMixin {
|
||||
int _activeTab = 0;
|
||||
StreamSubscription<AppEvent>? _eventSub;
|
||||
|
||||
@override
|
||||
@@ -76,7 +74,7 @@ class _AssetPageState extends State<AssetPage> with AutomaticKeepAliveClientMixi
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Page title: "资产" 22px bold — matching .pen titleFrame padding [16,0,8,0]
|
||||
// Page title
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16, bottom: 8),
|
||||
child: Text(
|
||||
@@ -85,16 +83,25 @@ class _AssetPageState extends State<AssetPage> with AutomaticKeepAliveClientMixi
|
||||
),
|
||||
),
|
||||
const SizedBox(height: AppSpacing.sm),
|
||||
// Account tab switcher — pill-style matching .pen UE6xC
|
||||
AccountTabSwitcher(
|
||||
selectedIndex: _activeTab,
|
||||
onChanged: (index) => setState(() => _activeTab = index),
|
||||
),
|
||||
const SizedBox(height: AppSpacing.md),
|
||||
// Balance card — matching .pen 59637 (cornerRadius lg, stroke, padding 20, gap 12)
|
||||
BalanceCard(
|
||||
provider: provider,
|
||||
activeTab: _activeTab,
|
||||
// 资金账户 + 交易账户 左右并排
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: BalanceCard(
|
||||
provider: provider,
|
||||
label: '资金账户',
|
||||
balance: provider.fundAccount?.balance ?? provider.overview?.fundBalance ?? '0.00',
|
||||
),
|
||||
),
|
||||
const SizedBox(width: AppSpacing.sm),
|
||||
Expanded(
|
||||
child: BalanceCard(
|
||||
provider: provider,
|
||||
label: '交易账户',
|
||||
balance: _calculateTradeTotal(provider),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: AppSpacing.md),
|
||||
// Action buttons row — matching .pen pIpHe (gap 12)
|
||||
@@ -112,8 +119,8 @@ class _AssetPageState extends State<AssetPage> with AutomaticKeepAliveClientMixi
|
||||
),
|
||||
),
|
||||
const SizedBox(height: AppSpacing.md),
|
||||
// Holdings section — matching .pen th9BG + 6X6tC
|
||||
HoldingsSection(holdings: _activeTab == 1 ? provider.holdings : []),
|
||||
// Holdings section
|
||||
HoldingsSection(holdings: provider.holdings),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -123,6 +130,14 @@ class _AssetPageState extends State<AssetPage> with AutomaticKeepAliveClientMixi
|
||||
);
|
||||
}
|
||||
|
||||
String _calculateTradeTotal(AssetProvider provider) {
|
||||
double total = 0;
|
||||
for (var h in provider.holdings) {
|
||||
total += double.tryParse(h.currentValue?.toString() ?? '0') ?? 0;
|
||||
}
|
||||
return total.toStringAsFixed(2);
|
||||
}
|
||||
|
||||
void _navigateToTransfer(BuildContext context) async {
|
||||
final result = await Navigator.push<bool>(
|
||||
context,
|
||||
|
||||
Reference in New Issue
Block a user