chore: clean up

opt: pages

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-19 18:05:02 +08:00
parent e5f3c3c922
commit a2ef4e6f84
99 changed files with 697 additions and 2097 deletions

View File

@@ -1,9 +1,6 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
class CacheManage {
CacheManage._internal();
@@ -76,45 +73,6 @@ class CacheManage {
return size + unitArr[index];
}
// 清除缓存
Future<void> clearCacheAll(BuildContext context) async {
await showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text('提示'),
content: const Text('该操作将清除图片及网络请求缓存数据,确认清除?'),
actions: [
TextButton(
onPressed: () => Get.back(),
child: Text(
'取消',
style: TextStyle(color: Theme.of(context).colorScheme.outline),
),
),
TextButton(
onPressed: () async {
SmartDialog.showLoading(msg: '正在清除...');
try {
// 清除缓存 图片缓存
await clearLibraryCache();
SmartDialog.dismiss().then((res) {
SmartDialog.showToast('清除成功');
});
} catch (err) {
SmartDialog.dismiss();
SmartDialog.showToast(err.toString());
}
Get.back();
},
child: const Text('确认'),
)
],
);
},
);
}
/// 清除 Documents 目录下的 DioCache.db
Future clearApplicationCache() async {
Directory directory = await getApplicationDocumentsDirectory();