mod: 更多回复展示逻辑
This commit is contained in:
@ -1,5 +1,7 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/models/video/reply/item.dart';
|
import 'package:pilipala/models/video/reply/item.dart';
|
||||||
|
import 'package:pilipala/pages/video/detail/replyReply/index.dart';
|
||||||
|
|
||||||
class VideoDetailController extends GetxController {
|
class VideoDetailController extends GetxController {
|
||||||
int tabInitialIndex = 0;
|
int tabInitialIndex = 0;
|
||||||
@ -20,12 +22,14 @@ class VideoDetailController extends GetxController {
|
|||||||
|
|
||||||
String heroTag = '';
|
String heroTag = '';
|
||||||
|
|
||||||
RxInt oid = 0.obs;
|
int oid = 0;
|
||||||
// 评论id 请求楼中楼评论使用
|
// 评论id 请求楼中楼评论使用
|
||||||
RxInt fRpid = 0.obs;
|
int fRpid = 0;
|
||||||
|
|
||||||
ReplyItemModel? firstFloor;
|
ReplyItemModel? firstFloor;
|
||||||
|
|
||||||
|
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
@ -40,4 +44,21 @@ class VideoDetailController extends GetxController {
|
|||||||
heroTag = Get.arguments['heroTag'];
|
heroTag = Get.arguments['heroTag'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showReplyReplyPanel() {
|
||||||
|
PersistentBottomSheetController<void>? ctr = scaffoldKey.currentState?.showBottomSheet<void>((BuildContext context) {
|
||||||
|
return
|
||||||
|
VideoReplyReplyPanel(
|
||||||
|
oid: oid,
|
||||||
|
rpid: fRpid,
|
||||||
|
closePanel: ()=> {
|
||||||
|
fRpid = 0,
|
||||||
|
},
|
||||||
|
firstFloor: firstFloor,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
ctr?.closed.then((value) {
|
||||||
|
fRpid = 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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/controller.dart';
|
||||||
import 'package:pilipala/pages/video/detail/reply/index.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/replyNew/index.dart';
|
||||||
|
import 'package:pilipala/pages/video/detail/replyReply/index.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
class ReplyItem extends StatelessWidget {
|
class ReplyItem extends StatelessWidget {
|
||||||
@ -248,9 +249,7 @@ class ReplyItem extends StatelessWidget {
|
|||||||
parent: replyItem!.rpid,
|
parent: replyItem!.rpid,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
).then((value) => {
|
).then((value) => {print('showModalBottomSheet')});
|
||||||
print('showModalBottomSheet')
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -285,13 +284,12 @@ class ReplyItem extends StatelessWidget {
|
|||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class ReplyItemRow extends StatelessWidget {
|
class ReplyItemRow extends StatelessWidget {
|
||||||
ReplyItemRow({
|
ReplyItemRow(
|
||||||
super.key,
|
{super.key,
|
||||||
this.replies,
|
this.replies,
|
||||||
this.replyControl,
|
this.replyControl,
|
||||||
this.f_rpid,
|
this.f_rpid,
|
||||||
this.replyItem
|
this.replyItem});
|
||||||
});
|
|
||||||
List? replies;
|
List? replies;
|
||||||
ReplyControl? replyControl;
|
ReplyControl? replyControl;
|
||||||
int? f_rpid;
|
int? f_rpid;
|
||||||
@ -392,13 +390,12 @@ class ReplyItemRow extends StatelessWidget {
|
|||||||
|
|
||||||
void replyReply(replyItem) {
|
void replyReply(replyItem) {
|
||||||
// replyItem 楼主评论
|
// replyItem 楼主评论
|
||||||
Get.find<VideoDetailController>(tag: Get.arguments['heroTag'])
|
VideoDetailController videoDetailCtr =
|
||||||
.oid
|
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
|
||||||
.value = replies!.first.oid;
|
videoDetailCtr.oid = replies!.first.oid;
|
||||||
Get.find<VideoDetailController>(tag: Get.arguments['heroTag'])
|
videoDetailCtr.fRpid = f_rpid!;
|
||||||
.fRpid
|
videoDetailCtr.firstFloor = replyItem;
|
||||||
.value = f_rpid!;
|
videoDetailCtr.showReplyReplyPanel();
|
||||||
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']).firstFloor = replyItem;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,9 @@ class VideoReplyReplyController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future queryReplyList({type = 'init'}) async {
|
Future queryReplyList({type = 'init'}) async {
|
||||||
|
if(type == 'init'){
|
||||||
|
currentPage = 0;
|
||||||
|
}
|
||||||
isLoadingMore = true;
|
isLoadingMore = true;
|
||||||
var res = await ReplyHttp.replyReplyList(
|
var res = await ReplyHttp.replyReplyList(
|
||||||
oid: aid!, root: rpid!, pageNum: currentPage + 1, type: 1);
|
oid: aid!, root: rpid!, pageNum: currentPage + 1, type: 1);
|
||||||
|
@ -80,6 +80,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
|||||||
_videoReplyReplyController.currentPage = 0;
|
_videoReplyReplyController.currentPage = 0;
|
||||||
_videoReplyReplyController.rPid = 0;
|
_videoReplyReplyController.rPid = 0;
|
||||||
widget.closePanel!();
|
widget.closePanel!();
|
||||||
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -19,29 +19,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
with TickerProviderStateMixin {
|
with TickerProviderStateMixin {
|
||||||
final VideoDetailController videoDetailController =
|
final VideoDetailController videoDetailController =
|
||||||
Get.put(VideoDetailController(), tag: Get.arguments['heroTag']);
|
Get.put(VideoDetailController(), tag: Get.arguments['heroTag']);
|
||||||
late AnimationController replyAnimationCtl;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.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
|
@override
|
||||||
@ -59,6 +40,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Scaffold(
|
Scaffold(
|
||||||
|
key: videoDetailController.scaffoldKey,
|
||||||
body: ExtendedNestedScrollView(
|
body: ExtendedNestedScrollView(
|
||||||
headerSliverBuilder:
|
headerSliverBuilder:
|
||||||
(BuildContext context, bool innerBoxIsScrolled) {
|
(BuildContext context, bool innerBoxIsScrolled) {
|
||||||
@ -163,30 +145,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
|
||||||
bottom: 0,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
child: SlideTransition(
|
|
||||||
position: Tween<Offset>(
|
|
||||||
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(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user