mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
check uploadPictureIconState
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import 'package:PiliPlus/common/widgets/text_field/controller.dart';
|
import 'package:PiliPlus/common/widgets/text_field/controller.dart';
|
||||||
import 'package:PiliPlus/grpc/bilibili/main/community/reply/v1.pb.dart'
|
import 'package:PiliPlus/grpc/bilibili/main/community/reply/v1.pb.dart'
|
||||||
show MainListReply, ReplyInfo, SubjectControl, Mode;
|
show MainListReply, ReplyInfo, SubjectControl, Mode, EditorIconState;
|
||||||
import 'package:PiliPlus/grpc/bilibili/pagination.pb.dart';
|
import 'package:PiliPlus/grpc/bilibili/pagination.pb.dart';
|
||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
import 'package:PiliPlus/http/reply.dart';
|
import 'package:PiliPlus/http/reply.dart';
|
||||||
@@ -101,8 +101,11 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
|
|||||||
onReload();
|
onReload();
|
||||||
}
|
}
|
||||||
|
|
||||||
(bool inputDisable, String? hint) get replyHint {
|
(bool inputDisable, bool canUploadPic, String? hint) get replyHint {
|
||||||
bool inputDisable = false;
|
bool inputDisable = false;
|
||||||
|
bool canUploadPic =
|
||||||
|
subjectControl?.uploadPictureIconState !=
|
||||||
|
EditorIconState.EditorIconState_DISABLE;
|
||||||
String? hint;
|
String? hint;
|
||||||
try {
|
try {
|
||||||
if (subjectControl != null && subjectControl!.hasRootText()) {
|
if (subjectControl != null && subjectControl!.hasRootText()) {
|
||||||
@@ -116,7 +119,7 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
return (inputDisable, hint);
|
return (inputDisable, canUploadPic, hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onReply(
|
void onReply(
|
||||||
@@ -135,7 +138,7 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
|
|||||||
|
|
||||||
assert(replyItem != null || (oid != null && replyType != null));
|
assert(replyItem != null || (oid != null && replyType != null));
|
||||||
|
|
||||||
final (bool inputDisable, String? hint) = replyHint;
|
final (bool inputDisable, bool canUploadPic, String? hint) = replyHint;
|
||||||
if (inputDisable) {
|
if (inputDisable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -153,6 +156,7 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
|
|||||||
replyType: replyItem?.type.toInt() ?? replyType!,
|
replyType: replyItem?.type.toInt() ?? replyType!,
|
||||||
replyItem: replyItem,
|
replyItem: replyItem,
|
||||||
items: savedReplies[key],
|
items: savedReplies[key],
|
||||||
|
canUploadPic: canUploadPic,
|
||||||
onSave: (reply) {
|
onSave: (reply) {
|
||||||
if (reply.isEmpty) {
|
if (reply.isEmpty) {
|
||||||
savedReplies.remove(key);
|
savedReplies.remove(key);
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class ReplyPage extends CommonRichTextPubPage {
|
|||||||
final int replyType;
|
final int replyType;
|
||||||
final ReplyInfo? replyItem;
|
final ReplyInfo? replyItem;
|
||||||
final String? hint;
|
final String? hint;
|
||||||
|
final bool canUploadPic;
|
||||||
|
|
||||||
const ReplyPage({
|
const ReplyPage({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -45,6 +46,7 @@ class ReplyPage extends CommonRichTextPubPage {
|
|||||||
required this.replyType,
|
required this.replyType,
|
||||||
this.replyItem,
|
this.replyItem,
|
||||||
this.hint,
|
this.hint,
|
||||||
|
this.canUploadPic = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -183,8 +185,12 @@ class _ReplyPageState extends CommonRichTextPubPageState<ReplyPage> {
|
|||||||
ToolbarIconButton(
|
ToolbarIconButton(
|
||||||
tooltip: '图片',
|
tooltip: '图片',
|
||||||
selected: false,
|
selected: false,
|
||||||
icon: const Icon(Icons.image, size: 22),
|
icon: widget.canUploadPic
|
||||||
onPressed: onPickImage,
|
? const Icon(Icons.image, size: 22)
|
||||||
|
: const Icon(Icons.image_not_supported, size: 22),
|
||||||
|
onPressed: widget.canUploadPic
|
||||||
|
? onPickImage
|
||||||
|
: () => SmartDialog.showToast('当前评论区不支持发送图片'),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ class VideoReplyReplyController extends ReplyController
|
|||||||
}) {
|
}) {
|
||||||
assert(replyItem != null && index != null);
|
assert(replyItem != null && index != null);
|
||||||
|
|
||||||
final (bool inputDisable, String? hint) = replyHint;
|
final (bool inputDisable, bool canUploadPic, String? hint) = replyHint;
|
||||||
if (inputDisable) {
|
if (inputDisable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user