mod: 评论页弹框高度

This commit is contained in:
guozhigq
2023-07-15 18:25:10 +08:00
parent c7b67c3a10
commit a23103eb69
5 changed files with 27 additions and 13 deletions

View File

@ -73,7 +73,7 @@ class VideoDetailController extends GetxController
queryVideoUrl(); queryVideoUrl();
} }
showReplyReplyPanel() { showReplyReplyPanel(paddingTop) {
PersistentBottomSheetController<void>? ctr = PersistentBottomSheetController<void>? ctr =
scaffoldKey.currentState?.showBottomSheet<void>((BuildContext context) { scaffoldKey.currentState?.showBottomSheet<void>((BuildContext context) {
return VideoReplyReplyPanel( return VideoReplyReplyPanel(
@ -83,6 +83,7 @@ class VideoDetailController extends GetxController
fRpid = 0, fRpid = 0,
}, },
firstFloor: firstFloor, firstFloor: firstFloor,
paddingTop: paddingTop,
); );
}); });
ctr?.closed.then((value) { ctr?.closed.then((value) {

View File

@ -122,6 +122,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double paddingTop = MediaQuery.of(context).padding.top;
return RefreshIndicator( return RefreshIndicator(
onRefresh: () async { onRefresh: () async {
setState(() {}); setState(() {});
@ -212,12 +213,13 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: (builder) { builder: (BuildContext context) {
return VideoReplyNewDialog( return VideoReplyNewDialog(
replyLevel: '0', replyLevel: '0',
oid: IdUtils.bv2av(Get.parameters['bvid']!), oid: IdUtils.bv2av(Get.parameters['bvid']!),
root: 0, root: 0,
parent: 0, parent: 0,
paddingTop: paddingTop,
); );
}, },
).then( ).then(

View File

@ -222,6 +222,7 @@ class ReplyItem extends StatelessWidget {
// 感谢、回复、复制 // 感谢、回复、复制
Widget bottonAction(context, replyControl) { Widget bottonAction(context, replyControl) {
var color = Theme.of(context).colorScheme.outline; var color = Theme.of(context).colorScheme.outline;
double paddingTop = MediaQuery.of(context).padding.top;
return Row( return Row(
children: [ children: [
const SizedBox(width: 48), const SizedBox(width: 48),
@ -271,11 +272,11 @@ class ReplyItem extends StatelessWidget {
isScrollControlled: true, isScrollControlled: true,
builder: (builder) { builder: (builder) {
return VideoReplyNewDialog( return VideoReplyNewDialog(
replyLevel: replyLevel, replyLevel: replyLevel,
oid: replyItem!.oid, oid: replyItem!.oid,
root: replyItem!.rpid, root: replyItem!.rpid,
parent: replyItem!.rpid, parent: replyItem!.rpid,
); paddingTop: paddingTop);
}, },
).then((value) => { ).then((value) => {
// 完成评论,数据添加 // 完成评论,数据添加
@ -346,7 +347,8 @@ class ReplyItemRow extends StatelessWidget {
children: [ children: [
for (var i = 0; i < replies!.length; i++) ...[ for (var i = 0; i < replies!.length; i++) ...[
InkWell( InkWell(
onTap: () => replyReply(replyItem), onTap: () =>
replyReply(replyItem, MediaQuery.of(context).padding.top),
child: Container( child: Container(
width: double.infinity, width: double.infinity,
padding: EdgeInsets.fromLTRB( padding: EdgeInsets.fromLTRB(
@ -396,7 +398,8 @@ class ReplyItemRow extends StatelessWidget {
], ],
if (extraRow == 1) if (extraRow == 1)
InkWell( InkWell(
onTap: () => replyReply(replyItem), onTap: () =>
replyReply(replyItem, MediaQuery.of(context).padding.top),
child: Container( child: Container(
width: double.infinity, width: double.infinity,
padding: const EdgeInsets.fromLTRB(8, 5, 8, 8), padding: const EdgeInsets.fromLTRB(8, 5, 8, 8),
@ -426,14 +429,14 @@ class ReplyItemRow extends StatelessWidget {
); );
} }
void replyReply(replyItem) { void replyReply(replyItem, paddingTop) {
// replyItem 楼主评论 // replyItem 楼主评论
VideoDetailController videoDetailCtr = VideoDetailController videoDetailCtr =
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']); Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
videoDetailCtr.oid = replies!.first.oid; videoDetailCtr.oid = replies!.first.oid;
videoDetailCtr.fRpid = f_rpid!; videoDetailCtr.fRpid = f_rpid!;
videoDetailCtr.firstFloor = replyItem; videoDetailCtr.firstFloor = replyItem;
videoDetailCtr.showReplyReplyPanel(); videoDetailCtr.showReplyReplyPanel(paddingTop);
} }
} }

View File

@ -12,12 +12,14 @@ class VideoReplyNewDialog extends StatefulWidget {
int? root; int? root;
String? replyLevel; String? replyLevel;
int? parent; int? parent;
double? paddingTop;
VideoReplyNewDialog({ VideoReplyNewDialog({
this.oid, this.oid,
this.root, this.root,
this.replyLevel, this.replyLevel,
this.parent, this.parent,
this.paddingTop,
}); });
@override @override
@ -97,10 +99,11 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
print('1111111');
return Container( return Container(
height: MediaQuery.of(context).size.height - height: MediaQuery.of(context).size.height -
MediaQuery.of(context).size.width * 9 / 16 - MediaQuery.of(context).size.width * 9 / 16 -
45, widget.paddingTop!,
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(

View File

@ -12,11 +12,14 @@ class VideoReplyReplyPanel extends StatefulWidget {
int? rpid; int? rpid;
Function? closePanel; Function? closePanel;
ReplyItemModel? firstFloor; ReplyItemModel? firstFloor;
double? paddingTop;
VideoReplyReplyPanel({ VideoReplyReplyPanel({
this.oid, this.oid,
this.rpid, this.rpid,
this.closePanel, this.closePanel,
this.firstFloor, this.firstFloor,
this.paddingTop,
super.key, super.key,
}); });
@ -59,7 +62,9 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
height: Get.size.height - Get.size.width * 9 / 16 - 45, height: MediaQuery.of(context).size.height -
MediaQuery.of(context).size.width * 9 / 16 -
widget.paddingTop!,
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.background,
child: Column( child: Column(
children: [ children: [