Merge branch 'fix'
This commit is contained in:
@ -60,6 +60,7 @@ void main() async {
|
|||||||
systemNavigationBarColor: Colors.transparent,
|
systemNavigationBarColor: Colors.transparent,
|
||||||
systemNavigationBarDividerColor: Colors.transparent,
|
systemNavigationBarDividerColor: Colors.transparent,
|
||||||
statusBarColor: Colors.transparent,
|
statusBarColor: Colors.transparent,
|
||||||
|
systemNavigationBarContrastEnforced: false,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import 'package:pilipala/utils/storage.dart';
|
|||||||
import '../../http/index.dart';
|
import '../../http/index.dart';
|
||||||
|
|
||||||
class HomeController extends GetxController with GetTickerProviderStateMixin {
|
class HomeController extends GetxController with GetTickerProviderStateMixin {
|
||||||
bool flag = false;
|
bool flag = true;
|
||||||
late RxList tabs = [].obs;
|
late RxList tabs = [].obs;
|
||||||
RxInt initialIndex = 1.obs;
|
RxInt initialIndex = 1.obs;
|
||||||
late TabController tabController;
|
late TabController tabController;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/models/common/dynamic_badge_mode.dart';
|
import 'package:pilipala/models/common/dynamic_badge_mode.dart';
|
||||||
@ -127,6 +128,14 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
|||||||
MediaQuery.sizeOf(context).width * 9 / 16;
|
MediaQuery.sizeOf(context).width * 9 / 16;
|
||||||
localCache.put('sheetHeight', sheetHeight);
|
localCache.put('sheetHeight', sheetHeight);
|
||||||
localCache.put('statusBarHeight', statusBarHeight);
|
localCache.put('statusBarHeight', statusBarHeight);
|
||||||
|
|
||||||
|
SystemChrome.setSystemUIOverlayStyle(
|
||||||
|
SystemUiOverlayStyle(
|
||||||
|
systemNavigationBarColor: Colors.transparent,
|
||||||
|
systemNavigationBarIconBrightness:
|
||||||
|
Get.isDarkMode ? Brightness.light : Brightness.dark,
|
||||||
|
),
|
||||||
|
);
|
||||||
return PopScope(
|
return PopScope(
|
||||||
canPop: false,
|
canPop: false,
|
||||||
onPopInvoked: (bool didPop) async {
|
onPopInvoked: (bool didPop) async {
|
||||||
|
@ -675,7 +675,6 @@ class VideoDetailController extends GetxController
|
|||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
super.onClose();
|
super.onClose();
|
||||||
plPlayerController.dispose();
|
|
||||||
tabCtr.removeListener(() {
|
tabCtr.removeListener(() {
|
||||||
onTabChanged();
|
onTabChanged();
|
||||||
});
|
});
|
||||||
|
@ -511,6 +511,14 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
exitFullScreen();
|
exitFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SystemChrome.setSystemUIOverlayStyle(
|
||||||
|
SystemUiOverlayStyle(
|
||||||
|
systemNavigationBarColor: Colors.transparent,
|
||||||
|
systemNavigationBarIconBrightness:
|
||||||
|
Get.isDarkMode ? Brightness.light : Brightness.dark,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
Widget buildLoadingWidget() {
|
Widget buildLoadingWidget() {
|
||||||
return Center(child: Lottie.asset('assets/loading.json', width: 200));
|
return Center(child: Lottie.asset('assets/loading.json', width: 200));
|
||||||
}
|
}
|
||||||
@ -605,11 +613,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
scrolledUnderElevation: 0,
|
scrolledUnderElevation: 0,
|
||||||
systemOverlayStyle: Get.isDarkMode
|
|
||||||
? SystemUiOverlayStyle.light
|
|
||||||
: snapshot.data!.toDouble() > kToolbarHeight
|
|
||||||
? SystemUiOverlayStyle.dark
|
|
||||||
: SystemUiOverlayStyle.light,
|
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
@ -1045,6 +1045,14 @@ class PlPlayerController {
|
|||||||
|
|
||||||
/// 缓存本次弹幕选项
|
/// 缓存本次弹幕选项
|
||||||
cacheDanmakuOption() {
|
cacheDanmakuOption() {
|
||||||
|
final cache = GlobalDataCache();
|
||||||
|
cache.blockTypes = blockTypes;
|
||||||
|
cache.showArea = showArea;
|
||||||
|
cache.opacityVal = opacityVal;
|
||||||
|
cache.fontSizeVal = fontSizeVal;
|
||||||
|
cache.danmakuDurationVal = danmakuDurationVal;
|
||||||
|
cache.strokeWidth = strokeWidth;
|
||||||
|
|
||||||
localCache.put(LocalCacheKey.danmakuBlockType, blockTypes);
|
localCache.put(LocalCacheKey.danmakuBlockType, blockTypes);
|
||||||
localCache.put(LocalCacheKey.danmakuShowArea, showArea);
|
localCache.put(LocalCacheKey.danmakuShowArea, showArea);
|
||||||
localCache.put(LocalCacheKey.danmakuOpacity, opacityVal);
|
localCache.put(LocalCacheKey.danmakuOpacity, opacityVal);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
|
|
||||||
@ -50,14 +51,18 @@ class CacheManage {
|
|||||||
Future<double> getTotalSizeOfFilesInDir(final FileSystemEntity file) async {
|
Future<double> getTotalSizeOfFilesInDir(final FileSystemEntity file) async {
|
||||||
if (file is File) {
|
if (file is File) {
|
||||||
int length = await file.length();
|
int length = await file.length();
|
||||||
return double.parse(length.toString());
|
return length.toDouble();
|
||||||
}
|
}
|
||||||
if (file is Directory) {
|
if (file is Directory) {
|
||||||
final List<FileSystemEntity> children = file.listSync();
|
|
||||||
double total = 0;
|
double total = 0;
|
||||||
for (final FileSystemEntity child in children) {
|
try {
|
||||||
|
await for (final FileSystemEntity child in file.list()) {
|
||||||
total += await getTotalSizeOfFilesInDir(child);
|
total += await getTotalSizeOfFilesInDir(child);
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// 处理错误,例如记录日志或显示错误消息
|
||||||
|
print('读取目录时出错: $e');
|
||||||
|
}
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -77,16 +82,17 @@ class CacheManage {
|
|||||||
|
|
||||||
// 清除缓存
|
// 清除缓存
|
||||||
Future<bool> clearCacheAll() async {
|
Future<bool> clearCacheAll() async {
|
||||||
bool cleanStatus = await SmartDialog.show(
|
bool? cleanStatus = await showDialog<bool>(
|
||||||
useSystem: true,
|
context: Get.context!,
|
||||||
animationType: SmartAnimationType.centerFade_otherSlide,
|
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('提示'),
|
title: const Text('提示'),
|
||||||
content: const Text('该操作将清除图片及网络请求缓存数据,确认清除?'),
|
content: const Text('该操作将清除图片及网络请求缓存数据,确认清除?'),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: (() => {SmartDialog.dismiss()}),
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop(false);
|
||||||
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'取消',
|
'取消',
|
||||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||||
@ -94,7 +100,15 @@ class CacheManage {
|
|||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
SmartDialog.dismiss();
|
Navigator.of(context).pop(true);
|
||||||
|
},
|
||||||
|
child: const Text('确认'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (cleanStatus != null && cleanStatus) {
|
||||||
SmartDialog.showLoading(msg: '正在清除...');
|
SmartDialog.showLoading(msg: '正在清除...');
|
||||||
try {
|
try {
|
||||||
// 清除缓存 图片缓存
|
// 清除缓存 图片缓存
|
||||||
@ -106,29 +120,26 @@ class CacheManage {
|
|||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
SmartDialog.showToast(err.toString());
|
SmartDialog.showToast(err.toString());
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
child: const Text('确认'),
|
return cleanStatus!;
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
).then((res) {
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
return cleanStatus;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 清除 Documents 目录下的 DioCache.db
|
/// 清除 Documents 目录下的 DioCache.db
|
||||||
Future clearApplicationCache() async {
|
Future<void> clearApplicationCache() async {
|
||||||
|
try {
|
||||||
Directory directory = await getApplicationDocumentsDirectory();
|
Directory directory = await getApplicationDocumentsDirectory();
|
||||||
if (directory.existsSync()) {
|
if (directory.existsSync()) {
|
||||||
String dioCacheFileName =
|
String dioCacheFileName =
|
||||||
'${directory.path}${Platform.pathSeparator}DioCache.db';
|
'${directory.path}${Platform.pathSeparator}DioCache.db';
|
||||||
var dioCacheFile = File(dioCacheFileName);
|
File dioCacheFile = File(dioCacheFileName);
|
||||||
if (dioCacheFile.existsSync()) {
|
if (await dioCacheFile.exists()) {
|
||||||
dioCacheFile.delete();
|
await dioCacheFile.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// 处理错误,例如记录日志或显示错误消息
|
||||||
|
print('清除缓存时出错: $e');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清除 Library/Caches 目录及文件缓存
|
// 清除 Library/Caches 目录及文件缓存
|
||||||
|
Reference in New Issue
Block a user