mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-20 09:20:13 +08:00
@@ -156,7 +156,7 @@ abstract class CommonRichTextPubPageState<T extends CommonRichTextPubPage>
|
||||
toolbarTitle: '裁剪',
|
||||
toolbarColor: colorScheme.secondaryContainer,
|
||||
toolbarWidgetColor: colorScheme.onSecondaryContainer,
|
||||
statusBarLight: colorScheme.brightness.isLight,
|
||||
statusBarLight: colorScheme.isLight,
|
||||
),
|
||||
IOSUiSettings(title: '裁剪'),
|
||||
],
|
||||
|
||||
@@ -125,7 +125,7 @@ class _CreateFavPageState extends State<CreateFavPage> {
|
||||
toolbarTitle: '裁剪',
|
||||
toolbarColor: theme.colorScheme.secondaryContainer,
|
||||
toolbarWidgetColor: theme.colorScheme.onSecondaryContainer,
|
||||
statusBarLight: theme.colorScheme.brightness.isLight,
|
||||
statusBarLight: theme.colorScheme.isLight,
|
||||
aspectRatioPresets: [CropAspectRatioPreset.ratio16x9],
|
||||
lockAspectRatio: true,
|
||||
hideBottomControls: true,
|
||||
|
||||
@@ -43,7 +43,9 @@ class _SuperChatCardState extends State<SuperChatCard> {
|
||||
}
|
||||
|
||||
void _remove() {
|
||||
Future.delayed(const Duration(seconds: 1), _onRemove);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
Future.delayed(const Duration(seconds: 1), _onRemove);
|
||||
});
|
||||
}
|
||||
|
||||
void _onRemove() {
|
||||
|
||||
@@ -830,14 +830,14 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
),
|
||||
Builder(
|
||||
builder: (context) {
|
||||
final theme = Theme.of(context).colorScheme;
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
return Material(
|
||||
type: MaterialType.transparency,
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
InkWell(
|
||||
overlayColor: overlayColor(theme),
|
||||
overlayColor: overlayColor(colorScheme),
|
||||
customBorder: const CircleBorder(),
|
||||
onTapDown: _liveRoomController.onLikeTapDown,
|
||||
onTapUp: _liveRoomController.onLikeTapUp,
|
||||
@@ -873,9 +873,9 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
'x$likeClickTime',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: theme.brightness.isDark
|
||||
? theme.primary
|
||||
: theme.inversePrimary,
|
||||
color: colorScheme.isDark
|
||||
? colorScheme.primary
|
||||
: colorScheme.inversePrimary,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -43,7 +43,7 @@ class UserInfoCard extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final isLight = colorScheme.brightness.isLight;
|
||||
final isLight = colorScheme.isLight;
|
||||
final isPortrait = context.width < 600;
|
||||
return ViewSafeArea(
|
||||
top: !isPortrait,
|
||||
|
||||
@@ -497,7 +497,7 @@ class _EditProfilePageState extends State<EditProfilePage> {
|
||||
toolbarTitle: '裁剪',
|
||||
toolbarColor: theme.colorScheme.secondaryContainer,
|
||||
toolbarWidgetColor: theme.colorScheme.onSecondaryContainer,
|
||||
statusBarLight: theme.colorScheme.brightness.isLight,
|
||||
statusBarLight: theme.colorScheme.isLight,
|
||||
aspectRatioPresets: [CropAspectRatioPresetCustom()],
|
||||
lockAspectRatio: true,
|
||||
hideBottomControls: true,
|
||||
|
||||
@@ -142,7 +142,9 @@ class _PopularSeriesPageState extends State<PopularSeriesPage> with GridMixin {
|
||||
return ListTile(
|
||||
dense: true,
|
||||
minTileHeight: 44,
|
||||
selected: isCurr,
|
||||
tileColor: isCurr
|
||||
? Theme.of(context).highlightColor
|
||||
: null,
|
||||
onTap: () {
|
||||
Get.back();
|
||||
if (!isCurr) {
|
||||
|
||||
@@ -31,6 +31,9 @@ class SelectDialog<T> extends StatelessWidget {
|
||||
return AlertDialog(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
title: Text(title),
|
||||
constraints: subtitleBuilder != null
|
||||
? const BoxConstraints(maxWidth: 320, minWidth: 320)
|
||||
: null,
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 12),
|
||||
content: SingleChildScrollView(
|
||||
child: RadioGroup<T>(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:math' show pi;
|
||||
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ActionItem extends StatelessWidget {
|
||||
@@ -35,16 +36,17 @@ class ActionItem extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final colorScheme = theme.colorScheme;
|
||||
late final primary = !expand && colorScheme.isLight
|
||||
? colorScheme.inversePrimary
|
||||
: colorScheme.primary;
|
||||
Widget child = Icon(
|
||||
selectStatus ? selectIcon!.icon! : icon.icon,
|
||||
size: 18,
|
||||
color: selectStatus
|
||||
? theme.colorScheme.primary
|
||||
: icon.color ?? theme.colorScheme.outline,
|
||||
color: selectStatus ? primary : icon.color ?? colorScheme.outline,
|
||||
);
|
||||
|
||||
if (animation != null) {
|
||||
final primary = theme.colorScheme.primary;
|
||||
child = Stack(
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.center,
|
||||
|
||||
@@ -68,7 +68,7 @@ class PlayerFocus extends StatelessWidget {
|
||||
plPlayerController
|
||||
..cancelLongPressTimer()
|
||||
..longPressTimer ??= Timer.periodic(
|
||||
const Duration(milliseconds: 200),
|
||||
const Duration(milliseconds: 150),
|
||||
(_) => _setVolume(isIncrease: isIncrease),
|
||||
);
|
||||
}
|
||||
@@ -137,8 +137,8 @@ class PlayerFocus extends StatelessWidget {
|
||||
final speed = isDigit1 ? 1.0 : 2.0;
|
||||
if (speed != plPlayerController.playbackSpeed) {
|
||||
plPlayerController.setPlaybackSpeed(speed);
|
||||
SmartDialog.showToast('${speed}x播放');
|
||||
}
|
||||
SmartDialog.showToast('${speed}x播放');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1499,7 +1499,7 @@ class PlPlayerController {
|
||||
await landscape(inAppFullScreen: inAppFullScreen);
|
||||
}
|
||||
} else if (isFullScreen.value && !status) {
|
||||
showStatusBar(inAppFullScreen: inAppFullScreen);
|
||||
showStatusBar();
|
||||
toggleFullScreen(false);
|
||||
if (mode == FullScreenMode.none) {
|
||||
fsProcessing = false;
|
||||
|
||||
@@ -9,18 +9,13 @@ import 'package:flutter/services.dart';
|
||||
|
||||
//横屏
|
||||
Future<void> landscape({bool inAppFullScreen = false}) async {
|
||||
dynamic document;
|
||||
try {
|
||||
if (kIsWeb) {
|
||||
await document.documentElement?.requestFullscreen();
|
||||
} else if (Utils.isMobile) {
|
||||
if (Utils.isMobile) {
|
||||
await AutoOrientation.landscapeAutoMode(forceSensor: true);
|
||||
} else if (Utils.isDesktop && !inAppFullScreen) {
|
||||
await const MethodChannel(
|
||||
'com.alexmercerind/media_kit_video',
|
||||
).invokeMethod(
|
||||
'Utils.EnterNativeFullscreen',
|
||||
);
|
||||
).invokeMethod('Utils.EnterNativeFullscreen');
|
||||
}
|
||||
} catch (exception, stacktrace) {
|
||||
if (kDebugMode) {
|
||||
@@ -76,30 +71,27 @@ Future<void> hideStatusBar() async {
|
||||
bool _showStatusBar = true;
|
||||
|
||||
//退出全屏显示
|
||||
Future<void> showStatusBar({bool inAppFullScreen = false}) async {
|
||||
Future<void> showStatusBar() async {
|
||||
if (_showStatusBar) {
|
||||
return;
|
||||
}
|
||||
_showStatusBar = true;
|
||||
dynamic document;
|
||||
late SystemUiMode mode = SystemUiMode.edgeToEdge;
|
||||
try {
|
||||
if (kIsWeb) {
|
||||
document.exitFullscreen();
|
||||
} else if (Utils.isMobile) {
|
||||
if (Utils.isMobile) {
|
||||
SystemUiMode mode;
|
||||
if (Platform.isAndroid && (await Utils.sdkInt < 29)) {
|
||||
mode = SystemUiMode.manual;
|
||||
} else {
|
||||
mode = SystemUiMode.edgeToEdge;
|
||||
}
|
||||
await SystemChrome.setEnabledSystemUIMode(
|
||||
mode,
|
||||
overlays: SystemUiOverlay.values,
|
||||
);
|
||||
} else if (Utils.isDesktop && !inAppFullScreen) {
|
||||
} else if (Utils.isDesktop) {
|
||||
await const MethodChannel(
|
||||
'com.alexmercerind/media_kit_video',
|
||||
).invokeMethod(
|
||||
'Utils.ExitNativeFullscreen',
|
||||
);
|
||||
).invokeMethod('Utils.ExitNativeFullscreen');
|
||||
}
|
||||
} catch (_) {
|
||||
if (kDebugMode) rethrow;
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'dart:io';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
abstract class CacheManage {
|
||||
@@ -11,28 +12,23 @@ abstract class CacheManage {
|
||||
static Future<int> loadApplicationCache([
|
||||
final num maxSize = double.infinity,
|
||||
]) async {
|
||||
/// clear all of image in memory
|
||||
// clearMemoryImageCache();
|
||||
/// get ImageCache
|
||||
// var res = getMemoryImageCache();
|
||||
|
||||
// 缓存大小
|
||||
// cached_network_image directory
|
||||
Directory tempDirectory = await getTemporaryDirectory();
|
||||
if (Utils.isDesktop) {
|
||||
final dir = Directory('${tempDirectory.path}/libCachedImageData');
|
||||
if (dir.existsSync()) {
|
||||
return await getTotalSizeOfFilesInDir(dir, maxSize);
|
||||
} else {
|
||||
return 0;
|
||||
try {
|
||||
Directory tempDirectory = await getTemporaryDirectory();
|
||||
if (Utils.isDesktop) {
|
||||
final dir = Directory('${tempDirectory.path}/libCachedImageData');
|
||||
if (dir.existsSync()) {
|
||||
return await getTotalSizeOfFilesInDir(dir, maxSize);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 获取缓存大小
|
||||
if (tempDirectory.existsSync()) {
|
||||
return await getTotalSizeOfFilesInDir(tempDirectory, maxSize);
|
||||
if (tempDirectory.existsSync()) {
|
||||
return await getTotalSizeOfFilesInDir(tempDirectory, maxSize);
|
||||
}
|
||||
} catch (_) {
|
||||
if (kDebugMode) rethrow;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -66,20 +62,23 @@ abstract class CacheManage {
|
||||
|
||||
// 清除 Library/Caches 目录及文件缓存
|
||||
static Future<void> clearLibraryCache() async {
|
||||
var tempDirectory = await getTemporaryDirectory();
|
||||
if (Utils.isDesktop) {
|
||||
final dir = Directory('${tempDirectory.path}/libCachedImageData');
|
||||
if (dir.existsSync()) {
|
||||
await dir.delete(recursive: true);
|
||||
try {
|
||||
var tempDirectory = await getTemporaryDirectory();
|
||||
if (Utils.isDesktop) {
|
||||
final dir = Directory('${tempDirectory.path}/libCachedImageData');
|
||||
if (dir.existsSync()) {
|
||||
await dir.delete(recursive: true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (tempDirectory.existsSync()) {
|
||||
// await appDocDir.delete(recursive: true);
|
||||
final children = tempDirectory.list(recursive: false);
|
||||
await for (final file in children) {
|
||||
await file.delete(recursive: true);
|
||||
if (tempDirectory.existsSync()) {
|
||||
final children = tempDirectory.list(recursive: false);
|
||||
await for (final file in children) {
|
||||
await file.delete(recursive: true);
|
||||
}
|
||||
}
|
||||
} catch (_) {
|
||||
if (kDebugMode) rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,6 +109,10 @@ extension ColorSchemeExt on ColorScheme {
|
||||
|
||||
Color get freeColor =>
|
||||
brightness.isLight ? const Color(0xFFFF7F24) : const Color(0xFFD66011);
|
||||
|
||||
bool get isLight => brightness.isLight;
|
||||
|
||||
bool get isDark => brightness.isDark;
|
||||
}
|
||||
|
||||
extension Unique<E, Id> on List<E> {
|
||||
|
||||
Reference in New Issue
Block a user