重构
This commit is contained in:
@@ -25,9 +25,7 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
|
||||
bool _vibrationEnabled = true;
|
||||
bool _darkModeEnabled = false;
|
||||
bool _preloadEnabled = true;
|
||||
bool _notificationEnabled = true;
|
||||
bool _globalTipsEnabled = true; // 添加全局Tips开关状态
|
||||
int _cacheSize = 128;
|
||||
|
||||
static const String _autoRefreshKey = 'auto_refresh_enabled';
|
||||
static const String _debugInfoKey = 'debug_info_enabled';
|
||||
@@ -311,28 +309,6 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCacheItem() {
|
||||
return ListTile(
|
||||
leading: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: AppConstants.primaryColor.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(Icons.storage, color: AppConstants.primaryColor, size: 20),
|
||||
),
|
||||
title: const Text(
|
||||
'缓存大小',
|
||||
style: TextStyle(fontSize: 15, fontWeight: FontWeight.w500),
|
||||
),
|
||||
subtitle: Text(
|
||||
'$_cacheSize MB',
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
|
||||
),
|
||||
trailing: Icon(Icons.chevron_right, color: Colors.grey[400]),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildActionItem(
|
||||
String title,
|
||||
String subtitle,
|
||||
@@ -403,32 +379,6 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
|
||||
).showSnackBar(SnackBar(content: Text(message)));
|
||||
}
|
||||
|
||||
void _showClearCacheDialog() {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('清除缓存'),
|
||||
content: const Text('确定要清除所有缓存数据吗?这不会影响您的笔记和收藏。'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('取消'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
setState(() {
|
||||
_cacheSize = 0;
|
||||
});
|
||||
_showSnackBar('缓存已清除');
|
||||
},
|
||||
child: Text('确定', style: TextStyle(color: Colors.red[400])),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showResetDialog() {
|
||||
showDialog(
|
||||
context: context,
|
||||
@@ -450,7 +400,6 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
|
||||
_vibrationEnabled = true;
|
||||
_globalTipsEnabled = true; // 重置全局Tips开关为开启
|
||||
_darkModeEnabled = false;
|
||||
_notificationEnabled = true;
|
||||
});
|
||||
_showSnackBar('已恢复默认设置');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user