diff --git a/lib/pages/video/detail/controller.dart b/lib/pages/video/detail/controller.dart index e3e53c2f..c08f5fdf 100644 --- a/lib/pages/video/detail/controller.dart +++ b/lib/pages/video/detail/controller.dart @@ -1,5 +1,7 @@ +import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:pilipala/models/video/reply/item.dart'; +import 'package:pilipala/pages/video/detail/replyReply/index.dart'; class VideoDetailController extends GetxController { int tabInitialIndex = 0; @@ -20,12 +22,14 @@ class VideoDetailController extends GetxController { String heroTag = ''; - RxInt oid = 0.obs; + int oid = 0; // 评论id 请求楼中楼评论使用 - RxInt fRpid = 0.obs; + int fRpid = 0; ReplyItemModel? firstFloor; + final scaffoldKey = GlobalKey(); + @override void onInit() { super.onInit(); @@ -40,4 +44,21 @@ class VideoDetailController extends GetxController { heroTag = Get.arguments['heroTag']; } } + + showReplyReplyPanel() { + PersistentBottomSheetController? ctr = scaffoldKey.currentState?.showBottomSheet((BuildContext context) { + return + VideoReplyReplyPanel( + oid: oid, + rpid: fRpid, + closePanel: ()=> { + fRpid = 0, + }, + firstFloor: firstFloor, + ); + }); + ctr?.closed.then((value) { + fRpid = 0; + }); + } } diff --git a/lib/pages/video/detail/reply/widgets/reply_item.dart b/lib/pages/video/detail/reply/widgets/reply_item.dart index 1eed5827..9f175f67 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item.dart @@ -7,6 +7,7 @@ import 'package:pilipala/models/video/reply/item.dart'; import 'package:pilipala/pages/video/detail/controller.dart'; import 'package:pilipala/pages/video/detail/reply/index.dart'; import 'package:pilipala/pages/video/detail/replyNew/index.dart'; +import 'package:pilipala/pages/video/detail/replyReply/index.dart'; import 'package:pilipala/utils/utils.dart'; class ReplyItem extends StatelessWidget { @@ -248,9 +249,7 @@ class ReplyItem extends StatelessWidget { parent: replyItem!.rpid, ); }, - ).then((value) => { - print('showModalBottomSheet') - }); + ).then((value) => {print('showModalBottomSheet')}); }, ), ), @@ -285,13 +284,12 @@ class ReplyItem extends StatelessWidget { // ignore: must_be_immutable class ReplyItemRow extends StatelessWidget { - ReplyItemRow({ - super.key, - this.replies, - this.replyControl, - this.f_rpid, - this.replyItem - }); + ReplyItemRow( + {super.key, + this.replies, + this.replyControl, + this.f_rpid, + this.replyItem}); List? replies; ReplyControl? replyControl; int? f_rpid; @@ -392,13 +390,12 @@ class ReplyItemRow extends StatelessWidget { void replyReply(replyItem) { // replyItem 楼主评论 - Get.find(tag: Get.arguments['heroTag']) - .oid - .value = replies!.first.oid; - Get.find(tag: Get.arguments['heroTag']) - .fRpid - .value = f_rpid!; - Get.find(tag: Get.arguments['heroTag']).firstFloor = replyItem; + VideoDetailController videoDetailCtr = + Get.find(tag: Get.arguments['heroTag']); + videoDetailCtr.oid = replies!.first.oid; + videoDetailCtr.fRpid = f_rpid!; + videoDetailCtr.firstFloor = replyItem; + videoDetailCtr.showReplyReplyPanel(); } } diff --git a/lib/pages/video/detail/replyReply/controller.dart b/lib/pages/video/detail/replyReply/controller.dart index b36c28c4..83d44cae 100644 --- a/lib/pages/video/detail/replyReply/controller.dart +++ b/lib/pages/video/detail/replyReply/controller.dart @@ -35,6 +35,9 @@ class VideoReplyReplyController extends GetxController { } Future queryReplyList({type = 'init'}) async { + if(type == 'init'){ + currentPage = 0; + } isLoadingMore = true; var res = await ReplyHttp.replyReplyList( oid: aid!, root: rpid!, pageNum: currentPage + 1, type: 1); diff --git a/lib/pages/video/detail/replyReply/view.dart b/lib/pages/video/detail/replyReply/view.dart index db717afc..7535bf60 100644 --- a/lib/pages/video/detail/replyReply/view.dart +++ b/lib/pages/video/detail/replyReply/view.dart @@ -80,6 +80,7 @@ class _VideoReplyReplyPanelState extends State { _videoReplyReplyController.currentPage = 0; _videoReplyReplyController.rPid = 0; widget.closePanel!(); + Navigator.pop(context); }, ), ], diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index ea71b7fc..1b92e1ac 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -19,29 +19,10 @@ class _VideoDetailPageState extends State with TickerProviderStateMixin { final VideoDetailController videoDetailController = Get.put(VideoDetailController(), tag: Get.arguments['heroTag']); - late AnimationController replyAnimationCtl; @override void initState() { super.initState(); - replyAnimationCtl = AnimationController( - vsync: this, duration: const Duration(milliseconds: 300)); - - videoDetailController.fRpid.listen((p0) { - if (p0 != 0) { - showReplyReplyPanel(); - } - }); - } - - showReplyReplyPanel() { - replyAnimationCtl.forward(); - } - - hiddenReplyReplyPanel() { - replyAnimationCtl.reverse().then((value) { - videoDetailController.fRpid.value = 0; - }); } @override @@ -59,6 +40,7 @@ class _VideoDetailPageState extends State child: Stack( children: [ Scaffold( + key: videoDetailController.scaffoldKey, body: ExtendedNestedScrollView( headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { @@ -163,30 +145,6 @@ class _VideoDetailPageState extends State ), ), ), - Positioned( - bottom: 0, - left: 0, - right: 0, - child: SlideTransition( - position: Tween( - begin: const Offset(0, 2), - end: const Offset(0, 0), - ).animate(CurvedAnimation( - parent: replyAnimationCtl, - curve: Curves.easeInOut, - )), - child: Obx( - () => videoDetailController.fRpid.value != 0 - ? VideoReplyReplyPanel( - oid: videoDetailController.oid.value, - rpid: videoDetailController.fRpid.value, - closePanel: hiddenReplyReplyPanel, - firstFloor: videoDetailController.firstFloor, - ) - : const SizedBox(), - ), - ), - ), ], ), ),