Added option to disable mentions overlay, made autoCorrect and disable emoji and mentions flags non-nullable
This commit is contained in:
@@ -207,8 +207,9 @@ class StreamMessageInput extends StatefulWidget {
|
|||||||
this.enableSafeArea,
|
this.enableSafeArea,
|
||||||
this.elevation,
|
this.elevation,
|
||||||
this.shadow,
|
this.shadow,
|
||||||
this.autoCorrect,
|
this.autoCorrect = true,
|
||||||
this.disableEmojiSuggestionsOverlay,
|
this.disableEmojiSuggestionsOverlay = false,
|
||||||
|
this.disableMentionsOverlay = false,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
/// List of options for showing overlays.
|
/// List of options for showing overlays.
|
||||||
@@ -327,11 +328,15 @@ class StreamMessageInput extends StatefulWidget {
|
|||||||
|
|
||||||
/// Disable autoCorrect by passing false
|
/// Disable autoCorrect by passing false
|
||||||
/// autoCorrect is enabled by default
|
/// autoCorrect is enabled by default
|
||||||
final bool? autoCorrect;
|
final bool autoCorrect;
|
||||||
|
|
||||||
/// Disable the default emoji suggestions
|
/// Disable the default emoji suggestions
|
||||||
/// Enabled by default
|
/// Enabled by default
|
||||||
final bool? disableEmojiSuggestionsOverlay;
|
final bool disableEmojiSuggestionsOverlay;
|
||||||
|
|
||||||
|
/// Disable the mentions overlay
|
||||||
|
/// Enabled by default
|
||||||
|
final bool disableMentionsOverlay;
|
||||||
|
|
||||||
static bool _defaultValidator(Message message) =>
|
static bool _defaultValidator(Message message) =>
|
||||||
message.text?.isNotEmpty == true || message.attachments.isNotEmpty;
|
message.text?.isNotEmpty == true || message.attachments.isNotEmpty;
|
||||||
@@ -364,11 +369,6 @@ class StreamMessageInputState extends State<StreamMessageInput>
|
|||||||
bool get _isEditing =>
|
bool get _isEditing =>
|
||||||
_effectiveController.value.status != MessageSendingStatus.sending;
|
_effectiveController.value.status != MessageSendingStatus.sending;
|
||||||
|
|
||||||
bool get _autoCorrect => widget.autoCorrect ?? true;
|
|
||||||
|
|
||||||
bool get _disableEmojiSuggestionsOverlay =>
|
|
||||||
widget.disableEmojiSuggestionsOverlay ?? false;
|
|
||||||
|
|
||||||
StreamRestorableMessageInputController? _controller;
|
StreamRestorableMessageInputController? _controller;
|
||||||
|
|
||||||
StreamMessageInputController get _effectiveController =>
|
StreamMessageInputController get _effectiveController =>
|
||||||
@@ -598,7 +598,7 @@ class StreamMessageInputState extends State<StreamMessageInput>
|
|||||||
visible: _showCommandsOverlay,
|
visible: _showCommandsOverlay,
|
||||||
widget: _buildCommandsOverlayEntry(),
|
widget: _buildCommandsOverlayEntry(),
|
||||||
),
|
),
|
||||||
if (!_disableEmojiSuggestionsOverlay)
|
if (!widget.disableEmojiSuggestionsOverlay)
|
||||||
OverlayOptions(
|
OverlayOptions(
|
||||||
visible: _focusNode.hasFocus &&
|
visible: _focusNode.hasFocus &&
|
||||||
_effectiveController.text.isNotEmpty &&
|
_effectiveController.text.isNotEmpty &&
|
||||||
@@ -611,10 +611,11 @@ class StreamMessageInputState extends State<StreamMessageInput>
|
|||||||
.contains(':'),
|
.contains(':'),
|
||||||
widget: _buildEmojiOverlay(),
|
widget: _buildEmojiOverlay(),
|
||||||
),
|
),
|
||||||
OverlayOptions(
|
if (!widget.disableMentionsOverlay)
|
||||||
visible: _showMentionsOverlay,
|
OverlayOptions(
|
||||||
widget: _buildMentionsOverlayEntry(),
|
visible: _showMentionsOverlay,
|
||||||
),
|
widget: _buildMentionsOverlayEntry(),
|
||||||
|
),
|
||||||
...widget.customOverlays,
|
...widget.customOverlays,
|
||||||
],
|
],
|
||||||
child: child,
|
child: child,
|
||||||
@@ -813,7 +814,7 @@ class StreamMessageInputState extends State<StreamMessageInput>
|
|||||||
textAlignVertical: TextAlignVertical.center,
|
textAlignVertical: TextAlignVertical.center,
|
||||||
decoration: _getInputDecoration(context),
|
decoration: _getInputDecoration(context),
|
||||||
textCapitalization: TextCapitalization.sentences,
|
textCapitalization: TextCapitalization.sentences,
|
||||||
autocorrect: _autoCorrect,
|
autocorrect: widget.autoCorrect,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user