diff --git a/packages/stream_chat_flutter/lib/src/message_input.dart b/packages/stream_chat_flutter/lib/src/message_input.dart index 19a6592d..240d318a 100644 --- a/packages/stream_chat_flutter/lib/src/message_input.dart +++ b/packages/stream_chat_flutter/lib/src/message_input.dart @@ -195,7 +195,6 @@ class MessageInput extends StatefulWidget { this.customOverlays = const [], this.mentionAllAppUsers = false, this.shouldKeepFocusAfterMessage, - this.autocorrectEnabled, }) : assert( initialMessage == null || editMessage == null, "Can't provide both `initialMessage` and `editMessage`", @@ -312,8 +311,6 @@ class MessageInput extends StatefulWidget { /// The default behaviour keeps focus until a command is enabled. final bool? shouldKeepFocusAfterMessage; - final bool? autocorrectEnabled; - @override MessageInputState createState() => MessageInputState(); @@ -701,7 +698,6 @@ class MessageInputState extends State { textAlignVertical: TextAlignVertical.center, decoration: _getInputDecoration(context), textCapitalization: TextCapitalization.sentences, - autocorrect: widget.autocorrectEnabled ?? true, ), ), ], diff --git a/packages/stream_chat_flutter/lib/src/message_input/message_input.dart b/packages/stream_chat_flutter/lib/src/message_input/message_input.dart index 0ffa472c..7116e435 100644 --- a/packages/stream_chat_flutter/lib/src/message_input/message_input.dart +++ b/packages/stream_chat_flutter/lib/src/message_input/message_input.dart @@ -213,6 +213,7 @@ class StreamMessageInput extends StatefulWidget { this.enableSafeArea, this.elevation, this.shadow, + this.autoCorrect, }) : super(key: key); /// List of options for showing overlays. @@ -332,6 +333,10 @@ class StreamMessageInput extends StatefulWidget { /// Shadow for the [StreamMessageInput] widget final BoxShadow? shadow; + /// Disable autoCorrect by passing false + /// autoCorrect is enabled by default + final bool? autoCorrect; + static bool _defaultValidator(Message message) => message.text?.isNotEmpty == true || message.attachments.isNotEmpty; @@ -363,6 +368,8 @@ class StreamMessageInputState extends State bool get _isEditing => _effectiveController.value.status != MessageSendingStatus.sending; + bool get _autoCorrect => widget.autoCorrect ?? true; + RestorableMessageInputController? _controller; MessageInputController get _effectiveController => @@ -805,6 +812,7 @@ class StreamMessageInputState extends State textAlignVertical: TextAlignVertical.center, decoration: _getInputDecoration(context), textCapitalization: TextCapitalization.sentences, + autocorrect: _autoCorrect, ), ), ], diff --git a/packages/stream_chat_flutter/lib/src/message_list_view.dart b/packages/stream_chat_flutter/lib/src/message_list_view.dart index e7b2d215..1439dfb3 100644 --- a/packages/stream_chat_flutter/lib/src/message_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/message_list_view.dart @@ -248,6 +248,20 @@ class StreamMessageListView extends StatefulWidget { /// messages and the scroll offset is not zero final bool showScrollToBottom; + /// Function used to build a custom scroll to bottom widget + /// + /// Provides the current unread messages count and a reference + /// to the function that is executed on tap of this widget by default + /// + /// As an example: + /// MessageListView( + /// scrollToBottomBuilder: (unreadCount, defaultTapAction) { + /// return InkWell( + /// onTap: () => defaultTapAction(unreadCount), + /// child: Text('Scroll To Bottom'), + /// ); + /// }, + /// ), final Widget Function( int unreadCount, Future Function(int) scrollToBottomDefaultTapAction,