Merge branch 'feature-updateVideoDetailStructure'

This commit is contained in:
guozhigq
2024-04-13 22:39:47 +08:00
4 changed files with 46 additions and 32 deletions

View File

@ -106,6 +106,7 @@ class VideoDetailController extends GetxController
BottomControlType.fit, BottomControlType.fit,
BottomControlType.fullscreen, BottomControlType.fullscreen,
].obs; ].obs;
RxDouble sheetHeight = 0.0.obs;
@override @override
void onInit() { void onInit() {
@ -172,6 +173,7 @@ class VideoDetailController extends GetxController
firstFloor: firstFloor, firstFloor: firstFloor,
replyType: ReplyType.video, replyType: ReplyType.video,
source: 'videoDetail', source: 'videoDetail',
sheetHeight: sheetHeight.value,
); );
}); });
replyReplyBottomSheetCtr?.closed.then((value) { replyReplyBottomSheetCtr?.closed.then((value) {

View File

@ -372,7 +372,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
), ),
/// 点赞收藏转发 /// 点赞收藏转发
actionGrid(context, videoIntroController), Material(child: actionGrid(context, videoIntroController)),
// 合集 videoPart 简洁 // 合集 videoPart 简洁
if (widget.videoDetail!.ugcSeason != null) ...[ if (widget.videoDetail!.ugcSeason != null) ...[
Obx( Obx(
@ -381,7 +381,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
cid: videoIntroController.lastPlayCid.value != 0 cid: videoIntroController.lastPlayCid.value != 0
? videoIntroController.lastPlayCid.value ? videoIntroController.lastPlayCid.value
: widget.videoDetail!.pages!.first.cid, : widget.videoDetail!.pages!.first.cid,
sheetHeight: sheetHeight, sheetHeight: videoDetailCtr.sheetHeight.value,
changeFuc: (bvid, cid, aid) => changeFuc: (bvid, cid, aid) =>
videoIntroController.changeSeasonOrbangu( videoIntroController.changeSeasonOrbangu(
bvid, bvid,
@ -399,7 +399,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
() => PagesPanel( () => PagesPanel(
pages: widget.videoDetail!.pages!, pages: widget.videoDetail!.pages!,
cid: videoIntroController.lastPlayCid.value, cid: videoIntroController.lastPlayCid.value,
sheetHeight: sheetHeight, sheetHeight: videoDetailCtr.sheetHeight.value,
changeFuc: (cid) => videoIntroController.changeSeasonOrbangu( changeFuc: (cid) => videoIntroController.changeSeasonOrbangu(
videoIntroController.bvid, videoIntroController.bvid,
cid, cid,

View File

@ -19,6 +19,7 @@ class VideoReplyReplyPanel extends StatefulWidget {
this.firstFloor, this.firstFloor,
this.source, this.source,
this.replyType, this.replyType,
this.sheetHeight,
super.key, super.key,
}); });
final int? oid; final int? oid;
@ -27,6 +28,7 @@ class VideoReplyReplyPanel extends StatefulWidget {
final ReplyItemModel? firstFloor; final ReplyItemModel? firstFloor;
final String? source; final String? source;
final ReplyType? replyType; final ReplyType? replyType;
final double? sheetHeight;
@override @override
State<VideoReplyReplyPanel> createState() => _VideoReplyReplyPanelState(); State<VideoReplyReplyPanel> createState() => _VideoReplyReplyPanelState();
@ -36,7 +38,6 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
late VideoReplyReplyController _videoReplyReplyController; late VideoReplyReplyController _videoReplyReplyController;
late AnimationController replyAnimationCtl; late AnimationController replyAnimationCtl;
final Box<dynamic> localCache = GStrorage.localCache; final Box<dynamic> localCache = GStrorage.localCache;
late double sheetHeight;
Future? _futureBuilderFuture; Future? _futureBuilderFuture;
late ScrollController scrollController; late ScrollController scrollController;
@ -62,7 +63,6 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
}, },
); );
sheetHeight = localCache.get('sheetHeight');
_futureBuilderFuture = _videoReplyReplyController.queryReplyList(); _futureBuilderFuture = _videoReplyReplyController.queryReplyList();
} }
@ -77,33 +77,31 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
height: widget.source == 'videoDetail' ? sheetHeight : null, height: widget.source == 'videoDetail' ? widget.sheetHeight : null,
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.background,
child: Column( child: Column(
children: [ children: [
if (widget.source == 'videoDetail') if (widget.source == 'videoDetail')
Container( AppBar(
height: 45, toolbarHeight: 45,
padding: const EdgeInsets.only(left: 12, right: 2), automaticallyImplyLeading: false,
child: Row( centerTitle: false,
mainAxisAlignment: MainAxisAlignment.spaceBetween, title: Text(
children: <Widget>[ '评论详情',
const Text('评论详情'), style: Theme.of(context).textTheme.titleSmall,
IconButton(
icon: const Icon(Icons.close, size: 20),
onPressed: () {
_videoReplyReplyController.currentPage = 0;
widget.closePanel?.call;
Navigator.pop(context);
},
),
],
), ),
actions: [
IconButton(
icon: const Icon(Icons.close, size: 20),
onPressed: () {
_videoReplyReplyController.currentPage = 0;
widget.closePanel?.call;
Navigator.pop(context);
},
),
const SizedBox(width: 14),
],
), ),
Divider(
height: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1),
),
Expanded( Expanded(
child: RefreshIndicator( child: RefreshIndicator(
onRefresh: () async { onRefresh: () async {

View File

@ -47,7 +47,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
late BangumiIntroController bangumiIntroController; late BangumiIntroController bangumiIntroController;
late String heroTag; late String heroTag;
PlayerStatus playerStatus = PlayerStatus.playing; Rx<PlayerStatus> playerStatus = PlayerStatus.playing.obs;
double doubleOffset = 0; double doubleOffset = 0;
final Box<dynamic> localCache = GStrorage.localCache; final Box<dynamic> localCache = GStrorage.localCache;
@ -67,6 +67,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
super.initState(); super.initState();
heroTag = Get.arguments['heroTag']; heroTag = Get.arguments['heroTag'];
vdCtr = Get.put(VideoDetailController(), tag: heroTag); vdCtr = Get.put(VideoDetailController(), tag: heroTag);
vdCtr.sheetHeight.value = localCache.get('sheetHeight');
videoIntroController = Get.put( videoIntroController = Get.put(
VideoIntroController(bvid: Get.parameters['bvid']!), VideoIntroController(bvid: Get.parameters['bvid']!),
tag: heroTag); tag: heroTag);
@ -112,6 +113,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
_extendNestCtr.addListener( _extendNestCtr.addListener(
() { () {
final double offset = _extendNestCtr.position.pixels; final double offset = _extendNestCtr.position.pixels;
vdCtr.sheetHeight.value =
Get.size.height - videoHeight - statusBarHeight + offset;
appbarStream.add(offset); appbarStream.add(offset);
}, },
); );
@ -119,7 +122,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
// 播放器状态监听 // 播放器状态监听
void playerListener(PlayerStatus? status) async { void playerListener(PlayerStatus? status) async {
playerStatus = status!; playerStatus.value = status!;
if (status == PlayerStatus.completed) { if (status == PlayerStatus.completed) {
// 结束播放退出全屏 // 结束播放退出全屏
if (autoExitFullcreen) { if (autoExitFullcreen) {
@ -271,7 +274,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// final double videoHeight = MediaQuery.sizeOf(context).width * 9 / 16;
final sizeContext = MediaQuery.sizeOf(context); final sizeContext = MediaQuery.sizeOf(context);
final _context = MediaQuery.of(context); final _context = MediaQuery.of(context);
late double defaultVideoHeight = sizeContext.width * 9 / 16; late double defaultVideoHeight = sizeContext.width * 9 / 16;
@ -366,6 +368,18 @@ class _VideoDetailPageState extends State<VideoDetailPage>
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Obx(() => AnimatedOpacity(
opacity: playerStatus.value != PlayerStatus.playing
? 1
: 0,
duration: const Duration(milliseconds: 100),
child: const Icon(
Icons.drag_handle_rounded,
size: 20,
color: Colors.grey,
),
)),
const SizedBox(width: 8),
SizedBox( SizedBox(
height: 32, height: 32,
child: TextButton( child: TextButton(
@ -404,7 +418,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
), ),
), ),
), ),
const SizedBox(width: 14), const SizedBox(width: 18),
], ],
), ),
)), )),
@ -557,7 +571,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
Orientation.landscape || Orientation.landscape ||
plPlayerController?.isFullScreen.value == true plPlayerController?.isFullScreen.value == true
? MediaQuery.sizeOf(context).height ? MediaQuery.sizeOf(context).height
: playerStatus != PlayerStatus.playing : playerStatus.value != PlayerStatus.playing
? kToolbarHeight ? kToolbarHeight
: pinnedHeaderHeight; : pinnedHeaderHeight;
}, },
@ -624,7 +638,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
return ScrollAppBar( return ScrollAppBar(
snapshot.data!.toDouble(), snapshot.data!.toDouble(),
() => continuePlay(), () => continuePlay(),
playerStatus, playerStatus.value,
null, null,
); );
}), }),