Add flag to control if default emoji suggestions overlay is visible
This commit is contained in:
@@ -214,6 +214,7 @@ class StreamMessageInput extends StatefulWidget {
|
|||||||
this.elevation,
|
this.elevation,
|
||||||
this.shadow,
|
this.shadow,
|
||||||
this.autoCorrect,
|
this.autoCorrect,
|
||||||
|
this.disableEmojiSuggestionsOverlay,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
/// List of options for showing overlays.
|
/// List of options for showing overlays.
|
||||||
@@ -337,6 +338,10 @@ class StreamMessageInput extends StatefulWidget {
|
|||||||
/// autoCorrect is enabled by default
|
/// autoCorrect is enabled by default
|
||||||
final bool? autoCorrect;
|
final bool? autoCorrect;
|
||||||
|
|
||||||
|
/// Disable the default emoji suggestions
|
||||||
|
/// Enabled by default
|
||||||
|
final bool? disableEmojiSuggestionsOverlay;
|
||||||
|
|
||||||
static bool _defaultValidator(Message message) =>
|
static bool _defaultValidator(Message message) =>
|
||||||
message.text?.isNotEmpty == true || message.attachments.isNotEmpty;
|
message.text?.isNotEmpty == true || message.attachments.isNotEmpty;
|
||||||
|
|
||||||
@@ -370,6 +375,9 @@ class StreamMessageInputState extends State<StreamMessageInput>
|
|||||||
|
|
||||||
bool get _autoCorrect => widget.autoCorrect ?? true;
|
bool get _autoCorrect => widget.autoCorrect ?? true;
|
||||||
|
|
||||||
|
bool get _disableEmojiSuggestionsOverlay =>
|
||||||
|
widget.disableEmojiSuggestionsOverlay ?? false;
|
||||||
|
|
||||||
RestorableMessageInputController? _controller;
|
RestorableMessageInputController? _controller;
|
||||||
|
|
||||||
MessageInputController get _effectiveController =>
|
MessageInputController get _effectiveController =>
|
||||||
@@ -599,18 +607,19 @@ class StreamMessageInputState extends State<StreamMessageInput>
|
|||||||
visible: _showCommandsOverlay,
|
visible: _showCommandsOverlay,
|
||||||
widget: _buildCommandsOverlayEntry(),
|
widget: _buildCommandsOverlayEntry(),
|
||||||
),
|
),
|
||||||
OverlayOptions(
|
if (!_disableEmojiSuggestionsOverlay)
|
||||||
visible: _focusNode.hasFocus &&
|
OverlayOptions(
|
||||||
_effectiveController.text.isNotEmpty &&
|
visible: _focusNode.hasFocus &&
|
||||||
_effectiveController.baseOffset > 0 &&
|
_effectiveController.text.isNotEmpty &&
|
||||||
_effectiveController.text
|
_effectiveController.baseOffset > 0 &&
|
||||||
.substring(
|
_effectiveController.text
|
||||||
0,
|
.substring(
|
||||||
_effectiveController.baseOffset,
|
0,
|
||||||
)
|
_effectiveController.baseOffset,
|
||||||
.contains(':'),
|
)
|
||||||
widget: _buildEmojiOverlay(),
|
.contains(':'),
|
||||||
),
|
widget: _buildEmojiOverlay(),
|
||||||
|
),
|
||||||
OverlayOptions(
|
OverlayOptions(
|
||||||
visible: _showMentionsOverlay,
|
visible: _showMentionsOverlay,
|
||||||
widget: _buildMentionsOverlayEntry(),
|
widget: _buildMentionsOverlayEntry(),
|
||||||
|
|||||||
Reference in New Issue
Block a user