mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: video theme, view later
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -652,6 +652,7 @@ class VideoIntroController extends GetxController
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
hasLater.value = false;
|
||||
this.bvid = bvid;
|
||||
lastPlayCid.value = cid;
|
||||
queryVideoIntro();
|
||||
|
||||
@@ -21,6 +21,7 @@ class VideoReplyReplyController extends ReplyController
|
||||
required this.dialog,
|
||||
required this.replyType,
|
||||
required this.isDialogue,
|
||||
required this.getThemeData,
|
||||
});
|
||||
final int? dialog;
|
||||
final bool isDialogue;
|
||||
@@ -60,6 +61,8 @@ class VideoReplyReplyController extends ReplyController
|
||||
return super.onRefresh();
|
||||
}
|
||||
|
||||
final ThemeData Function() getThemeData;
|
||||
|
||||
@override
|
||||
bool customHandleResponse(Success response) {
|
||||
if (GlobalData().grpcReply) {
|
||||
@@ -81,8 +84,8 @@ class VideoReplyReplyController extends ReplyController
|
||||
vsync: this,
|
||||
);
|
||||
colorAnimation = ColorTween(
|
||||
begin: Theme.of(Get.context!).colorScheme.onInverseSurface,
|
||||
end: Theme.of(Get.context!).colorScheme.surface,
|
||||
begin: getThemeData().colorScheme.onInverseSurface,
|
||||
end: getThemeData().colorScheme.surface,
|
||||
).animate(controller!);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
if (index != null) {
|
||||
|
||||
@@ -80,6 +80,7 @@ class _VideoReplyReplyPanelState
|
||||
dialog: widget.dialog,
|
||||
replyType: widget.replyType,
|
||||
isDialogue: widget.isDialogue,
|
||||
getThemeData: () => Theme.of(context),
|
||||
),
|
||||
tag: '${widget.rpid}${widget.dialog}${widget.isDialogue}',
|
||||
);
|
||||
@@ -473,9 +474,9 @@ class _VideoReplyReplyPanelState
|
||||
animation: _videoReplyReplyController.colorAnimation!,
|
||||
builder: (context, child) {
|
||||
return ColoredBox(
|
||||
color: _videoReplyReplyController
|
||||
.colorAnimation?.value ??
|
||||
Theme.of(Get.context!).colorScheme.onInverseSurface,
|
||||
color:
|
||||
_videoReplyReplyController.colorAnimation?.value ??
|
||||
Theme.of(context).colorScheme.onInverseSurface,
|
||||
child: _replyItem(loadingState.response[index], index),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -590,14 +590,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
: MediaQuery.of(context).padding.top)
|
||||
: videoHeight,
|
||||
width: context.width,
|
||||
child: PopScope(
|
||||
canPop: !isFullScreen &&
|
||||
(horizontalScreen ||
|
||||
MediaQuery.of(context).orientation ==
|
||||
Orientation.portrait),
|
||||
onPopInvokedWithResult: _onPopInvokedWithResult,
|
||||
child: videoPlayer(videoWidth, videoHeight),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -648,12 +641,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
SizedBox(
|
||||
height: videoHeight,
|
||||
width: isFullScreen ? context.width : videoWidth,
|
||||
child: PopScope(
|
||||
canPop: !isFullScreen,
|
||||
onPopInvokedWithResult: _onPopInvokedWithResult,
|
||||
child: videoPlayer(videoWidth, videoHeight),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Scaffold(
|
||||
key: videoDetailController.childKey,
|
||||
@@ -693,12 +682,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
: (MediaQuery.of(context).padding.top +
|
||||
MediaQuery.of(context).padding.bottom))
|
||||
: videoHeight,
|
||||
child: PopScope(
|
||||
canPop: !isFullScreen,
|
||||
onPopInvokedWithResult: _onPopInvokedWithResult,
|
||||
child: videoPlayer(videoWidth, videoHeight),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Scaffold(
|
||||
key: videoDetailController.childKey,
|
||||
@@ -745,12 +730,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
SizedBox(
|
||||
height: videoHeight,
|
||||
width: isFullScreen ? context.width : videoWidth,
|
||||
child: PopScope(
|
||||
canPop: !isFullScreen,
|
||||
onPopInvokedWithResult: _onPopInvokedWithResult,
|
||||
child: videoPlayer(videoWidth, videoHeight),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Expanded(
|
||||
child: Scaffold(
|
||||
@@ -829,12 +810,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
SizedBox(
|
||||
width: isFullScreen ? context.width : videoWidth,
|
||||
height: isFullScreen ? context.height : videoHeight,
|
||||
child: PopScope(
|
||||
canPop: !isFullScreen,
|
||||
onPopInvokedWithResult: _onPopInvokedWithResult,
|
||||
child: videoPlayer(videoWidth, videoHeight),
|
||||
),
|
||||
),
|
||||
Offstage(
|
||||
offstage: isFullScreen,
|
||||
child: SizedBox(
|
||||
@@ -1367,7 +1344,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
);
|
||||
}
|
||||
|
||||
Widget videoPlayer(double videoWidth, double videoHeight) => Stack(
|
||||
Widget videoPlayer(double videoWidth, double videoHeight) => PopScope(
|
||||
canPop: !isFullScreen,
|
||||
onPopInvokedWithResult: _onPopInvokedWithResult,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(child: ColoredBox(color: Colors.black)),
|
||||
|
||||
@@ -1460,14 +1440,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: plPlayerController?.showControls.value == true
|
||||
vertical:
|
||||
plPlayerController?.showControls.value == true
|
||||
? 75
|
||||
: 16,
|
||||
),
|
||||
child: Wrap(
|
||||
spacing: 25,
|
||||
runSpacing: 10,
|
||||
children: (videoDetailController.steinEdgeInfo!['edges']
|
||||
children:
|
||||
(videoDetailController.steinEdgeInfo!['edges']
|
||||
['questions'][0]['choices'] as List)
|
||||
.map((item) {
|
||||
return FilledButton.tonal(
|
||||
@@ -1513,6 +1495,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Widget videoIntro([bool needRelated = true]) {
|
||||
|
||||
@@ -768,12 +768,6 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
? animHeight
|
||||
: videoDetailController.videoHeight,
|
||||
width: context.width,
|
||||
child: PopScope(
|
||||
canPop: !isFullScreen &&
|
||||
(horizontalScreen ||
|
||||
MediaQuery.of(context).orientation ==
|
||||
Orientation.portrait),
|
||||
onPopInvokedWithResult: _onPopInvokedWithResult,
|
||||
child: videoPlayer(
|
||||
videoWidth,
|
||||
context.orientation == Orientation.landscape ||
|
||||
@@ -784,7 +778,6 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
? animHeight
|
||||
: videoDetailController.videoHeight,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -1026,12 +1019,8 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
SizedBox(
|
||||
height: videoHeight,
|
||||
width: isFullScreen ? context.width : videoWidth,
|
||||
child: PopScope(
|
||||
canPop: !isFullScreen,
|
||||
onPopInvokedWithResult: _onPopInvokedWithResult,
|
||||
child: videoPlayer(videoWidth, videoHeight),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Scaffold(
|
||||
key: videoDetailController.childKey,
|
||||
@@ -1071,12 +1060,8 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
: (MediaQuery.of(context).padding.top +
|
||||
MediaQuery.of(context).padding.bottom))
|
||||
: videoHeight,
|
||||
child: PopScope(
|
||||
canPop: !isFullScreen,
|
||||
onPopInvokedWithResult: _onPopInvokedWithResult,
|
||||
child: videoPlayer(videoWidth, videoHeight),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Scaffold(
|
||||
key: videoDetailController.childKey,
|
||||
@@ -1123,12 +1108,8 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
SizedBox(
|
||||
height: videoHeight,
|
||||
width: isFullScreen ? context.width : videoWidth,
|
||||
child: PopScope(
|
||||
canPop: !isFullScreen,
|
||||
onPopInvokedWithResult: _onPopInvokedWithResult,
|
||||
child: videoPlayer(videoWidth, videoHeight),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Expanded(
|
||||
child: Scaffold(
|
||||
@@ -1208,12 +1189,8 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
SizedBox(
|
||||
width: isFullScreen ? context.width : videoWidth,
|
||||
height: isFullScreen ? context.height : videoHeight,
|
||||
child: PopScope(
|
||||
canPop: !isFullScreen,
|
||||
onPopInvokedWithResult: _onPopInvokedWithResult,
|
||||
child: videoPlayer(videoWidth, videoHeight),
|
||||
),
|
||||
),
|
||||
Offstage(
|
||||
offstage: isFullScreen,
|
||||
child: SizedBox(
|
||||
@@ -1752,7 +1729,10 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
}
|
||||
|
||||
Widget videoPlayer(double videoWidth, double videoHeight) {
|
||||
return Stack(
|
||||
return PopScope(
|
||||
canPop: !isFullScreen,
|
||||
onPopInvokedWithResult: _onPopInvokedWithResult,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(child: ColoredBox(color: Colors.black)),
|
||||
|
||||
@@ -1889,7 +1869,8 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
null,
|
||||
true,
|
||||
);
|
||||
videoDetailController.getSteinEdgeInfo(item['id']);
|
||||
videoDetailController
|
||||
.getSteinEdgeInfo(item['id']);
|
||||
},
|
||||
child: Text(item['option']),
|
||||
);
|
||||
@@ -1906,6 +1887,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||
import 'package:media_kit/media_kit.dart';
|
||||
import 'package:PiliPlus/http/user.dart';
|
||||
import 'package:PiliPlus/models/video/play/quality.dart';
|
||||
import 'package:PiliPlus/models/video/play/url.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/index.dart';
|
||||
@@ -147,9 +146,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
dense: true,
|
||||
onTap: () async {
|
||||
Get.back();
|
||||
final res =
|
||||
await UserHttp.toViewLater(bvid: videoDetailCtr.bvid);
|
||||
SmartDialog.showToast(res['msg']);
|
||||
videoIntroController.viewLater();
|
||||
},
|
||||
leading: const Icon(Icons.watch_later_outlined, size: 20),
|
||||
title: const Text('添加至「稍后再看」', style: titleStyle),
|
||||
|
||||
Reference in New Issue
Block a user