Files
yanting/lib/features/profile/profile_page.dart
T

81 lines
3.1 KiB
Dart

import 'package:flutter/material.dart';
import '../../data/api/report_data_source.dart';
import '../../theme/wise_tokens.dart';
import '../../widgets/app_buttons.dart';
import '../../widgets/app_card.dart';
import '../../widgets/sheets.dart';
import '../../widgets/states.dart';
class ProfilePage extends StatelessWidget {
const ProfilePage({required this.dataSource, super.key});
final ReportDataSource dataSource;
@override
Widget build(BuildContext context) {
return ListView(
padding: const EdgeInsets.all(WiseSpacing.x4),
children: [
AppCard(
color: WiseColors.secondary200,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('游客', style: Theme.of(context).textTheme.headlineSmall),
const SizedBox(height: WiseSpacing.x2),
Text('浏览、阅读和完整收听不需要登录。收藏、历史同步和保存听单等待 auth 接口接入。', style: Theme.of(context).textTheme.bodyMedium),
const SizedBox(height: WiseSpacing.x4),
AppButton(
label: '登录后保存个人状态',
icon: Icons.login,
onPressed: () => showLoginSheet(context),
),
],
),
),
const SizedBox(height: WiseSpacing.x4),
_ProfileRow(icon: Icons.favorite_border, title: '收藏研报', subtitle: '登录后同步收藏', onTap: () => showLoginSheet(context, reason: '登录后保存到你的收藏')),
_ProfileRow(icon: Icons.history, title: '浏览历史', subtitle: '本地历史占位,服务端同步待接入', onTap: () => showAppToast(context, '历史同步接口待接入')),
_ProfileRow(icon: Icons.playlist_add_check, title: '保存听单', subtitle: '登录后保存到你的听单', onTap: () => showLoginSheet(context, reason: '登录后保存到你的听单')),
_ProfileRow(icon: Icons.open_in_new, title: '了解研值相关服务', subtitle: '外跳前提示风险边界', onTap: () => showOutboundSheet(context, title: '研值相关服务')),
],
);
}
}
class _ProfileRow extends StatelessWidget {
const _ProfileRow({required this.icon, required this.title, required this.subtitle, required this.onTap});
final IconData icon;
final String title;
final String subtitle;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(bottom: WiseSpacing.x3),
child: AppCard(
onTap: onTap,
child: Row(
children: [
Icon(icon, color: WiseColors.primary),
const SizedBox(width: WiseSpacing.x3),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(title, style: Theme.of(context).textTheme.titleMedium),
Text(subtitle, style: Theme.of(context).textTheme.bodySmall),
],
),
),
const Icon(Icons.chevron_right, color: WiseColors.textTertiary),
],
),
),
);
}
}