fix emoji overlay
This commit is contained in:
@@ -464,109 +464,109 @@ class MessageInputState extends State<MessageInput>
|
|||||||
void _stopSlowMode() => _slowModeTimer?.cancel();
|
void _stopSlowMode() => _slowModeTimer?.cancel();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) => MessageValueListenableBuilder(
|
||||||
Widget child = MessageValueListenableBuilder(
|
valueListenable: _effectiveController,
|
||||||
valueListenable: _effectiveController,
|
builder: (context, value, _) {
|
||||||
builder: (context, value, _) => DecoratedBox(
|
Widget child = DecoratedBox(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _messageInputTheme.inputBackgroundColor,
|
color: _messageInputTheme.inputBackgroundColor,
|
||||||
),
|
|
||||||
child: SafeArea(
|
|
||||||
child: GestureDetector(
|
|
||||||
onPanUpdate: (details) {
|
|
||||||
if (details.delta.dy > 0) {
|
|
||||||
_focusNode.unfocus();
|
|
||||||
if (_openFilePickerSection) {
|
|
||||||
setState(() {
|
|
||||||
_openFilePickerSection = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
if (_hasQuotedMessage)
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(8),
|
|
||||||
child: StreamSvgIcon.reply(
|
|
||||||
color: _streamChatTheme.colorTheme.disabled,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
context.translations.replyToMessageLabel,
|
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
visualDensity: VisualDensity.compact,
|
|
||||||
icon: StreamSvgIcon.closeSmall(),
|
|
||||||
onPressed: widget.onQuotedMessageCleared,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
|
||||||
child: _buildTextField(context),
|
|
||||||
),
|
|
||||||
if (_effectiveController.value.parentId != null &&
|
|
||||||
!widget.hideSendAsDm)
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
right: 12,
|
|
||||||
left: 12,
|
|
||||||
bottom: 12,
|
|
||||||
),
|
|
||||||
child: _buildDmCheckbox(),
|
|
||||||
),
|
|
||||||
_buildFilePickerSection(),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
child: SafeArea(
|
||||||
),
|
child: GestureDetector(
|
||||||
),
|
onPanUpdate: (details) {
|
||||||
);
|
if (details.delta.dy > 0) {
|
||||||
if (_isEditing) {
|
_focusNode.unfocus();
|
||||||
child = Material(
|
if (_openFilePickerSection) {
|
||||||
elevation: 8,
|
setState(() {
|
||||||
child: child,
|
_openFilePickerSection = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
if (_hasQuotedMessage)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
child: StreamSvgIcon.reply(
|
||||||
|
color: _streamChatTheme.colorTheme.disabled,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
context.translations.replyToMessageLabel,
|
||||||
|
style:
|
||||||
|
const TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
visualDensity: VisualDensity.compact,
|
||||||
|
icon: StreamSvgIcon.closeSmall(),
|
||||||
|
onPressed: widget.onQuotedMessageCleared,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||||
|
child: _buildTextField(context),
|
||||||
|
),
|
||||||
|
if (_effectiveController.value.parentId != null &&
|
||||||
|
!widget.hideSendAsDm)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
right: 12,
|
||||||
|
left: 12,
|
||||||
|
bottom: 12,
|
||||||
|
),
|
||||||
|
child: _buildDmCheckbox(),
|
||||||
|
),
|
||||||
|
_buildFilePickerSection(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (_isEditing) {
|
||||||
|
child = Material(
|
||||||
|
elevation: 8,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return MultiOverlay(
|
||||||
|
childAnchor: Alignment.topCenter,
|
||||||
|
overlayAnchor: Alignment.bottomCenter,
|
||||||
|
overlayOptions: [
|
||||||
|
OverlayOptions(
|
||||||
|
visible: _showCommandsOverlay,
|
||||||
|
widget: _buildCommandsOverlayEntry(),
|
||||||
|
),
|
||||||
|
OverlayOptions(
|
||||||
|
visible: _focusNode.hasFocus &&
|
||||||
|
_effectiveController.text.isNotEmpty &&
|
||||||
|
_effectiveController.baseOffset > 0 &&
|
||||||
|
_effectiveController.text
|
||||||
|
.substring(
|
||||||
|
0,
|
||||||
|
_effectiveController.baseOffset,
|
||||||
|
)
|
||||||
|
.contains(':'),
|
||||||
|
widget: _buildEmojiOverlay(),
|
||||||
|
),
|
||||||
|
OverlayOptions(
|
||||||
|
visible: _showMentionsOverlay,
|
||||||
|
widget: _buildMentionsOverlayEntry(),
|
||||||
|
),
|
||||||
|
...widget.customOverlays,
|
||||||
|
],
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
return MultiOverlay(
|
|
||||||
childAnchor: Alignment.topCenter,
|
|
||||||
overlayAnchor: Alignment.bottomCenter,
|
|
||||||
overlayOptions: [
|
|
||||||
OverlayOptions(
|
|
||||||
visible: _showCommandsOverlay,
|
|
||||||
widget: _buildCommandsOverlayEntry(),
|
|
||||||
),
|
|
||||||
OverlayOptions(
|
|
||||||
visible: _focusNode.hasFocus &&
|
|
||||||
_effectiveController.text.isNotEmpty &&
|
|
||||||
_effectiveController.baseOffset > 0 &&
|
|
||||||
_effectiveController.text
|
|
||||||
.substring(
|
|
||||||
0,
|
|
||||||
_effectiveController.baseOffset,
|
|
||||||
)
|
|
||||||
.contains(':'),
|
|
||||||
widget: _buildEmojiOverlay(),
|
|
||||||
),
|
|
||||||
OverlayOptions(
|
|
||||||
visible: _showMentionsOverlay,
|
|
||||||
widget: _buildMentionsOverlayEntry(),
|
|
||||||
),
|
|
||||||
...widget.customOverlays,
|
|
||||||
],
|
|
||||||
child: child,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Flex _buildTextField(BuildContext context) => Flex(
|
Flex _buildTextField(BuildContext context) => Flex(
|
||||||
direction: Axis.horizontal,
|
direction: Axis.horizontal,
|
||||||
@@ -646,6 +646,9 @@ class MessageInputState extends State<MessageInput>
|
|||||||
return widget.sendButtonBuilder!(context, _effectiveController);
|
return widget.sendButtonBuilder!(context, _effectiveController);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print(
|
||||||
|
'widget.validator(_effectiveController.message): ${widget.validator(_effectiveController.message)}');
|
||||||
|
|
||||||
return StreamMessageSendButton(
|
return StreamMessageSendButton(
|
||||||
onSendMessage: sendMessage,
|
onSendMessage: sendMessage,
|
||||||
timeOut: _timeOut,
|
timeOut: _timeOut,
|
||||||
@@ -711,6 +714,7 @@ class MessageInputState extends State<MessageInput>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Expanded _buildTextInput(BuildContext context) {
|
Expanded _buildTextInput(BuildContext context) {
|
||||||
|
print('build text input');
|
||||||
final margin = (widget.sendButtonLocation == SendButtonLocation.inside
|
final margin = (widget.sendButtonLocation == SendButtonLocation.inside
|
||||||
? const EdgeInsets.only(right: 8)
|
? const EdgeInsets.only(right: 8)
|
||||||
: EdgeInsets.zero) +
|
: EdgeInsets.zero) +
|
||||||
@@ -869,6 +873,7 @@ class MessageInputState extends State<MessageInput>
|
|||||||
|
|
||||||
late final _onChangedDebounced = debounce(
|
late final _onChangedDebounced = debounce(
|
||||||
() {
|
() {
|
||||||
|
print('onchangeddebounce');
|
||||||
var value = _effectiveController.text;
|
var value = _effectiveController.text;
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
value = value.trim();
|
value = value.trim();
|
||||||
@@ -888,6 +893,7 @@ class MessageInputState extends State<MessageInput>
|
|||||||
setState(() {
|
setState(() {
|
||||||
_actionsShrunk = value.isNotEmpty && actionsLength > 1;
|
_actionsShrunk = value.isNotEmpty && actionsLength > 1;
|
||||||
});
|
});
|
||||||
|
print('CHECK COMMANDS 00');
|
||||||
|
|
||||||
_checkCommands(value, context);
|
_checkCommands(value, context);
|
||||||
_checkMentions(value, context);
|
_checkMentions(value, context);
|
||||||
@@ -959,6 +965,7 @@ class MessageInputState extends State<MessageInput>
|
|||||||
|
|
||||||
void _checkCommands(String s, BuildContext context) {
|
void _checkCommands(String s, BuildContext context) {
|
||||||
if (s.startsWith('/')) {
|
if (s.startsWith('/')) {
|
||||||
|
print('CHECK COMMANDS');
|
||||||
final allCommands = StreamChannel.of(context).channel.config?.commands;
|
final allCommands = StreamChannel.of(context).channel.config?.commands;
|
||||||
final command =
|
final command =
|
||||||
allCommands?.firstWhereOrNull((it) => it.name == s.substring(1));
|
allCommands?.firstWhereOrNull((it) => it.name == s.substring(1));
|
||||||
|
|||||||
Reference in New Issue
Block a user