From a98d8537c7eb231f02c44f7d626b50cca4e5eb22 Mon Sep 17 00:00:00 2001 From: orz12 Date: Sun, 7 Jan 2024 17:04:20 +0800 Subject: [PATCH] =?UTF-8?q?opt:=20=E5=B0=81=E9=9D=A2=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=92=AD=E6=94=BE+=E5=BC=B9=E5=B9=95=E5=8F=91=E9=80=81?= =?UTF-8?q?=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/view.dart | 38 +++++++++++++------ .../video/detail/widgets/header_control.dart | 33 +++++++++------- 2 files changed, 46 insertions(+), 25 deletions(-) diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index cd66d50c..4ef4fd6d 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -306,9 +306,9 @@ class _VideoDetailPageState extends State Obx(() => SliverAppBar( automaticallyImplyLeading: false, // 假装使用一个非空变量,避免Obx检测不到而罢工 - pinned: videoDetailController - .autoPlay.value ^ false ^ videoDetailController - .autoPlay.value, + pinned: videoDetailController.autoPlay.value ^ + false ^ + videoDetailController.autoPlay.value, elevation: 0, scrolledUnderElevation: 0, forceElevated: innerBoxIsScrolled, @@ -389,12 +389,17 @@ class _VideoDetailPageState extends State top: 0, left: 0, right: 0, - child: NetworkImgLayer( - type: 'emote', - src: videoDetailController - .videoItem['pic'], - width: maxWidth, - height: maxHeight, + child: GestureDetector( + onTap: () { + handlePlay(); + }, + child: NetworkImgLayer( + type: 'emote', + src: videoDetailController + .videoItem['pic'], + width: maxWidth, + height: maxHeight, + ), ), ), ), @@ -444,13 +449,24 @@ class _VideoDetailPageState extends State bottom: 10, child: TextButton.icon( style: ButtonStyle( + side: MaterialStateProperty + .resolveWith( + (states) { + return BorderSide( + color: Theme.of(context) + .colorScheme + .primary + .withOpacity(0.5), + width: 1); + }), backgroundColor: MaterialStateProperty .resolveWith( (states) { return Theme.of(context) .colorScheme - .primaryContainer; + .background + .withOpacity(0.6); }), ), onPressed: () => handlePlay(), @@ -458,7 +474,7 @@ class _VideoDetailPageState extends State Icons.play_circle_outline, size: 20, ), - label: const Text('Play'), + label: const Text('轻触封面播放'), ), ), ], diff --git a/lib/pages/video/detail/widgets/header_control.dart b/lib/pages/video/detail/widgets/header_control.dart index c07afbb6..82173650 100644 --- a/lib/pages/video/detail/widgets/header_control.dart +++ b/lib/pages/video/detail/widgets/header_control.dart @@ -239,7 +239,7 @@ class _HeaderControlState extends State { // TODO: 暂停状态下预览弹幕仍会移动与计时,可考虑添加到dmSegList或其他方式实现 widget.controller!.danmakuController!.addItems([ DanmakuItem( - msg, + "☞$msg", color: Colors.white, time: widget .controller!.position.value.inMilliseconds, @@ -780,14 +780,16 @@ class _HeaderControlState extends State { label: danmakuDurationVal.toString(), onChanged: (double val) { danmakuDurationVal = val; - widget.controller!.danmakuDurationVal = danmakuDurationVal; + widget.controller!.danmakuDurationVal = + danmakuDurationVal; setState(() {}); try { DanmakuOption currentOption = danmakuController.option; DanmakuOption updatedOption = - currentOption.copyWith(duration: - val/widget.controller!.playbackSpeed); + currentOption.copyWith( + duration: + val / widget.controller!.playbackSpeed); danmakuController.updateOption(updatedOption); } catch (_) {} }, @@ -882,16 +884,19 @@ class _HeaderControlState extends State { color: Colors.white, ), fuc: () => { - if (widget.controller!.isFullScreen.value){ - widget.controller!.triggerFullScreen(status: false) - } else { - if (MediaQuery.of(context).orientation == Orientation.landscape){ - SystemChrome.setPreferredOrientations([ - DeviceOrientation.portraitUp, - ]) - }, - Get.back() - } + if (widget.controller!.isFullScreen.value) + {widget.controller!.triggerFullScreen(status: false)} + else + { + if (MediaQuery.of(context).orientation == + Orientation.landscape) + { + SystemChrome.setPreferredOrientations([ + DeviceOrientation.portraitUp, + ]) + }, + Get.back() + } }, ), SizedBox(width: buttonSpace),