基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。
enhance desktop mouse control
ErBW_s2a1e1356e4f2
diff --git a/lib/bean/card/bangumi_history_card.dart b/lib/bean/card/bangumi_history_card.dartindex 6a73e5c3..e11c60df 100644--- a/lib/bean/card/bangumi_history_card.dart+++ b/lib/bean/card/bangumi_history_card.dart@@ -162,20 +162,18 @@ class _BangumiHistoryCardVState extends State<BangumiHistoryCardV> {bangumiItem: widget.historyItem.bangumiItem,color: Theme.of(context).colorScheme.onSecondaryContainer,),- widget.showDelete- ? IconButton(- icon: Icon(- Icons.delete,- color: Theme.of(context)- .colorScheme- .onSecondaryContainer,- ),- onPressed: () {- historyController- .deleteHistory(widget.historyItem);- },- )- : Container(),+ if (widget.showDelete)+ IconButton(+ icon: Icon(+ Icons.delete,+ color: Theme.of(context)+ .colorScheme+ .onSecondaryContainer,+ ),+ onPressed: () {+ historyController.deleteHistory(widget.historyItem);+ },+ )],),],diff --git a/lib/pages/player/player_controller.dart b/lib/pages/player/player_controller.dartindex ec28ae59..afdb8868 100644--- a/lib/pages/player/player_controller.dart+++ b/lib/pages/player/player_controller.dart@@ -194,6 +194,7 @@ abstract class _PlayerController with Store {}Future<void> seek(Duration duration) async {+ currentPosition = duration;danmakuController.clear();await mediaPlayer.seek(duration);}diff --git a/lib/pages/player/player_item.dart b/lib/pages/player/player_item.dartindex 45c9ec58..fe6b6c53 100644--- a/lib/pages/player/player_item.dart+++ b/lib/pages/player/player_item.dart@@ -68,6 +68,7 @@ class _PlayerItemState extends State<PlayerItem>final CollectController collectController = Modular.get<CollectController>();final FocusNode _focusNode = FocusNode();late DanmakuController danmakuController;+// 1. 在看// 2. 想看// 3. 搁置@@ -78,8 +79,8 @@ class _PlayerItemState extends State<PlayerItem>late bool haEnable;// 界面管理- bool showPositioned = false;- bool showPosition = false;+ bool showVideoController = false;+ bool showSeekTime = false;bool showBrightness = false;bool showVolume = false;bool showPlaySpeed = false;@@ -132,29 +133,55 @@ class _PlayerItemState extends State<PlayerItem>} catch (_) {}}+ void displayVideoController() {+ _animationController.forward();+ hideTimer?.cancel();+ startHideTimer();+ setState(() {+ showVideoController = true;+ });+ }++ void hideVideoController() {+ _animationController.reverse();+ hideTimer?.cancel();+ setState(() {+ showVideoController = false;+ });+ }+void _handleTap() {- if (!showPositioned) {- _animationController.forward();- hideTimer?.cancel();- startHideTimer();+ if (Utils.isDesktop()) {+ playerController.playOrPause();} else {- _animationController.reverse();- hideTimer?.cancel();+ if (showVideoController) {+ hideVideoController();+ } else {+ displayVideoController();+ }+ }+ }++ void _handleDoubleTap() {+ if (Utils.isDesktop()) {+ _handleFullscreen();+ } else {+ if (showVideoController) {+ hideVideoController();+ } else {+ displayVideoController();+ }+ if (lockPanel) {+ return;+ }+ playerController.playOrPause();}- setState(() {- showPositioned = !showPositioned;- });}void _handleHove() {- if (!showPositioned) {- _animationController.forward();+ if (!showVideoController) {+ displayVideoController();}- setState(() {- showPositioned = true;- });- hideTimer?.cancel();- startHideTimer();}void _handleMouseScroller() {@@ -724,7 +751,7 @@ class _PlayerItemState extends State<PlayerItem>playerTimer = getPlayerTimer();windowManager.addListener(this);playSpeedList = defaultPlaySpeedList;- _handleTap();+ displayVideoController();}@override@@ -752,7 +779,7 @@ class _PlayerItemState extends State<PlayerItem>child: Container(color: Colors.black,child: MouseRegion(- cursor: (videoPageController.isFullscreen && !showPositioned)+ cursor: (videoPageController.isFullscreen && !showVideoController)? SystemMouseCursors.none: SystemMouseCursors.basic,onHover: (_) {@@ -815,10 +842,8 @@ class _PlayerItemState extends State<PlayerItem>}try {playerTimer?.cancel();- playerController.currentPosition =- Duration(seconds: targetPosition);- playerController- .seek(playerController.currentPosition);+ playerController.seek(+ Duration(seconds: targetPosition));playerTimer = getPlayerTimer();} catch (e) {KazumiLogger()@@ -885,14 +910,10 @@ class _PlayerItemState extends State<PlayerItem>} else {try {playerTimer?.cancel();- playerController.currentPosition =- Duration(- seconds: playerController- .currentPosition- .inSeconds +- 10);- playerController.seek(- playerController.currentPosition);+ playerController.seek(Duration(+ seconds: playerController+ .currentPosition.inSeconds ++ 10));playerTimer = getPlayerTimer();} catch (e) {KazumiLogger().log(Level.error,@@ -917,17 +938,7 @@ class _PlayerItemState extends State<PlayerItem>_handleTap();},onDoubleTap: () {- if (!showPositioned) {- _handleTap();- }- if (lockPanel) {- return;- }- if (playerController.playing) {- playerController.pause();- } else {- playerController.play();- }+ _handleDoubleTap();},onLongPressStart: (_) {if (lockPanel) {@@ -1020,30 +1031,25 @@ class _PlayerItemState extends State<PlayerItem>: GestureDetector(onHorizontalDragUpdate:(DragUpdateDetails details) {setState(() {- showPosition = true;+ showSeekTime = true;});playerTimer?.cancel();playerController.pause();final double scale =180000 / MediaQuery.sizeOf(context).width;- playerController.currentPosition = Duration(- milliseconds: playerController- .currentPosition- .inMilliseconds +- (details.delta.dx * scale)- .round() <- 0- ? 0- : playerController.currentPosition- .inMilliseconds +- (details.delta.dx * scale).round());+ var ms = playerController+ .currentPosition.inMilliseconds ++ (details.delta.dx * scale).round();+ ms = ms > 0 ? ms : 0;+ playerController.currentPosition =+ Duration(milliseconds: ms);}, onHorizontalDragEnd: (DragEndDetails details) {playerController.play();playerController.seek(playerController.currentPosition);playerTimer = getPlayerTimer();setState(() {- showPosition = false;+ showSeekTime = false;});}, onVerticalDragUpdate:(DragUpdateDetails details) async {@@ -1108,7 +1114,7 @@ class _PlayerItemState extends State<PlayerItem>// 顶部进度条Positioned(top: 25,- child: showPosition+ child: showSeekTime? Wrap(alignment: WrapAlignment.center,children: <Widget>[@@ -1537,11 +1543,7 @@ class _PlayerItemState extends State<PlayerItem>? Icons.pause: Icons.play_arrow),onPressed: () {- if (playerController.playing) {- playerController.pause();- } else {- playerController.play();- }+ playerController.playOrPause();},),// 更换选集@@ -1586,7 +1588,6 @@ class _PlayerItemState extends State<PlayerItem>buffered: playerController.buffer,total: playerController.duration,onSeek: (duration) {- playerController.currentPosition = duration;playerController.seek(duration);},onDragStart: (details) {@@ -1594,7 +1595,7 @@ class _PlayerItemState extends State<PlayerItem>playerController.pause();hideTimer?.cancel();setState(() {- showPositioned = true;+ showVideoController = true;});},onDragUpdate: (details) => {@@ -1737,7 +1738,7 @@ class _PlayerItemState extends State<PlayerItem>hideTimer = Timer(const Duration(seconds: 4), () {if (mounted) {setState(() {- showPositioned = false;+ showVideoController = false;});_animationController.reverse();}diff --git a/lib/utils/utils.dart b/lib/utils/utils.dartindex 333f55be..6eadbf63 100644--- a/lib/utils/utils.dart+++ b/lib/utils/utils.dart@@ -382,10 +382,7 @@ class Utils {/// 判断是否为桌面设备static bool isDesktop() {- if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {- return true;- }- return false;+ return Platform.isWindows || Platform.isMacOS || Platform.isLinux;}/// 判断设备是否为宽屏