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