关怀模式

This commit is contained in:
Developer
2026-04-02 22:30:49 +08:00
parent 09fee0694c
commit 7872f2e78a
70 changed files with 4884 additions and 2752 deletions

View File

@@ -38,7 +38,7 @@ class _SpGuidePageState extends State<SpGuidePage>
final int _totalPages = 3;
final List<String> _pageTitles = ['欢迎使用', '双击中心区域查看协议', '了解软件功能'];
final List<String> _pageTitles = ['欢迎使用', '双击中心区域可左右滑动查看', '了解软件功能'];
@override
void initState() {
@@ -191,7 +191,7 @@ class _SpGuidePageState extends State<SpGuidePage>
_nextPage();
},
style: ElevatedButton.styleFrom(
backgroundColor: AppConstants.primaryColor,
backgroundColor: _themeController.currentThemeColor,
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
@@ -221,6 +221,7 @@ class _SpGuidePageState extends State<SpGuidePage>
Widget build(BuildContext context) {
return Obx(() {
final isDark = _themeController.isDarkMode;
final primaryColor = _themeController.currentThemeColor;
return WillPopScope(
onWillPop: () async {
if (widget.fromSettings) {
@@ -230,7 +231,7 @@ class _SpGuidePageState extends State<SpGuidePage>
},
child: Scaffold(
backgroundColor: isDark ? const Color(0xFF1A1A1A) : Colors.white,
appBar: _buildAppBar(isDark),
appBar: _buildAppBar(isDark, primaryColor),
body: Stack(
children: [
PageView(
@@ -243,13 +244,13 @@ class _SpGuidePageState extends State<SpGuidePage>
});
},
children: [
_buildWelcomePage(isDark),
_buildPrivacyPage(isDark),
_buildFeaturePage(isDark),
_buildWelcomePage(isDark, primaryColor),
_buildPrivacyPage(isDark, primaryColor),
_buildFeaturePage(isDark, primaryColor),
],
),
_buildPageIndicator(isDark),
_buildBottomNavigation(isDark),
_buildPageIndicator(isDark, primaryColor),
_buildBottomNavigation(isDark, primaryColor),
],
),
),
@@ -257,7 +258,7 @@ class _SpGuidePageState extends State<SpGuidePage>
});
}
Widget _buildPageIndicator(bool isDark) {
Widget _buildPageIndicator(bool isDark, Color primaryColor) {
double alignmentY;
switch (_currentPage) {
case 0:
@@ -318,19 +319,17 @@ class _SpGuidePageState extends State<SpGuidePage>
decoration: BoxDecoration(
shape: BoxShape.circle,
color: isActive
? AppConstants.primaryColor
? primaryColor
: isCompleted
? AppConstants.primaryColor.withValues(alpha: 0.5)
? primaryColor.withAlpha(50)
: (isDark ? Colors.grey[600] : Colors.grey[300]),
border: isActive
? Border.all(color: AppConstants.primaryColor, width: 3)
? Border.all(color: primaryColor, width: 3)
: null,
boxShadow: isActive
? [
BoxShadow(
color: AppConstants.primaryColor.withValues(
alpha: 0.3,
),
color: primaryColor.withAlpha(30),
blurRadius: 8,
spreadRadius: 2,
),
@@ -346,21 +345,18 @@ class _SpGuidePageState extends State<SpGuidePage>
);
}
PreferredSizeWidget _buildAppBar(bool isDark) {
PreferredSizeWidget _buildAppBar(bool isDark, Color primaryColor) {
return AppBar(
title: Text(
_pageTitles[_currentPage],
style: TextStyle(
color: AppConstants.primaryColor,
fontWeight: FontWeight.bold,
),
style: TextStyle(color: primaryColor, fontWeight: FontWeight.bold),
),
backgroundColor: isDark ? const Color(0xFF2A2A2A) : Colors.white,
elevation: 0,
centerTitle: true,
leading: widget.fromSettings
? IconButton(
icon: Icon(Icons.arrow_back, color: AppConstants.primaryColor),
icon: Icon(Icons.arrow_back, color: primaryColor),
onPressed: () => Navigator.pop(context),
)
: null,
@@ -368,7 +364,7 @@ class _SpGuidePageState extends State<SpGuidePage>
);
}
Widget _buildWelcomePage(bool isDark) {
Widget _buildWelcomePage(bool isDark, Color primaryColor) {
return Container(
padding: const EdgeInsets.all(32),
child: Column(
@@ -379,10 +375,7 @@ class _SpGuidePageState extends State<SpGuidePage>
height: 120,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppConstants.primaryColor.withValues(alpha: 0.1),
AppConstants.primaryColor.withValues(alpha: 0.05),
],
colors: [primaryColor.withAlpha(10), primaryColor.withAlpha(5)],
),
borderRadius: BorderRadius.circular(30),
),
@@ -405,7 +398,7 @@ class _SpGuidePageState extends State<SpGuidePage>
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.w600,
color: AppConstants.primaryColor,
color: primaryColor,
),
),
const SizedBox(height: 32),
@@ -455,17 +448,10 @@ class _SpGuidePageState extends State<SpGuidePage>
),
);
},
icon: Icon(
Icons.security,
size: 18,
color: AppConstants.primaryColor,
),
icon: Icon(Icons.security, size: 18, color: primaryColor),
label: Text(
'了解软件权限',
style: TextStyle(
color: AppConstants.primaryColor,
fontSize: 14,
),
style: TextStyle(color: primaryColor, fontSize: 14),
),
style: TextButton.styleFrom(
padding: const EdgeInsets.symmetric(
@@ -474,9 +460,7 @@ class _SpGuidePageState extends State<SpGuidePage>
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
side: BorderSide(
color: AppConstants.primaryColor.withValues(alpha: 0.3),
),
side: BorderSide(color: primaryColor.withAlpha(30)),
),
),
),
@@ -536,7 +520,7 @@ class _SpGuidePageState extends State<SpGuidePage>
? Icons.check_circle
: Icons.info_outline,
color: _showGuideOnStartup
? AppConstants.primaryColor
? _themeController.currentThemeColor
: (isDark ? Colors.grey[400] : Colors.grey[600]),
size: 24,
),
@@ -556,7 +540,7 @@ class _SpGuidePageState extends State<SpGuidePage>
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: _showGuideOnStartup
? AppConstants.primaryColor.withValues(alpha: 0.1)
? _themeController.currentThemeColor.withAlpha(10)
: (isDark ? const Color(0xFF2A2A2A) : Colors.grey[50]),
borderRadius: BorderRadius.circular(12),
),
@@ -567,7 +551,7 @@ class _SpGuidePageState extends State<SpGuidePage>
? Icons.notifications_active
: Icons.notifications_off,
color: _showGuideOnStartup
? AppConstants.primaryColor
? _themeController.currentThemeColor
: (isDark ? Colors.grey[400] : Colors.grey[500]),
size: 40,
),
@@ -578,7 +562,7 @@ class _SpGuidePageState extends State<SpGuidePage>
fontSize: 16,
fontWeight: FontWeight.w600,
color: _showGuideOnStartup
? AppConstants.primaryColor
? _themeController.currentThemeColor
: (isDark ? Colors.white : Colors.grey[700]),
),
),
@@ -600,7 +584,7 @@ class _SpGuidePageState extends State<SpGuidePage>
child: ElevatedButton(
onPressed: () => Navigator.pop(context),
style: ElevatedButton.styleFrom(
backgroundColor: AppConstants.primaryColor,
backgroundColor: _themeController.currentThemeColor,
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 12),
shape: RoundedRectangleBorder(
@@ -617,7 +601,7 @@ class _SpGuidePageState extends State<SpGuidePage>
);
}
Widget _buildPrivacyPage(bool isDark) {
Widget _buildPrivacyPage(bool isDark, Color primaryColor) {
_initTabController();
return Stack(
children: [
@@ -627,11 +611,11 @@ class _SpGuidePageState extends State<SpGuidePage>
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
child: TabBar(
controller: _tabController!,
labelColor: AppConstants.primaryColor,
labelColor: primaryColor,
unselectedLabelColor: isDark
? Colors.grey[400]
: Colors.grey[600],
indicatorColor: AppConstants.primaryColor,
indicatorColor: primaryColor,
indicatorWeight: 2,
tabs: const [
Tab(text: '《隐私政策》'),
@@ -713,20 +697,14 @@ class _SpGuidePageState extends State<SpGuidePage>
left: 0,
top: 0,
bottom: 0,
child: Container(
width: 3,
color: AppConstants.primaryColor,
),
child: Container(width: 3, color: primaryColor),
),
if (_isAgreementFocused)
Positioned(
right: 0,
top: 0,
bottom: 0,
child: Container(
width: 3,
color: AppConstants.primaryColor,
),
child: Container(width: 3, color: primaryColor),
),
],
),
@@ -779,7 +757,7 @@ class _SpGuidePageState extends State<SpGuidePage>
_rejectAgreement();
}
},
activeColor: AppConstants.primaryColor,
activeColor: primaryColor,
),
Expanded(
child: GestureDetector(
@@ -795,7 +773,7 @@ class _SpGuidePageState extends State<SpGuidePage>
style: TextStyle(
fontSize: 14,
color: _agreementAccepted
? AppConstants.primaryColor
? primaryColor
: (isDark
? Colors.grey[300]
: Colors.grey[700]),
@@ -814,7 +792,7 @@ class _SpGuidePageState extends State<SpGuidePage>
: _rejectAndExit,
style: ElevatedButton.styleFrom(
backgroundColor: _agreementAccepted
? AppConstants.primaryColor
? primaryColor
: (isDark ? Colors.grey[700] : Colors.grey[600]),
foregroundColor: Colors.white,
disabledBackgroundColor: isDark
@@ -843,7 +821,7 @@ class _SpGuidePageState extends State<SpGuidePage>
);
}
Widget _buildFeaturePage(bool isDark) {
Widget _buildFeaturePage(bool isDark, Color primaryColor) {
return Padding(
padding: const EdgeInsets.fromLTRB(24, 16, 24, 100),
child: Column(
@@ -920,11 +898,7 @@ class _SpGuidePageState extends State<SpGuidePage>
),
child: Row(
children: [
Icon(
Icons.volunteer_activism,
color: AppConstants.primaryColor,
size: 18,
),
Icon(Icons.volunteer_activism, color: primaryColor, size: 18),
const SizedBox(width: 8),
Expanded(
child: GestureDetector(
@@ -963,7 +937,7 @@ class _SpGuidePageState extends State<SpGuidePage>
Switch(
value: _userPlanJoined,
onChanged: _toggleUserPlan,
activeThumbColor: AppConstants.primaryColor,
activeThumbColor: primaryColor,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
],
@@ -1044,7 +1018,7 @@ class _SpGuidePageState extends State<SpGuidePage>
child: ElevatedButton(
onPressed: _finishGuide,
style: ElevatedButton.styleFrom(
backgroundColor: AppConstants.primaryColor,
backgroundColor: primaryColor,
foregroundColor: Colors.white,
padding: EdgeInsets.zero,
shape: RoundedRectangleBorder(
@@ -1127,7 +1101,7 @@ class _SpGuidePageState extends State<SpGuidePage>
);
}
Widget _buildBottomNavigation(bool isDark) {
Widget _buildBottomNavigation(bool isDark, Color primaryColor) {
return Positioned(
bottom: 0,
left: 0,
@@ -1143,6 +1117,7 @@ class _SpGuidePageState extends State<SpGuidePage>
label: '上一页',
onPressed: _previousPage,
isDark: isDark,
primaryColor: primaryColor,
)
: const SizedBox(width: 100),
_currentPage < _totalPages - 1
@@ -1153,12 +1128,14 @@ class _SpGuidePageState extends State<SpGuidePage>
? null
: _nextPage,
isDark: isDark,
primaryColor: primaryColor,
)
: _buildNavButton(
icon: Icons.check,
label: '完成',
onPressed: _agreementAccepted ? _finishGuide : null,
isDark: isDark,
primaryColor: primaryColor,
),
],
),
@@ -1171,17 +1148,18 @@ class _SpGuidePageState extends State<SpGuidePage>
required String label,
VoidCallback? onPressed,
required bool isDark,
required Color primaryColor,
}) {
return Container(
decoration: BoxDecoration(
color: onPressed != null
? AppConstants.primaryColor
? primaryColor
: (isDark ? Colors.grey[700] : Colors.grey[300]),
borderRadius: BorderRadius.circular(12),
boxShadow: onPressed != null
? [
BoxShadow(
color: AppConstants.primaryColor.withValues(alpha: 0.3),
color: primaryColor.withAlpha(30),
blurRadius: 8,
offset: const Offset(0, 2),
),