Merge branch 'master' into feature/new-ui
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
## 0.2.13+1
|
||||
|
||||
- Use TextEditingController.addListener instead of TextField.onChanged
|
||||
|
||||
## 0.2.13
|
||||
|
||||
- Update llc dependency
|
||||
|
||||
@@ -55,6 +55,11 @@ We also use [video_player](https://pub.dev/packages/video_player) to reproduce v
|
||||
To pick images from the camera, we use the [image_picker](https://pub.dev/packages/image_picker) plugin.
|
||||
Follow [these instructions](https://pub.dev/packages/image_picker#ios) to check the requirements.
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
It may happen that you have some problems building the app.
|
||||
If it seems related to the [flutter file picker plugin](https://github.com/miguelpruivo/flutter_file_picker) make sure to check [this page](https://github.com/miguelpruivo/flutter_file_picker/wiki/Troubleshooting)
|
||||
|
||||
## Docs
|
||||
|
||||
### Business logic components
|
||||
|
||||
@@ -1 +1 @@
|
||||
bb5f9103d9045cd6244bcae1f5f343e5
|
||||
c3e639ccf9b069e37a7d1345194e6b99
|
||||
@@ -1,6 +1,6 @@
|
||||
name: example
|
||||
description: A new Flutter project.
|
||||
version: 1.0.59+61
|
||||
version: 1.0.60+62
|
||||
|
||||
environment:
|
||||
sdk: ">=2.2.2 <3.0.0"
|
||||
|
||||
+43
-39
@@ -364,25 +364,7 @@ class MessageInputState extends State<MessageInput> {
|
||||
controller: textEditingController,
|
||||
focusNode: _focusNode,
|
||||
onChanged: (s) {
|
||||
StreamChannel.of(context).channel.keyStroke();
|
||||
|
||||
setState(() {
|
||||
_messageIsPresent = s.trim().isNotEmpty;
|
||||
_actionsShrunk = s.trim().isNotEmpty;
|
||||
});
|
||||
|
||||
_commandsOverlay?.remove();
|
||||
_commandsOverlay = null;
|
||||
_mentionsOverlay?.remove();
|
||||
_mentionsOverlay = null;
|
||||
_emojiOverlay?.remove();
|
||||
_emojiOverlay = null;
|
||||
|
||||
_checkCommands(s, context);
|
||||
|
||||
_checkMentions(s, context);
|
||||
|
||||
_checkEmoji(s, context);
|
||||
_onChanged(context, s);
|
||||
},
|
||||
style: Theme.of(context).textTheme.bodyText2,
|
||||
autofocus: false,
|
||||
@@ -440,6 +422,28 @@ class MessageInputState extends State<MessageInput> {
|
||||
);
|
||||
}
|
||||
|
||||
void _onChanged(BuildContext context, String s) {
|
||||
StreamChannel.of(context).channel.keyStroke();
|
||||
|
||||
setState(() {
|
||||
_messageIsPresent = s.trim().isNotEmpty;
|
||||
_actionsShrunk = s.trim().isNotEmpty;
|
||||
});
|
||||
|
||||
_commandsOverlay?.remove();
|
||||
_commandsOverlay = null;
|
||||
_mentionsOverlay?.remove();
|
||||
_mentionsOverlay = null;
|
||||
_emojiOverlay?.remove();
|
||||
_emojiOverlay = null;
|
||||
|
||||
_checkCommands(s.trim(), context);
|
||||
|
||||
_checkMentions(s, context);
|
||||
|
||||
_checkEmoji(s, context);
|
||||
}
|
||||
|
||||
String _getHint() {
|
||||
if (_commandEnabled && _chosenCommand.name == 'giphy') {
|
||||
return 'Search GIFs';
|
||||
@@ -451,14 +455,14 @@ class MessageInputState extends State<MessageInput> {
|
||||
}
|
||||
|
||||
void _checkEmoji(String s, BuildContext context) {
|
||||
if (textEditingController.selection.isCollapsed &&
|
||||
(s.isNotEmpty && s[textEditingController.selection.start - 1] == ':' ||
|
||||
textEditingController.text
|
||||
.substring(
|
||||
0,
|
||||
textEditingController.selection.start,
|
||||
)
|
||||
.contains(':'))) {
|
||||
if (s.isNotEmpty &&
|
||||
textEditingController.selection.baseOffset > 0 &&
|
||||
textEditingController.text
|
||||
.substring(
|
||||
0,
|
||||
textEditingController.selection.baseOffset,
|
||||
)
|
||||
.contains(':')) {
|
||||
final textToSelection = textEditingController.text
|
||||
.substring(0, textEditingController.value.selection.start);
|
||||
final splits = textToSelection.split(':');
|
||||
@@ -478,13 +482,13 @@ class MessageInputState extends State<MessageInput> {
|
||||
}
|
||||
|
||||
void _checkMentions(String s, BuildContext context) {
|
||||
if (textEditingController.selection.isCollapsed &&
|
||||
(s.isNotEmpty && s[textEditingController.selection.start - 1] == '@' ||
|
||||
textEditingController.text
|
||||
.substring(0, textEditingController.selection.start)
|
||||
.split(' ')
|
||||
.last
|
||||
.contains('@'))) {
|
||||
if (s.isNotEmpty &&
|
||||
textEditingController.selection.baseOffset > 0 &&
|
||||
textEditingController.text
|
||||
.substring(0, textEditingController.selection.baseOffset)
|
||||
.split(' ')
|
||||
.last
|
||||
.contains('@')) {
|
||||
_mentionsOverlay = _buildMentionsOverlayEntry();
|
||||
Overlay.of(context).insert(_mentionsOverlay);
|
||||
}
|
||||
@@ -1718,11 +1722,7 @@ class MessageInputState extends State<MessageInput> {
|
||||
|
||||
if (!kIsWeb) {
|
||||
_keyboardListener = KeyboardVisibility.onChange.listen((visible) {
|
||||
if (visible) {
|
||||
_checkCommands(textEditingController.text, context);
|
||||
_checkMentions(textEditingController.text, context);
|
||||
_checkEmoji(textEditingController.text, context);
|
||||
}
|
||||
_onChanged(context, textEditingController.text);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1732,6 +1732,10 @@ class MessageInputState extends State<MessageInput> {
|
||||
_parseExistingMessage(widget.editMessage ?? widget.initialMessage);
|
||||
}
|
||||
|
||||
textEditingController.addListener(() {
|
||||
_onChanged(context, textEditingController.text);
|
||||
});
|
||||
|
||||
_focusNode.addListener(() {
|
||||
if (_focusNode.hasFocus) {
|
||||
_openFilePickerSection = false;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
name: stream_chat_flutter
|
||||
homepage: https://github.com/GetStream/stream-chat-flutter
|
||||
description: Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter.
|
||||
version: 0.2.13
|
||||
version: 0.2.13+1
|
||||
repository: https://github.com/GetStream/stream-chat-flutter
|
||||
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
|
||||
|
||||
|
||||
Reference in New Issue
Block a user