cleanup
This commit is contained in:
+14
-16
@@ -139,10 +139,7 @@ class MessageInput extends StatefulWidget {
|
|||||||
final Map<String, AttachmentThumbnailBuilder> attachmentThumbnailBuilder;
|
final Map<String, AttachmentThumbnailBuilder> attachmentThumbnailBuilder;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
MessageInputState createState() => MessageInputState(
|
MessageInputState createState() => MessageInputState();
|
||||||
doFileUploadRequest: doFileUploadRequest,
|
|
||||||
doImageUploadRequest: doImageUploadRequest,
|
|
||||||
);
|
|
||||||
|
|
||||||
/// Use this method to get the current [StreamChatState] instance
|
/// Use this method to get the current [StreamChatState] instance
|
||||||
static MessageInputState of(BuildContext context) {
|
static MessageInputState of(BuildContext context) {
|
||||||
@@ -163,22 +160,14 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
final List<_SendingAttachment> _attachments = [];
|
final List<_SendingAttachment> _attachments = [];
|
||||||
final _focusNode = FocusNode();
|
final _focusNode = FocusNode();
|
||||||
final List<User> _mentionedUsers = [];
|
final List<User> _mentionedUsers = [];
|
||||||
FileUploader doImageUploadRequest;
|
|
||||||
FileUploader doFileUploadRequest;
|
|
||||||
|
|
||||||
TextEditingController textEditingController;
|
|
||||||
bool _inputEnabled = true;
|
bool _inputEnabled = true;
|
||||||
bool _messageIsPresent = false;
|
bool _messageIsPresent = false;
|
||||||
bool _typingStarted = false;
|
bool _typingStarted = false;
|
||||||
OverlayEntry _commandsOverlay, _mentionsOverlay;
|
OverlayEntry _commandsOverlay, _mentionsOverlay;
|
||||||
|
|
||||||
MessageInputState({
|
/// The editing controller passed to the input TextField
|
||||||
this.doImageUploadRequest,
|
TextEditingController textEditingController;
|
||||||
this.doFileUploadRequest,
|
|
||||||
}) {
|
|
||||||
doImageUploadRequest ??= _uploadImage;
|
|
||||||
doFileUploadRequest ??= _uploadFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -613,6 +602,7 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Show the attachment modal, making the user choose where to pick a media from
|
||||||
void showAttachmentModal() {
|
void showAttachmentModal() {
|
||||||
if (_focusNode.hasFocus) {
|
if (_focusNode.hasFocus) {
|
||||||
_focusNode.unfocus();
|
_focusNode.unfocus();
|
||||||
@@ -778,9 +768,17 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
) async {
|
) async {
|
||||||
String url;
|
String url;
|
||||||
if (type == DefaultAttachmentTypes.image) {
|
if (type == DefaultAttachmentTypes.image) {
|
||||||
url = await doImageUploadRequest(file, channel);
|
if (widget.doImageUploadRequest != null) {
|
||||||
|
url = await widget.doImageUploadRequest(file, channel);
|
||||||
|
} else {
|
||||||
|
url = await _uploadImage(file, channel);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
url = await doFileUploadRequest(file, channel);
|
if (widget.doFileUploadRequest != null) {
|
||||||
|
url = await widget.doFileUploadRequest(file, channel);
|
||||||
|
} else {
|
||||||
|
url = await _uploadFile(file, channel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user