icon优化

This commit is contained in:
Developer
2026-04-02 17:31:53 +08:00
parent 954d173329
commit 09fee0694c
34 changed files with 754 additions and 194 deletions

View File

@@ -1,9 +1,11 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:path_provider/path_provider.dart';
import '../../../constants/app_constants.dart';
import '../../../services/get/theme_controller.dart';
/// 时间: 2026-03-27
/// 功能: 应用数据管理页面
@@ -28,6 +30,8 @@ class _AppDataPageState extends State<AppDataPage> {
int _cacheBytes = 0;
int _dataBytes = 0;
final ThemeController _themeController = Get.find<ThemeController>();
@override
void initState() {
super.initState();
@@ -492,41 +496,41 @@ class _AppDataPageState extends State<AppDataPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFFF5F5F5),
appBar: AppBar(
title: Text(
'应用数据',
style: TextStyle(
color: AppConstants.primaryColor,
fontWeight: FontWeight.bold,
return Obx(() {
final isDark = _themeController.isDarkMode;
return Scaffold(
backgroundColor: isDark
? const Color(0xFF1A1A1A)
: const Color(0xFFF5F5F5),
appBar: AppBar(
title: const Text(
'应用数据',
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
),
backgroundColor: isDark
? const Color(0xFF2A2A2A)
: AppConstants.primaryColor,
iconTheme: IconThemeData(color: Colors.white),
),
backgroundColor: Colors.white,
elevation: 0,
centerTitle: true,
leading: IconButton(
icon: Icon(Icons.arrow_back, color: AppConstants.primaryColor),
onPressed: () => Navigator.of(context).pop(),
),
),
body: _isLoading
? const Center(child: CircularProgressIndicator())
: ListView(
padding: const EdgeInsets.all(16),
children: [
_buildDataOverviewCard(),
const SizedBox(height: 16),
_buildDataManagementCard(),
const SizedBox(height: 16),
_buildDataBackupCard(),
const SizedBox(height: 16),
_buildDangerZoneCard(),
const SizedBox(height: 24),
_buildBottomInfo(),
],
),
);
body: _isLoading
? const Center(child: CircularProgressIndicator())
: ListView(
padding: const EdgeInsets.all(16),
children: [
_buildDataOverviewCard(),
const SizedBox(height: 16),
_buildDataManagementCard(),
const SizedBox(height: 16),
_buildDataBackupCard(),
const SizedBox(height: 16),
_buildDangerZoneCard(),
const SizedBox(height: 24),
_buildBottomInfo(),
],
),
);
});
}
Widget _buildDataOverviewCard() {
@@ -578,35 +582,55 @@ class _AppDataPageState extends State<AppDataPage> {
}
Widget _buildDataItem(String label, String value) {
final isDark = _themeController.isDarkMode;
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(label, style: const TextStyle(fontSize: 14)),
Text(value, style: TextStyle(fontSize: 14, color: Colors.grey[600])),
Text(
label,
style: TextStyle(
fontSize: 14,
color: isDark ? Colors.white70 : Colors.black87,
),
),
Text(
value,
style: TextStyle(
fontSize: 14,
color: isDark ? Colors.grey[400] : Colors.grey[600],
),
),
],
),
);
}
Widget _buildDivider() {
final isDark = _themeController.isDarkMode;
return Divider(
height: 1,
indent: 16,
endIndent: 16,
color: Colors.grey[200],
color: isDark ? Colors.grey[700] : Colors.grey[200],
);
}
Widget _buildDataManagementCard() {
final isDark = _themeController.isDarkMode;
return Container(
decoration: BoxDecoration(
color: Colors.white,
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.05),
color: isDark
? Colors.black.withValues(alpha: 0.2)
: Colors.black.withValues(alpha: 0.05),
blurRadius: 10,
offset: const Offset(0, 2),
),
@@ -662,13 +686,17 @@ class _AppDataPageState extends State<AppDataPage> {
}
Widget _buildDataBackupCard() {
final isDark = _themeController.isDarkMode;
return Container(
decoration: BoxDecoration(
color: Colors.white,
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.05),
color: isDark
? Colors.black.withValues(alpha: 0.2)
: Colors.black.withValues(alpha: 0.05),
blurRadius: 10,
offset: const Offset(0, 2),
),
@@ -724,13 +752,17 @@ class _AppDataPageState extends State<AppDataPage> {
}
Widget _buildDangerZoneCard() {
final isDark = _themeController.isDarkMode;
return Container(
decoration: BoxDecoration(
color: Colors.white,
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.05),
color: isDark
? Colors.black.withValues(alpha: 0.2)
: Colors.black.withValues(alpha: 0.05),
blurRadius: 10,
offset: const Offset(0, 2),
),
@@ -788,6 +820,8 @@ class _AppDataPageState extends State<AppDataPage> {
Color color,
VoidCallback onTap,
) {
final isDark = _themeController.isDarkMode;
return InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(8),
@@ -811,20 +845,28 @@ class _AppDataPageState extends State<AppDataPage> {
children: [
Text(
title,
style: const TextStyle(
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w500,
color: isDark ? Colors.white : Colors.black87,
),
),
const SizedBox(height: 2),
Text(
subtitle,
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[400] : Colors.grey[600],
),
),
],
),
),
Icon(Icons.chevron_right, color: Colors.grey[400]),
Icon(
Icons.chevron_right,
color: isDark ? Colors.grey[500] : Colors.grey[400],
size: 20,
),
],
),
),
@@ -832,23 +874,32 @@ class _AppDataPageState extends State<AppDataPage> {
}
Widget _buildBottomInfo() {
final isDark = _themeController.isDarkMode;
return Center(
child: Column(
children: [
Icon(Icons.info_outline, color: Colors.grey[400], size: 32),
Icon(
Icons.info_outline,
color: isDark ? Colors.grey[500] : Colors.grey[400],
size: 32,
),
const SizedBox(height: 8),
Text(
'数据安全提示',
style: TextStyle(
fontSize: 14,
color: Colors.grey[600],
color: isDark ? Colors.grey[300] : Colors.grey[600],
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 4),
Text(
'清空数据前请先备份重要数据',
style: TextStyle(fontSize: 12, color: Colors.grey[500]),
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[400] : Colors.grey[500],
),
),
],
),