MessageInput class

Inactive state screenshot screenshot Focused state screenshot screenshot

Widget used to enter the message and add attachments

class ChannelPage extends StatelessWidget {
  const ChannelPage({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: ChannelHeader(),
      body: Column(
        children: <Widget>[
          Expanded(
            child: MessageListView(
              threadBuilder: (_, parentMessage) {
                return ThreadPage(
                  parent: parentMessage,
                );
              },
            ),
          ),
          MessageInput(),
        ],
      ),
    );
  }
}

You usually put this widget in the same page of a MessageListView as the bottom widget.

The widget renders the ui based on the first ancestor of type StreamChatTheme. Modify it to change the widget appearance.

Constructors

MessageInput({Key key, void onMessageSent(Message), FutureOr<Message> preMessageSending(Message), Message parentMessage, Message editMessage, double maxHeight = 150, TextInputType keyboardType = TextInputType.multiline, bool disableAttachments = false, FileUploader doImageUploadRequest, FileUploader doFileUploadRequest, Message initialMessage, TextEditingController textEditingController, List<Widget> actions, ActionsLocation actionsLocation = ActionsLocation.left, Map<String, AttachmentThumbnailBuilder> attachmentThumbnailBuilders, TextStyle inputTextStyle, Color attachmentIconColor, bool autofocus = false, SendButtonLocation sendButtonLocation = SendButtonLocation.inside, Duration animationDuration = const Duration(milliseconds: 300)})
Instantiate a new MessageInput

Properties

actions → List<Widget>
List of action widgets
final
actionsLocation ActionsLocation
The location of the custom actions
final
animationDuration → Duration
The duration of the send button animation
final
attachmentIconColor → Color
Color used for attachment icon.
final
attachmentThumbnailBuilders → Map<String, AttachmentThumbnailBuilder>
Map that defines a thumbnail builder for an attachment type
final
autofocus → bool
If set true TextField will be active by default. Default is false.
final
disableAttachments → bool
If true the attachments button will not be displayed
final
doFileUploadRequest FileUploader
Override file upload request
final
doImageUploadRequest FileUploader
Override image upload request
final
editMessage Message
Message to edit
final
hashCode → int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
initialMessage Message
Message to start with
final
inputTextStyle → TextStyle
Text style used in message text field. If null, MessageInput uses Theme.of(context).textTheme.bodyText2.
final
key → Key
Controls how one widget replaces another widget in the tree. [...]
final, inherited
keyboardType → TextInputType
The keyboard type assigned to the TextField
final
maxHeight → double
Maximum Height for the TextField to grow before it starts scrolling
final
onMessageSent → void Function(Message)
Function called after sending the message
final
parentMessage Message
Parent message in case of a thread
final
preMessageSending → FutureOr<Message> Function(Message)
Function called right before sending the message Use this to transform the message
final
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited
sendButtonLocation SendButtonLocation
The location of the send button
final
textEditingController → TextEditingController
The text controller of the TextField
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree. [...]
inherited
createState() MessageInputState
Creates the mutable state for this widget at a given location in the tree. [...]
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toDiagnosticsNode({String name, DiagnosticsTreeStyle style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
Returns a string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a string representation of this node and its descendants. [...]
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object. [...]
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) → bool
The equality operator. [...]
@nonVirtual, inherited

Static Methods

of(BuildContext context) MessageInputState
Use this method to get the current StreamChatState instance