diff --git a/lib/pages/common/reply_controller.dart b/lib/pages/common/reply_controller.dart index 1091f0b15..f5e19c3f7 100644 --- a/lib/pages/common/reply_controller.dart +++ b/lib/pages/common/reply_controller.dart @@ -28,6 +28,7 @@ abstract class ReplyController extends CommonListController { Int64? upMid; Int64? cursorNext; + SubjectControl? subjectControl; FeedPaginationReply? paginationReply; late Rx mode = Mode.MAIN_LIST_HOT.obs; late bool hasUpTop = false; @@ -73,6 +74,7 @@ abstract class ReplyController extends CommonListController { paginationReply = data.paginationReply; count.value = data.subjectControl.count.toInt(); if (isRefresh) { + subjectControl = data.subjectControl; upMid ??= data.subjectControl.upMid; hasUpTop = data.hasUpTop(); if (data.hasUpTop()) { @@ -87,6 +89,7 @@ abstract class ReplyController extends CommonListController { Future onRefresh() { cursorNext = null; paginationReply = null; + subjectControl = null; return super.onRefresh(); } @@ -118,13 +121,11 @@ abstract class ReplyController extends CommonListController { assert(replyItem != null || (oid != null && replyType != null)); String? hint; try { - if (loadingState.value is Success) { - SubjectControl subjectControl = - (loadingState.value as Success).response.subjectControl; - if (subjectControl.hasSwitcherType() && - subjectControl.switcherType != 1 && - subjectControl.hasRootText()) { - hint = subjectControl.rootText; + if (subjectControl != null) { + if (subjectControl!.hasSwitcherType() && + subjectControl!.switcherType != 1 && + subjectControl!.hasRootText()) { + hint = subjectControl!.rootText; } } } catch (_) {} @@ -224,7 +225,13 @@ abstract class ReplyController extends CommonListController { ); } - Future onToggleTop(index, oid, int type, bool isUpTop, int rpid) async { + Future onToggleTop( + int index, + oid, + int type, + bool isUpTop, + int rpid, + ) async { final res = await ReplyHttp.replyTop( oid: oid, type: type,