mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-15 23:10:09 +08:00
opt video bottomsheet
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -7,10 +7,10 @@ class CustomFractionallySizedBox extends FractionallySizedBox {
|
||||
const CustomFractionallySizedBox({
|
||||
super.key,
|
||||
super.alignment,
|
||||
super.widthFactor,
|
||||
super.heightFactor,
|
||||
super.child,
|
||||
required double super.widthFactor,
|
||||
required double super.heightFactor,
|
||||
required this.maxWidth,
|
||||
super.child,
|
||||
});
|
||||
|
||||
final double maxWidth;
|
||||
@@ -44,7 +44,10 @@ class CustomRenderFractionallySizedOverflowBox
|
||||
double minWidth = constraints.minWidth;
|
||||
double maxWidth = constraints.maxWidth;
|
||||
if (widthFactor != null) {
|
||||
final double width = math.min(_maxWidth, maxWidth * widthFactor!);
|
||||
double width = maxWidth * widthFactor!;
|
||||
if (maxWidth > constraints.maxHeight) {
|
||||
width = math.min(_maxWidth, width);
|
||||
}
|
||||
minWidth = width;
|
||||
maxWidth = width;
|
||||
}
|
||||
|
||||
@@ -533,7 +533,6 @@ class VideoDetailController extends GetxController
|
||||
child: plPlayerController.darkVideoPage
|
||||
? Theme(data: ThemeUtils.darkTheme, child: panel())
|
||||
: panel(),
|
||||
isFullScreen: () => plPlayerController.isFullScreen.value,
|
||||
);
|
||||
} else {
|
||||
childKey.currentState?.showBottomSheet(
|
||||
@@ -1049,7 +1048,6 @@ class VideoDetailController extends GetxController
|
||||
videoDetailController: this,
|
||||
plPlayerController: plPlayerController,
|
||||
),
|
||||
isFullScreen: () => plPlayerController.isFullScreen.value,
|
||||
);
|
||||
} else {
|
||||
childKey.currentState?.showBottomSheet(
|
||||
@@ -1392,7 +1390,6 @@ class VideoDetailController extends GetxController
|
||||
isStein: graphVersion != null,
|
||||
title: title,
|
||||
),
|
||||
isFullScreen: () => plPlayerController.isFullScreen.value,
|
||||
);
|
||||
} else {
|
||||
childKey.currentState?.showBottomSheet(
|
||||
|
||||
@@ -1998,7 +1998,6 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
if (isFullScreen || videoDetailController.showVideoSheet) {
|
||||
PageUtils.showVideoBottomSheet(
|
||||
context,
|
||||
isFullScreen: () => isFullScreen,
|
||||
child: videoDetailController.plPlayerController.darkVideoPage
|
||||
? Theme(
|
||||
data: themeData,
|
||||
@@ -2078,7 +2077,6 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
if (isFullScreen || videoDetailController.showVideoSheet) {
|
||||
PageUtils.showVideoBottomSheet(
|
||||
context,
|
||||
isFullScreen: () => isFullScreen,
|
||||
child: videoDetailController.plPlayerController.darkVideoPage
|
||||
? Theme(
|
||||
data: themeData,
|
||||
|
||||
@@ -1247,7 +1247,7 @@ class HeaderControlState extends State<HeaderControl>
|
||||
/// 字幕设置
|
||||
void showSetSubtitle() {
|
||||
showBottomSheet(
|
||||
padding: isFullScreen ? 70 : null,
|
||||
padding: () => isFullScreen ? const .only(bottom: 70) : .zero,
|
||||
(context, setState) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
|
||||
@@ -14,12 +14,11 @@ mixin HeaderMixin<T extends StatefulWidget> on State<T> {
|
||||
|
||||
Future<void>? showBottomSheet(
|
||||
StatefulWidgetBuilder builder, {
|
||||
double? padding,
|
||||
ValueGetter<EdgeInsets>? padding,
|
||||
}) {
|
||||
return PageUtils.showVideoBottomSheet(
|
||||
context,
|
||||
maxWidth: 512,
|
||||
isFullScreen: () => isFullScreen,
|
||||
padding: padding,
|
||||
child: StatefulBuilder(
|
||||
builder: (context, setState) => plPlayerController.darkVideoPage
|
||||
|
||||
@@ -148,7 +148,6 @@ class ShutdownTimerService {
|
||||
PageUtils.showVideoBottomSheet(
|
||||
context,
|
||||
maxWidth: 512,
|
||||
isFullScreen: () => isFullScreen,
|
||||
child: StatefulBuilder(
|
||||
builder: (_, setState) {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
|
||||
@@ -495,8 +495,7 @@ abstract final class PageUtils {
|
||||
static Future<void>? showVideoBottomSheet(
|
||||
BuildContext context, {
|
||||
required Widget child,
|
||||
required ValueGetter<bool> isFullScreen,
|
||||
double? padding,
|
||||
ValueGetter<EdgeInsets>? padding,
|
||||
double maxWidth = 500,
|
||||
}) {
|
||||
if (!context.mounted) {
|
||||
@@ -505,28 +504,17 @@ abstract final class PageUtils {
|
||||
return Get.key.currentState!.push(
|
||||
PublishRoute(
|
||||
pageBuilder: (context, animation, secondaryAnimation) {
|
||||
if (context.isPortrait) {
|
||||
return SafeArea(
|
||||
child: FractionallySizedBox(
|
||||
heightFactor: 0.7,
|
||||
widthFactor: 1.0,
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: isFullScreen() && padding != null
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(bottom: padding),
|
||||
child: child,
|
||||
)
|
||||
: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
final isPortrait = context.isPortrait;
|
||||
return SafeArea(
|
||||
child: CustomFractionallySizedBox(
|
||||
maxWidth: maxWidth,
|
||||
widthFactor: 0.5,
|
||||
heightFactor: 1.0,
|
||||
alignment: Alignment.centerRight,
|
||||
child: child,
|
||||
widthFactor: isPortrait ? 1.0 : 0.5,
|
||||
heightFactor: isPortrait ? 0.7 : 1.0,
|
||||
alignment: isPortrait ? .bottomCenter : .centerRight,
|
||||
child: Padding(
|
||||
padding: isPortrait ? padding?.call() ?? .zero : .zero,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user