diff --git a/lib/pages/common/dyn/common_dyn_page.dart b/lib/pages/common/dyn/common_dyn_page.dart index df9e9b06f..e96df0ed2 100644 --- a/lib/pages/common/dyn/common_dyn_page.dart +++ b/lib/pages/common/dyn/common_dyn_page.dart @@ -180,10 +180,7 @@ abstract class CommonDynPageState extends State replyLevel: 1, replyReply: (replyItem, id) => replyReply(context, replyItem, id, theme), - onReply: (replyItem) => controller.onReply( - context, - replyItem: replyItem, - ), + onReply: controller.onReply, onDelete: (item, subIndex) => controller.onRemove(index, item, subIndex), upMid: controller.upMid, @@ -323,7 +320,7 @@ abstract class CommonDynPageState extends State try { feedBack(); controller.onReply( - context, + null, oid: controller.oid, replyType: controller.replyType, ); diff --git a/lib/pages/common/reply_controller.dart b/lib/pages/common/reply_controller.dart index 3875c906b..03e03a3db 100644 --- a/lib/pages/common/reply_controller.dart +++ b/lib/pages/common/reply_controller.dart @@ -12,7 +12,6 @@ import 'package:PiliPlus/utils/feed_back.dart'; import 'package:PiliPlus/utils/reply_utils.dart'; import 'package:PiliPlus/utils/request_utils.dart'; import 'package:PiliPlus/utils/storage_pref.dart'; -import 'package:PiliPlus/utils/utils.dart'; import 'package:fixnum/fixnum.dart'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; @@ -123,9 +122,8 @@ abstract class ReplyController extends CommonListController { } void onReply( - BuildContext context, { + ReplyInfo? replyItem, { int? oid, - ReplyInfo? replyItem, int? replyType, }) { if (loadingState.value case Error(:final errMsg, :final code)) { @@ -143,7 +141,7 @@ abstract class ReplyController extends CommonListController { } final key = oid ?? replyItem!.oid + replyItem.id; - Navigator.of(context) + Get.key.currentState! .push( PublishRoute( pageBuilder: (buildContext, animation, secondaryAnimation) { @@ -167,10 +165,7 @@ abstract class ReplyController extends CommonListController { }, ); }, - settings: RouteSettings( - arguments: Get.arguments, - name: '${Get.currentRoute}-copy-${Utils.generateRandomString(3)}', - ), + settings: RouteSettings(arguments: Get.arguments), ), ) .then( diff --git a/lib/pages/live_room/widgets/header_control.dart b/lib/pages/live_room/widgets/header_control.dart index afd49ea46..2284eefc7 100644 --- a/lib/pages/live_room/widgets/header_control.dart +++ b/lib/pages/live_room/widgets/header_control.dart @@ -162,9 +162,7 @@ class _LiveHeaderControlState extends State return; } if (await Floating().isPipAvailable) { - plPlayerController - ..showControls.value = false - ..enterPip(); + plPlayerController.enterPip(); } }, icon: const Icon( diff --git a/lib/pages/main_reply/view.dart b/lib/pages/main_reply/view.dart index 7504e555a..e52aff774 100644 --- a/lib/pages/main_reply/view.dart +++ b/lib/pages/main_reply/view.dart @@ -95,7 +95,7 @@ class _MainReplyPageState extends State { try { feedBack(); _controller.onReply( - context, + null, oid: _controller.oid, replyType: _controller.replyType, ); @@ -143,10 +143,7 @@ class _MainReplyPageState extends State { replyLevel: 1, replyReply: (replyItem, id) => replyReply(context, replyItem, id, colorScheme), - onReply: (replyItem) => _controller.onReply( - context, - replyItem: replyItem, - ), + onReply: _controller.onReply, onDelete: (item, subIndex) => _controller.onRemove(index, item, subIndex), upMid: _controller.upMid, diff --git a/lib/pages/video/reply/view.dart b/lib/pages/video/reply/view.dart index dabf3d7eb..62c0ca960 100644 --- a/lib/pages/video/reply/view.dart +++ b/lib/pages/video/reply/view.dart @@ -148,7 +148,7 @@ class _VideoReplyPanelState extends State onPressed: () { feedBack(); _videoReplyController.onReply( - context, + null, oid: _videoReplyController.aid, replyType: _videoReplyController.videoType.replyType, ); @@ -204,10 +204,7 @@ class _VideoReplyPanelState extends State replyItem: response[index], replyLevel: widget.replyLevel, replyReply: replyReply, - onReply: (replyItem) => _videoReplyController.onReply( - context, - replyItem: replyItem, - ), + onReply: _videoReplyController.onReply, onDelete: (item, subIndex) => _videoReplyController.onRemove(index, item, subIndex), upMid: _videoReplyController.upMid, diff --git a/lib/pages/video/reply_reply/controller.dart b/lib/pages/video/reply_reply/controller.dart index 113ab0983..5f2e08312 100644 --- a/lib/pages/video/reply_reply/controller.dart +++ b/lib/pages/video/reply_reply/controller.dart @@ -156,9 +156,8 @@ class VideoReplyReplyController extends ReplyController @override void onReply( - BuildContext context, { + ReplyInfo? replyItem, { int? oid, - ReplyInfo? replyItem, int? replyType, int? index, }) { @@ -173,7 +172,7 @@ class VideoReplyReplyController extends ReplyController final root = replyItem.id.toInt(); final key = oid + root; - Navigator.of(context) + Get.key.currentState! .push( PublishRoute( pageBuilder: (buildContext, animation, secondaryAnimation) { diff --git a/lib/pages/video/reply_reply/view.dart b/lib/pages/video/reply_reply/view.dart index 01c3612dd..c16053636 100644 --- a/lib/pages/video/reply_reply/view.dart +++ b/lib/pages/video/reply_reply/view.dart @@ -224,11 +224,7 @@ class _VideoReplyReplyPanelState extends State replyItem: firstFloor, replyLevel: 2, needDivider: false, - onReply: (replyItem) => _controller.onReply( - context, - replyItem: replyItem, - index: -1, - ), + onReply: (replyItem) => _controller.onReply(replyItem, index: -1), upMid: _controller.upMid, onCheckReply: (item) => _controller.onCheckReply(item, isManual: true), @@ -366,8 +362,7 @@ class _VideoReplyReplyPanelState extends State return ReplyItemGrpc( replyItem: replyItem, replyLevel: isDialogue ? 3 : 2, - onReply: (replyItem) => - _controller.onReply(this.context, replyItem: replyItem, index: index), + onReply: (replyItem) => _controller.onReply(replyItem, index: index), onDelete: (item, subIndex) => _controller.onRemove(index, item, null), upMid: _controller.upMid, showDialogue: () => Scaffold.of(context).showBottomSheet( diff --git a/lib/pages/video/widgets/header_control.dart b/lib/pages/video/widgets/header_control.dart index e602c2bd7..0fcf3b14a 100644 --- a/lib/pages/video/widgets/header_control.dart +++ b/lib/pages/video/widgets/header_control.dart @@ -2079,7 +2079,6 @@ class HeaderControlState extends State return; } if (await Floating().isPipAvailable) { - plPlayerController.showControls.value = false; if (context.mounted && !videoPlayerServiceHandler!.enableBackgroundPlay) { final theme = Theme.of(context); diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index a67f878be..9209dd28a 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -284,7 +284,11 @@ class PlPlayerController { late bool _shouldSetPip = false; bool get _isCurrVideoPage { - final currentRoute = Get.currentRoute; + final routing = Get.routing; + if (routing.route is! GetPageRoute) { + return false; + } + final currentRoute = routing.current; return currentRoute.startsWith('/video') || currentRoute.startsWith('/liveRoom'); } @@ -297,6 +301,7 @@ class PlPlayerController { void enterPip({bool isAuto = false}) { if (videoController != null) { + controls = false; final state = videoController!.player.state; PageUtils.enterPip( isAuto: isAuto, @@ -546,7 +551,7 @@ class PlPlayerController { if (Platform.isAndroid && autoPiP) { Utils.sdkInt.then((sdkInt) { - if (sdkInt < 31) { + if (sdkInt < 36) { Utils.channel.setMethodCallHandler((call) async { if (call.method == 'onUserLeaveHint') { if (playerStatus.playing && _isCurrVideoPage) {