import 'package:flutter/material.dart'; import 'package:lucide_icons/lucide_icons.dart'; class PrivacyScreen extends StatefulWidget { const PrivacyScreen({super.key}); @override State createState() => _PrivacyScreenState(); } class _PrivacyScreenState extends State { 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 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)), ], ), ); } }