opt reply check

fix check dyn

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-08-12 16:44:51 +08:00
parent a94493705d
commit 308bd26172
3 changed files with 36 additions and 24 deletions

View File

@@ -82,8 +82,8 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
@override
Future<void> onRefresh() {
cursorNext = null;
paginationReply = null;
subjectControl = null;
paginationReply = null;
return super.onRefresh();
}
@@ -105,6 +105,23 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
});
}
(bool inputDisable, String? hint) get replyHint {
try {
if (subjectControl != null && subjectControl!.hasRootText()) {
if (subjectControl!.inputDisable) {
SmartDialog.showToast(subjectControl!.rootText);
return (true, null);
}
if ((subjectControl!.hasSwitcherType() &&
subjectControl!.switcherType != 1) ||
subjectControl!.rootText.contains('可发评论')) {
return (false, subjectControl!.rootText);
}
}
} catch (_) {}
return (false, null);
}
void onReply(
BuildContext context, {
int? oid,
@@ -117,27 +134,21 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
return;
}
}
assert(replyItem != null || (oid != null && replyType != null));
String? hint;
try {
if (subjectControl != null && subjectControl!.hasRootText()) {
if (subjectControl!.inputDisable) {
SmartDialog.showToast(subjectControl!.rootText);
return;
}
if ((subjectControl!.hasSwitcherType() &&
subjectControl!.switcherType != 1) ||
subjectControl!.rootText.contains('可发评论')) {
hint = subjectControl!.rootText;
}
}
} catch (_) {}
dynamic key = oid ?? replyItem!.oid + replyItem.id;
final (bool inputDisable, String? hint) = replyHint;
if (inputDisable) {
return;
}
final key = oid ?? replyItem!.oid + replyItem.id;
Navigator.of(context)
.push(
GetDialogRoute(
pageBuilder: (buildContext, animation, secondaryAnimation) {
return ReplyPage(
hint: hint,
oid: oid ?? replyItem!.oid.toInt(),
root: oid != null ? 0 : replyItem!.id.toInt(),
parent: oid != null ? 0 : replyItem!.id.toInt(),
@@ -151,7 +162,6 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
savedReplies[key] = reply.toList();
}
},
hint: hint,
);
},
transitionDuration: const Duration(milliseconds: 500),