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