logo和名称替换

This commit is contained in:
谢宇宁
2026-10-14 11:23:36 +07:00
parent 1cb514cd02
commit c5c04a7967
478 changed files with 8990 additions and 4948 deletions
+18 -10
View File
@@ -3,11 +3,12 @@
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart' show DefaultCacheManager;
import 'package:flutter_cache_manager/flutter_cache_manager.dart'
show DefaultCacheManager;
import 'package:path_provider/path_provider.dart';
import 'package:path/path.dart' as path;
import 'package:hgmj/tools_base/image/image_disk_cache.dart';
import 'package:hgmj/tools_base/video_download/video_download_manager.dart';
import 'package:wydj/tools_base/image/image_disk_cache.dart';
import 'package:wydj/tools_base/video_download/video_download_manager.dart';
import '../../hj_utils/file_util.dart';
import '../../hj_utils/video_cache_manager.dart';
@@ -16,11 +17,13 @@ import 'image_cache_manager.dart';
///加载缓存 统计缓存大小
Future<String> loadCache() async {
double total = 0;
Directory videoCacheDir = Directory(await VideoCacheManager().getFilePath() ?? '');
Directory videoCacheDir =
Directory(await VideoCacheManager().getFilePath() ?? '');
if (await videoCacheDir.exists()) {
total += await _getTotalSizeOfFilesInDir(videoCacheDir);
}
Directory videoLoadedDir = Directory(await VideoDownloadManager.instance.cacheDir());
Directory videoLoadedDir =
Directory(await VideoDownloadManager.instance.cacheDir());
if (await videoLoadedDir.exists()) {
total += await _getTotalSizeOfFilesInDir(videoLoadedDir);
}
@@ -61,7 +64,8 @@ Future<double> _getTotalSizeOfFilesInDir(final FileSystemEntity file) async {
double total = 0;
// recursive 已一次性列出所有后代文件,只累加 File 即可;不再对子目录二次递归,
// 避免同一文件被重复计入导致缓存大小翻倍。异步 list 替代 listSync,避免大目录阻塞 UI。
await for (final child in file.list(recursive: true, followLinks: false)) {
await for (final child
in file.list(recursive: true, followLinks: false)) {
if (child is File) {
total += (await child.length()).toDouble();
}
@@ -95,10 +99,12 @@ Future clearCacheIfNeed({bool force = false, bool isHandle = false}) async {
//await VideoDownloadManager.instance.emptyCache();
// await ImageDiskCache.emptyCache();
}
debugPrint(" ------------------ VideoCacheManager ImageCacheManager clear completely");
debugPrint(
" ------------------ VideoCacheManager ImageCacheManager clear completely");
} else {
double total = 0;
Directory videoCacheDir = Directory(await VideoCacheManager().getFilePath() ?? '');
Directory videoCacheDir =
Directory(await VideoCacheManager().getFilePath() ?? '');
if (await videoCacheDir.exists()) {
total += await _getTotalSizeOfFilesInDir(videoCacheDir);
}
@@ -107,7 +113,8 @@ Future clearCacheIfNeed({bool force = false, bool isHandle = false}) async {
await VideoCacheManager().emptyCache();
}
total = 0;
Directory imageCacheDir = Directory(await ImageCacheManager().getFilePath());
Directory imageCacheDir =
Directory(await ImageCacheManager().getFilePath());
if (await imageCacheDir.exists()) {
total += await _getTotalSizeOfFilesInDir(imageCacheDir);
}
@@ -124,7 +131,8 @@ clearAllCache(bool isHandle) async {
PaintingBinding.instance.imageCache.clear();
PaintingBinding.instance.imageCache.clearLiveImages();
debugPrint(" ----------- PaintingBinding.instance.imageCache.clearLiveImages()");
debugPrint(
" ----------- PaintingBinding.instance.imageCache.clearLiveImages()");
}
///递归方式删除目录