mod: reply2reply: recheck jump index

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-12-23 23:42:43 +08:00
parent 952f1429eb
commit 07d8504f91

View File

@@ -62,6 +62,7 @@ class VideoReplyReplyController extends CommonController
).then((res) { ).then((res) {
if (res['status'] && (res['data']?.mid ?? -1) > 0) { if (res['status'] && (res['data']?.mid ?? -1) > 0) {
firstFloor = res['data']; firstFloor = res['data'];
hasRoot = true;
} }
}); });
} }
@@ -85,7 +86,7 @@ class VideoReplyReplyController extends CommonController
.map((item) => item.id.toInt()) .map((item) => item.id.toInt())
.toList() .toList()
.indexOf(id!); .indexOf(id!);
if (index != -1) { if (index != null && index != -1) {
controller = AnimationController( controller = AnimationController(
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
vsync: this, vsync: this,
@@ -95,13 +96,15 @@ class VideoReplyReplyController extends CommonController
end: Theme.of(Get.context!).colorScheme.surface, end: Theme.of(Get.context!).colorScheme.surface,
).animate(controller!); ).animate(controller!);
WidgetsBinding.instance.addPostFrameCallback((_) async { WidgetsBinding.instance.addPostFrameCallback((_) async {
itemScrollCtr.jumpTo( if (index != null) {
index: hasRoot ? index! + 3 : index! + 1, itemScrollCtr.jumpTo(
alignment: 0.25, index: hasRoot ? index! + 3 : index! + 1,
); alignment: 0.25,
await Future.delayed(const Duration(milliseconds: 800)); );
await controller?.forward(); await Future.delayed(const Duration(milliseconds: 800));
index = null; await controller?.forward();
index = null;
}
}); });
} }
id = null; id = null;
@@ -146,6 +149,7 @@ class VideoReplyReplyController extends CommonController
} else { } else {
if (response.response.root != null) { if (response.response.root != null) {
firstFloor = response.response.root; firstFloor = response.response.root;
hasRoot = true;
} }
List<ReplyItemModel> replies = response.response.replies; List<ReplyItemModel> replies = response.response.replies;
count.value = response.response.page.count; count.value = response.response.page.count;