Wrapped the TextField in a LimitedBox, gavethe MessageInput a new property for that which defaults to 150p
This commit is contained in:
Luis Pulido
2020-04-06 13:08:44 -04:00
parent a2ab455bd4
commit ced6f394a7
+11 -3
View File
@@ -56,12 +56,13 @@ import 'stream_channel.dart';
/// The widget renders the ui based on the first ancestor of type [StreamChatTheme].
/// Modify it to change the widget appearance.
class MessageInput extends StatefulWidget {
MessageInput({
Key key,
MessageInput(
{Key key,
this.onMessageSent,
this.parentMessage,
this.editMessage,
}) : super(key: key);
this.maxHeight = 150})
: super(key: key);
/// Message to edit
final Message editMessage;
@@ -72,6 +73,9 @@ class MessageInput extends StatefulWidget {
/// Parent message in case of a thread
final Message parentMessage;
/// Maximum Height for the TextField to grow before it starts scrolling
final double maxHeight;
@override
_MessageInputState createState() => _MessageInputState();
}
@@ -111,6 +115,7 @@ class _MessageInputState extends State<MessageInput> {
Flex _buildTextField(BuildContext context) {
return Flex(
direction: Axis.horizontal,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
_buildAttachmentButton(),
_buildTextInput(context),
@@ -133,6 +138,8 @@ class _MessageInputState extends State<MessageInput> {
Expanded _buildTextInput(BuildContext context) {
return Expanded(
child: LimitedBox(
maxHeight: widget.maxHeight,
child: TextField(
key: Key('messageInputText'),
minLines: null,
@@ -183,6 +190,7 @@ class _MessageInputState extends State<MessageInput> {
border: InputBorder.none,
),
),
),
);
}