From 5d35551a007565f468f11f7b1532e5946ddb9578 Mon Sep 17 00:00:00 2001 From: Oleksandr Bezpalchuk Date: Mon, 7 Dec 2020 12:21:11 +0200 Subject: [PATCH] Make public autofocus field of the TextField of message_input --- lib/src/message_input.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index db39345f..fefb5209 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -95,6 +95,7 @@ class MessageInput extends StatefulWidget { this.attachmentThumbnailBuilders, this.inputTextStyle, this.attachmentIconColor, + this.autofocus, }) : super(key: key); /// Message to edit @@ -103,6 +104,9 @@ class MessageInput extends StatefulWidget { /// Message to start with final Message initialMessage; + /// If set true TextField will be active by default. Default is false. + final bool autofocus; + /// Function called after sending the message final void Function(Message) onMessageSent; @@ -258,7 +262,7 @@ class MessageInputState extends State { }); }, style: widget.inputTextStyle ?? Theme.of(context).textTheme.bodyText2, - autofocus: false, + autofocus: widget.autofocus ?? false, decoration: InputDecoration( hintText: 'Write a message', hintStyle: