feat: app 端 ui 设计完成
This commit is contained in:
134
wei_ai_app/lib/screens/profile/device_manager_screen.dart
Normal file
134
wei_ai_app/lib/screens/profile/device_manager_screen.dart
Normal file
@@ -0,0 +1,134 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lucide_icons/lucide_icons.dart';
|
||||
|
||||
class DeviceManagerScreen extends StatelessWidget {
|
||||
const DeviceManagerScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF2E1065),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
_buildHeader(context),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildSectionTitle('已连接设备'),
|
||||
const SizedBox(height: 12),
|
||||
_buildDeviceCard(name: 'Link-X Pro', id: '884-X9-01', battery: 85, isConnected: true),
|
||||
const SizedBox(height: 24),
|
||||
_buildSectionTitle('历史设备'),
|
||||
const SizedBox(height: 12),
|
||||
_buildDeviceCard(name: 'Link-S Mini', id: '772-M3-02', battery: 0, isConnected: false),
|
||||
const SizedBox(height: 24),
|
||||
_buildAddDeviceButton(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHeader(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 8, 16, 16),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
icon: Icon(LucideIcons.chevronLeft, color: Colors.white.withOpacity(0.7)),
|
||||
),
|
||||
const Text('我的设备', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSectionTitle(String title) {
|
||||
return Text(title, style: TextStyle(fontSize: 12, fontWeight: FontWeight.bold, letterSpacing: 2, color: Colors.white.withOpacity(0.4)));
|
||||
}
|
||||
|
||||
Widget _buildDeviceCard({required String name, required String id, required int battery, required bool isConnected}) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(color: Colors.white.withOpacity(0.1)),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(LucideIcons.bluetooth, size: 24, color: isConnected ? const Color(0xFF34D399) : Colors.white.withOpacity(0.5)),
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(name, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Colors.white)),
|
||||
const SizedBox(height: 2),
|
||||
Text('ID: $id', style: TextStyle(fontSize: 12, fontFamily: 'monospace', color: Colors.white.withOpacity(0.5))),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: isConnected ? const Color(0xFF34D399).withOpacity(0.2) : Colors.white.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
isConnected ? '已连接' : '未连接',
|
||||
style: TextStyle(fontSize: 12, fontWeight: FontWeight.bold, color: isConnected ? const Color(0xFF34D399) : Colors.white.withOpacity(0.5)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (isConnected) ...[
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
children: [
|
||||
Icon(LucideIcons.battery, size: 16, color: const Color(0xFF34D399)),
|
||||
const SizedBox(width: 8),
|
||||
Text('$battery%', style: const TextStyle(fontSize: 14, fontFamily: 'monospace', color: Colors.white)),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAddDeviceButton() {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: Colors.white.withOpacity(0.2)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(LucideIcons.plus, size: 20, color: Colors.white.withOpacity(0.7)),
|
||||
const SizedBox(width: 8),
|
||||
Text('添加新设备', style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white.withOpacity(0.7))),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
118
wei_ai_app/lib/screens/profile/help_screen.dart
Normal file
118
wei_ai_app/lib/screens/profile/help_screen.dart
Normal file
@@ -0,0 +1,118 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lucide_icons/lucide_icons.dart';
|
||||
|
||||
class HelpScreen extends StatelessWidget {
|
||||
const HelpScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF2E1065),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
_buildHeader(context),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildSectionTitle('常见问题'),
|
||||
const SizedBox(height: 12),
|
||||
_buildFaqItem(question: '如何连接设备?', answer: '进入手动实验室页面,点击"连接设备"按钮,开启蓝牙后按照提示操作。'),
|
||||
_buildFaqItem(question: '积分如何获取?', answer: '可通过充值购买或完成日常任务获得积分奖励。'),
|
||||
_buildFaqItem(question: '如何升级会员?', answer: '在个人中心点击订阅管理,选择合适的会员方案进行升级。'),
|
||||
const SizedBox(height: 24),
|
||||
_buildSectionTitle('联系我们'),
|
||||
const SizedBox(height: 12),
|
||||
_buildContactItem(icon: LucideIcons.messageCircle, title: '在线客服', subtitle: '工作时间: 9:00-21:00'),
|
||||
const SizedBox(height: 12),
|
||||
_buildContactItem(icon: LucideIcons.mail, title: '邮箱反馈', subtitle: 'support@weiai.com'),
|
||||
const SizedBox(height: 24),
|
||||
_buildFeedbackButton(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHeader(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 8, 16, 16),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(onPressed: () => Navigator.of(context).pop(), icon: Icon(LucideIcons.chevronLeft, color: Colors.white.withOpacity(0.7))),
|
||||
const Text('帮助与反馈', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSectionTitle(String title) {
|
||||
return Text(title, style: TextStyle(fontSize: 12, fontWeight: FontWeight.bold, letterSpacing: 2, color: Colors.white.withOpacity(0.4)));
|
||||
}
|
||||
|
||||
Widget _buildFaqItem({required String question, required String answer}) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(color: Colors.white.withOpacity(0.05), borderRadius: BorderRadius.circular(16), border: Border.all(color: Colors.white.withOpacity(0.1))),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(LucideIcons.helpCircle, size: 16, color: const Color(0xFFC084FC)),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(child: Text(question, style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Colors.white))),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(answer, style: TextStyle(fontSize: 13, color: Colors.white.withOpacity(0.6), height: 1.5)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildContactItem({required IconData icon, required String title, required String subtitle}) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(color: Colors.white.withOpacity(0.05), borderRadius: BorderRadius.circular(16), border: Border.all(color: Colors.white.withOpacity(0.1))),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(padding: const EdgeInsets.all(10), decoration: BoxDecoration(color: Colors.white.withOpacity(0.05), borderRadius: BorderRadius.circular(12)), child: Icon(icon, size: 20, color: Colors.white.withOpacity(0.7))),
|
||||
const SizedBox(width: 14),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(title, style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w500, color: Colors.white)),
|
||||
const SizedBox(height: 2),
|
||||
Text(subtitle, style: TextStyle(fontSize: 12, color: Colors.white.withOpacity(0.5))),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildFeedbackButton() {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
decoration: BoxDecoration(gradient: const LinearGradient(colors: [Color(0xFFC084FC), Color(0xFFF472B6)]), borderRadius: BorderRadius.circular(16)),
|
||||
child: const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(LucideIcons.send, size: 18, color: Colors.white),
|
||||
SizedBox(width: 8),
|
||||
Text('提交反馈', style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold, color: Colors.white)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
119
wei_ai_app/lib/screens/profile/privacy_screen.dart
Normal file
119
wei_ai_app/lib/screens/profile/privacy_screen.dart
Normal file
@@ -0,0 +1,119 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lucide_icons/lucide_icons.dart';
|
||||
|
||||
class PrivacyScreen extends StatefulWidget {
|
||||
const PrivacyScreen({super.key});
|
||||
|
||||
@override
|
||||
State<PrivacyScreen> createState() => _PrivacyScreenState();
|
||||
}
|
||||
|
||||
class _PrivacyScreenState extends State<PrivacyScreen> {
|
||||
bool _dataEncryption = true;
|
||||
bool _anonymousMode = false;
|
||||
bool _shareAnalytics = true;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF2E1065),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
_buildHeader(),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildSecurityStatus(),
|
||||
const SizedBox(height: 24),
|
||||
_buildSectionTitle('隐私设置'),
|
||||
const SizedBox(height: 12),
|
||||
_buildSwitchTile(icon: LucideIcons.lock, title: '端到端加密', subtitle: '所有数据均已加密保护', value: _dataEncryption, onChanged: (v) => setState(() => _dataEncryption = v)),
|
||||
const SizedBox(height: 12),
|
||||
_buildSwitchTile(icon: LucideIcons.eyeOff, title: '匿名模式', subtitle: '隐藏个人信息和活动记录', value: _anonymousMode, onChanged: (v) => setState(() => _anonymousMode = v)),
|
||||
const SizedBox(height: 12),
|
||||
_buildSwitchTile(icon: LucideIcons.barChart2, title: '分享使用数据', subtitle: '帮助我们改进产品体验', value: _shareAnalytics, onChanged: (v) => setState(() => _shareAnalytics = v)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHeader() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 8, 16, 16),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(onPressed: () => Navigator.of(context).pop(), icon: Icon(LucideIcons.chevronLeft, color: Colors.white.withOpacity(0.7))),
|
||||
const Text('隐私安全', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSecurityStatus() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF34D399).withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(color: const Color(0xFF34D399).withOpacity(0.3)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(color: const Color(0xFF34D399).withOpacity(0.2), shape: BoxShape.circle),
|
||||
child: const Icon(LucideIcons.shieldCheck, size: 24, color: Color(0xFF34D399)),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
const Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('账户安全', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Color(0xFF34D399))),
|
||||
SizedBox(height: 4),
|
||||
Text('您的账户处于安全状态', style: TextStyle(fontSize: 12, color: Colors.white70)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSectionTitle(String title) {
|
||||
return Text(title, style: TextStyle(fontSize: 12, fontWeight: FontWeight.bold, letterSpacing: 2, color: Colors.white.withOpacity(0.4)));
|
||||
}
|
||||
|
||||
Widget _buildSwitchTile({required IconData icon, required String title, required String subtitle, required bool value, required ValueChanged<bool> onChanged}) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(color: Colors.white.withOpacity(0.05), borderRadius: BorderRadius.circular(16), border: Border.all(color: Colors.white.withOpacity(0.1))),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(padding: const EdgeInsets.all(10), decoration: BoxDecoration(color: Colors.white.withOpacity(0.05), borderRadius: BorderRadius.circular(12)), child: Icon(icon, size: 20, color: Colors.white.withOpacity(0.7))),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(title, style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w500, color: Colors.white)),
|
||||
const SizedBox(height: 2),
|
||||
Text(subtitle, style: TextStyle(fontSize: 12, color: Colors.white.withOpacity(0.5))),
|
||||
],
|
||||
),
|
||||
),
|
||||
Switch(value: value, onChanged: onChanged, activeColor: const Color(0xFFC084FC)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
404
wei_ai_app/lib/screens/profile/profile_screen.dart
Normal file
404
wei_ai_app/lib/screens/profile/profile_screen.dart
Normal file
@@ -0,0 +1,404 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:lucide_icons/lucide_icons.dart';
|
||||
import '../../widgets/tab_content_layout.dart';
|
||||
|
||||
class ProfileScreen extends StatelessWidget {
|
||||
const ProfileScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
const double bottomNavHeight = 90;
|
||||
|
||||
return TabContentLayout(
|
||||
child: SingleChildScrollView(
|
||||
padding: EdgeInsets.fromLTRB(16, 8, 16, bottomNavHeight + 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// User Header
|
||||
_buildUserHeader(context),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Stats Grid
|
||||
_buildStatsGrid(),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Joy Points Card
|
||||
_buildJoyPointsCard(context),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Menu List
|
||||
_buildMenuSection(context),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Logout Button
|
||||
_buildLogoutButton(),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Version
|
||||
Center(
|
||||
child: Text(
|
||||
'Wei AI v2.5.0 (Neon Edition)',
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontFamily: 'monospace',
|
||||
color: Colors.white.withOpacity(0.3),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildUserHeader(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
// Avatar
|
||||
Container(
|
||||
padding: const EdgeInsets.all(2),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
gradient: const LinearGradient(
|
||||
colors: [Color(0xFFC084FC), Color(0xFFF472B6)],
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
width: 64,
|
||||
height: 64,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: Colors.white.withOpacity(0.2), width: 2),
|
||||
image: const DecorationImage(
|
||||
image: NetworkImage('https://api.dicebear.com/7.x/avataaars/png?seed=commander'),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
|
||||
// User Info
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'Commander',
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: Colors.white.withOpacity(0.1)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(LucideIcons.crown, size: 12, color: const Color(0xFFFBBF24)),
|
||||
const SizedBox(width: 4),
|
||||
const Text(
|
||||
'LV.4 黑金会员',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
letterSpacing: 1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
// Settings Button
|
||||
GestureDetector(
|
||||
onTap: () => context.push('/profile/settings'),
|
||||
child: Container(
|
||||
width: 44,
|
||||
height: 44,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.1),
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: Colors.white.withOpacity(0.1)),
|
||||
),
|
||||
child: Icon(LucideIcons.settings, size: 20, color: Colors.white.withOpacity(0.7)),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatsGrid() {
|
||||
final stats = [
|
||||
{'label': '互动时长', 'val': '42', 'unit': 'h'},
|
||||
{'label': '亲密指数', 'val': '85', 'unit': '%'},
|
||||
{'label': '解锁剧本', 'val': '12', 'unit': '个'},
|
||||
];
|
||||
|
||||
return Row(
|
||||
children: stats.map((stat) {
|
||||
return Expanded(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 4),
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: Colors.white.withOpacity(0.1)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
stat['val']!,
|
||||
style: const TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'monospace',
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: Text(
|
||||
stat['unit']!,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
color: Colors.white.withOpacity(0.6),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
stat['label']!,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
letterSpacing: 1,
|
||||
color: Colors.white.withOpacity(0.5),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildJoyPointsCard(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => context.push('/profile/topup'),
|
||||
child: Container(
|
||||
height: 120,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
gradient: const LinearGradient(
|
||||
colors: [Color(0xFF7C3AED), Color(0xFF9333EA), Color(0xFFDB2777)],
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: const Color(0xFFC084FC).withOpacity(0.4),
|
||||
blurRadius: 30,
|
||||
offset: const Offset(0, 10),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(LucideIcons.zap, size: 16, color: Colors.white.withOpacity(0.9)),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
'JOY POINTS',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.bold,
|
||||
letterSpacing: 2,
|
||||
color: Colors.white.withOpacity(0.9),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
const Text(
|
||||
'2,450',
|
||||
style: TextStyle(
|
||||
fontSize: 36,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'monospace',
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
),
|
||||
child: const Text(
|
||||
'立即充值',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF9333EA),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMenuSection(BuildContext context) {
|
||||
final menuItems = [
|
||||
{'id': 'device', 'icon': LucideIcons.bluetooth, 'label': '我的设备', 'sub': 'Link-X Pro', 'route': '/profile/device'},
|
||||
{'id': 'sub', 'icon': LucideIcons.creditCard, 'label': '订阅管理', 'sub': '', 'route': '/profile/subscription'},
|
||||
{'id': 'privacy', 'icon': LucideIcons.shield, 'label': '隐私安全', 'sub': '', 'route': '/profile/privacy'},
|
||||
{'id': 'help', 'icon': LucideIcons.helpCircle, 'label': '帮助与反馈', 'sub': '', 'route': '/profile/help'},
|
||||
];
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 4, bottom: 8),
|
||||
child: Text(
|
||||
'GENERAL',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.bold,
|
||||
letterSpacing: 2,
|
||||
color: Colors.white.withOpacity(0.4),
|
||||
),
|
||||
),
|
||||
),
|
||||
...menuItems.map((item) => _buildMenuItem(
|
||||
context,
|
||||
icon: item['icon'] as IconData,
|
||||
label: item['label'] as String,
|
||||
sub: item['sub'] as String,
|
||||
route: item['route'] as String,
|
||||
)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMenuItem(BuildContext context, {
|
||||
required IconData icon,
|
||||
required String label,
|
||||
required String sub,
|
||||
required String route,
|
||||
}) {
|
||||
return GestureDetector(
|
||||
onTap: () => context.push(route),
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(bottom: 10),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: Colors.white.withOpacity(0.1)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Icon(icon, size: 20, color: Colors.white.withOpacity(0.7)),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
if (sub.isNotEmpty)
|
||||
Text(
|
||||
sub,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Colors.white.withOpacity(0.5),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Icon(LucideIcons.chevronRight, size: 18, color: Colors.white.withOpacity(0.3)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLogoutButton() {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: Colors.red.withOpacity(0.3)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(LucideIcons.logOut, size: 18, color: Colors.red[400]),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'退出登录',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.red[400],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
231
wei_ai_app/lib/screens/profile/settings_screen.dart
Normal file
231
wei_ai_app/lib/screens/profile/settings_screen.dart
Normal file
@@ -0,0 +1,231 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lucide_icons/lucide_icons.dart';
|
||||
|
||||
class SettingsScreen extends StatefulWidget {
|
||||
const SettingsScreen({super.key});
|
||||
|
||||
@override
|
||||
State<SettingsScreen> createState() => _SettingsScreenState();
|
||||
}
|
||||
|
||||
class _SettingsScreenState extends State<SettingsScreen> {
|
||||
bool _notificationsEnabled = true;
|
||||
bool _darkMode = true;
|
||||
bool _hapticFeedback = true;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF2E1065),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
_buildHeader(),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildSectionTitle('通知'),
|
||||
_buildSwitchTile(
|
||||
icon: LucideIcons.bell,
|
||||
title: '推送通知',
|
||||
subtitle: '接收消息和活动提醒',
|
||||
value: _notificationsEnabled,
|
||||
onChanged: (v) => setState(() => _notificationsEnabled = v),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_buildSectionTitle('显示'),
|
||||
_buildSwitchTile(
|
||||
icon: LucideIcons.moon,
|
||||
title: '深色模式',
|
||||
subtitle: '始终使用深色主题',
|
||||
value: _darkMode,
|
||||
onChanged: (v) => setState(() => _darkMode = v),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_buildSectionTitle('体验'),
|
||||
_buildSwitchTile(
|
||||
icon: LucideIcons.smartphone,
|
||||
title: '触觉反馈',
|
||||
subtitle: '操作时产生震动反馈',
|
||||
value: _hapticFeedback,
|
||||
onChanged: (v) => setState(() => _hapticFeedback = v),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_buildSectionTitle('存储'),
|
||||
_buildActionTile(
|
||||
icon: LucideIcons.trash2,
|
||||
title: '清除缓存',
|
||||
subtitle: '已使用 128 MB',
|
||||
onTap: () {},
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_buildSectionTitle('关于'),
|
||||
_buildInfoTile(
|
||||
icon: LucideIcons.info,
|
||||
title: '版本',
|
||||
value: 'v2.5.0',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHeader() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 8, 16, 16),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
icon: Icon(LucideIcons.chevronLeft, color: Colors.white.withOpacity(0.7)),
|
||||
),
|
||||
const Text(
|
||||
'系统设置',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSectionTitle(String title) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 4, bottom: 12),
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
letterSpacing: 2,
|
||||
color: Colors.white.withOpacity(0.4),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSwitchTile({
|
||||
required IconData icon,
|
||||
required String title,
|
||||
required String subtitle,
|
||||
required bool value,
|
||||
required ValueChanged<bool> onChanged,
|
||||
}) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: Colors.white.withOpacity(0.1)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Icon(icon, size: 20, color: Colors.white.withOpacity(0.7)),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(title, style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w500, color: Colors.white)),
|
||||
const SizedBox(height: 2),
|
||||
Text(subtitle, style: TextStyle(fontSize: 12, color: Colors.white.withOpacity(0.5))),
|
||||
],
|
||||
),
|
||||
),
|
||||
Switch(
|
||||
value: value,
|
||||
onChanged: onChanged,
|
||||
activeColor: const Color(0xFFC084FC),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildActionTile({
|
||||
required IconData icon,
|
||||
required String title,
|
||||
required String subtitle,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: Colors.white.withOpacity(0.1)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Icon(icon, size: 20, color: Colors.white.withOpacity(0.7)),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(title, style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w500, color: Colors.white)),
|
||||
const SizedBox(height: 2),
|
||||
Text(subtitle, style: TextStyle(fontSize: 12, color: Colors.white.withOpacity(0.5))),
|
||||
],
|
||||
),
|
||||
),
|
||||
Icon(LucideIcons.chevronRight, size: 18, color: Colors.white.withOpacity(0.3)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInfoTile({
|
||||
required IconData icon,
|
||||
required String title,
|
||||
required String value,
|
||||
}) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: Colors.white.withOpacity(0.1)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Icon(icon, size: 20, color: Colors.white.withOpacity(0.7)),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(child: Text(title, style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w500, color: Colors.white))),
|
||||
Text(value, style: TextStyle(fontSize: 14, fontFamily: 'monospace', color: Colors.white.withOpacity(0.5))),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
120
wei_ai_app/lib/screens/profile/subscription_screen.dart
Normal file
120
wei_ai_app/lib/screens/profile/subscription_screen.dart
Normal file
@@ -0,0 +1,120 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lucide_icons/lucide_icons.dart';
|
||||
|
||||
class SubscriptionScreen extends StatelessWidget {
|
||||
const SubscriptionScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF2E1065),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
_buildHeader(context),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildCurrentPlan(),
|
||||
const SizedBox(height: 24),
|
||||
_buildSectionTitle('升级方案'),
|
||||
const SizedBox(height: 12),
|
||||
_buildPlanCard(name: '月度会员', price: '¥29/月', features: ['无限互动时长', '优先匹配', '专属剧本'], isRecommended: false),
|
||||
const SizedBox(height: 12),
|
||||
_buildPlanCard(name: '年度会员', price: '¥199/年', features: ['月度会员全部权益', '额外赠送500积分', '新功能优先体验'], isRecommended: true),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHeader(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 8, 16, 16),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(onPressed: () => Navigator.of(context).pop(), icon: Icon(LucideIcons.chevronLeft, color: Colors.white.withOpacity(0.7))),
|
||||
const Text('订阅管理', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCurrentPlan() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(colors: [Color(0xFF7C3AED), Color(0xFF9333EA)]),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(LucideIcons.crown, size: 20, color: const Color(0xFFFBBF24)),
|
||||
const SizedBox(width: 8),
|
||||
const Text('当前订阅', style: TextStyle(fontSize: 12, fontWeight: FontWeight.bold, letterSpacing: 1, color: Colors.white70)),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Text('黑金会员 LV.4', style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold, color: Colors.white)),
|
||||
const SizedBox(height: 8),
|
||||
Text('有效期至 2025-12-31', style: TextStyle(fontSize: 12, color: Colors.white.withOpacity(0.7))),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSectionTitle(String title) {
|
||||
return Text(title, style: TextStyle(fontSize: 12, fontWeight: FontWeight.bold, letterSpacing: 2, color: Colors.white.withOpacity(0.4)));
|
||||
}
|
||||
|
||||
Widget _buildPlanCard({required String name, required String price, required List<String> features, required bool isRecommended}) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(color: isRecommended ? const Color(0xFFC084FC) : Colors.white.withOpacity(0.1), width: isRecommended ? 2 : 1),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(name, style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white)),
|
||||
if (isRecommended)
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(color: const Color(0xFFC084FC), borderRadius: BorderRadius.circular(8)),
|
||||
child: const Text('推荐', style: TextStyle(fontSize: 10, fontWeight: FontWeight.bold, color: Colors.white)),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(price, style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold, fontFamily: 'monospace', color: Color(0xFFC084FC))),
|
||||
const SizedBox(height: 12),
|
||||
...features.map((f) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 6),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(LucideIcons.check, size: 14, color: const Color(0xFF34D399)),
|
||||
const SizedBox(width: 8),
|
||||
Text(f, style: TextStyle(fontSize: 13, color: Colors.white.withOpacity(0.7))),
|
||||
],
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
150
wei_ai_app/lib/screens/profile/topup_screen.dart
Normal file
150
wei_ai_app/lib/screens/profile/topup_screen.dart
Normal file
@@ -0,0 +1,150 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lucide_icons/lucide_icons.dart';
|
||||
|
||||
class TopupScreen extends StatefulWidget {
|
||||
const TopupScreen({super.key});
|
||||
|
||||
@override
|
||||
State<TopupScreen> createState() => _TopupScreenState();
|
||||
}
|
||||
|
||||
class _TopupScreenState extends State<TopupScreen> {
|
||||
int _selectedPackage = 1;
|
||||
|
||||
final List<Map<String, dynamic>> _packages = [
|
||||
{'points': 100, 'price': 6, 'bonus': 0},
|
||||
{'points': 500, 'price': 28, 'bonus': 50},
|
||||
{'points': 1000, 'price': 50, 'bonus': 150},
|
||||
{'points': 3000, 'price': 128, 'bonus': 600},
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF2E1065),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
_buildHeader(),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildBalanceCard(),
|
||||
const SizedBox(height: 24),
|
||||
_buildSectionTitle('选择套餐'),
|
||||
const SizedBox(height: 12),
|
||||
..._packages.asMap().entries.map((e) => _buildPackageCard(e.key, e.value)),
|
||||
const SizedBox(height: 24),
|
||||
_buildPayButton(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHeader() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 8, 16, 16),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
icon: Icon(LucideIcons.chevronLeft, color: Colors.white.withOpacity(0.7)),
|
||||
),
|
||||
const Text('立即充值', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBalanceCard() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(colors: [Color(0xFF7C3AED), Color(0xFF9333EA), Color(0xFFDB2777)]),
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(LucideIcons.zap, size: 32, color: Colors.white.withOpacity(0.9)),
|
||||
const SizedBox(width: 16),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('当前余额', style: TextStyle(fontSize: 12, color: Colors.white.withOpacity(0.8))),
|
||||
const SizedBox(height: 4),
|
||||
const Text('2,450', style: TextStyle(fontSize: 32, fontWeight: FontWeight.bold, fontFamily: 'monospace', color: Colors.white)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSectionTitle(String title) {
|
||||
return Text(
|
||||
title,
|
||||
style: TextStyle(fontSize: 12, fontWeight: FontWeight.bold, letterSpacing: 2, color: Colors.white.withOpacity(0.4)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPackageCard(int index, Map<String, dynamic> pkg) {
|
||||
final isSelected = _selectedPackage == index;
|
||||
return GestureDetector(
|
||||
onTap: () => setState(() => _selectedPackage = index),
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? Colors.white : Colors.white.withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: isSelected ? Colors.white : Colors.white.withOpacity(0.1), width: isSelected ? 2 : 1),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(LucideIcons.zap, size: 20, color: isSelected ? const Color(0xFF9333EA) : const Color(0xFFC084FC)),
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'${pkg['points']} 积分',
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: isSelected ? const Color(0xFF2E1065) : Colors.white),
|
||||
),
|
||||
if (pkg['bonus'] > 0)
|
||||
Text('+${pkg['bonus']} 赠送', style: TextStyle(fontSize: 12, color: isSelected ? const Color(0xFF9333EA) : const Color(0xFFC084FC))),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Text('¥${pkg['price']}', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, fontFamily: 'monospace', color: isSelected ? const Color(0xFF2E1065) : Colors.white)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPayButton() {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(vertical: 18),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(colors: [Color(0xFFC084FC), Color(0xFFF472B6)]),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: const Center(
|
||||
child: Text('确认支付', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Colors.white)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user