Merge branch 'master' into feature/new-ui

This commit is contained in:
Salvatore Giordano
2020-11-19 13:22:49 +01:00
6 changed files with 55 additions and 42 deletions
+4
View File
@@ -1,3 +1,7 @@
## 0.2.13+1
- Use TextEditingController.addListener instead of TextField.onChanged
## 0.2.13 ## 0.2.13
- Update llc dependency - Update llc dependency
+5
View File
@@ -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. 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. 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 ## Docs
### Business logic components ### Business logic components
+1 -1
View File
@@ -1 +1 @@
bb5f9103d9045cd6244bcae1f5f343e5 c3e639ccf9b069e37a7d1345194e6b99
+1 -1
View File
@@ -1,6 +1,6 @@
name: example name: example
description: A new Flutter project. description: A new Flutter project.
version: 1.0.59+61 version: 1.0.60+62
environment: environment:
sdk: ">=2.2.2 <3.0.0" sdk: ">=2.2.2 <3.0.0"
+43 -39
View File
@@ -364,25 +364,7 @@ class MessageInputState extends State<MessageInput> {
controller: textEditingController, controller: textEditingController,
focusNode: _focusNode, focusNode: _focusNode,
onChanged: (s) { onChanged: (s) {
StreamChannel.of(context).channel.keyStroke(); _onChanged(context, s);
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);
}, },
style: Theme.of(context).textTheme.bodyText2, style: Theme.of(context).textTheme.bodyText2,
autofocus: false, 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() { String _getHint() {
if (_commandEnabled && _chosenCommand.name == 'giphy') { if (_commandEnabled && _chosenCommand.name == 'giphy') {
return 'Search GIFs'; return 'Search GIFs';
@@ -451,14 +455,14 @@ class MessageInputState extends State<MessageInput> {
} }
void _checkEmoji(String s, BuildContext context) { void _checkEmoji(String s, BuildContext context) {
if (textEditingController.selection.isCollapsed && if (s.isNotEmpty &&
(s.isNotEmpty && s[textEditingController.selection.start - 1] == ':' || textEditingController.selection.baseOffset > 0 &&
textEditingController.text textEditingController.text
.substring( .substring(
0, 0,
textEditingController.selection.start, textEditingController.selection.baseOffset,
) )
.contains(':'))) { .contains(':')) {
final textToSelection = textEditingController.text final textToSelection = textEditingController.text
.substring(0, textEditingController.value.selection.start); .substring(0, textEditingController.value.selection.start);
final splits = textToSelection.split(':'); final splits = textToSelection.split(':');
@@ -478,13 +482,13 @@ class MessageInputState extends State<MessageInput> {
} }
void _checkMentions(String s, BuildContext context) { void _checkMentions(String s, BuildContext context) {
if (textEditingController.selection.isCollapsed && if (s.isNotEmpty &&
(s.isNotEmpty && s[textEditingController.selection.start - 1] == '@' || textEditingController.selection.baseOffset > 0 &&
textEditingController.text textEditingController.text
.substring(0, textEditingController.selection.start) .substring(0, textEditingController.selection.baseOffset)
.split(' ') .split(' ')
.last .last
.contains('@'))) { .contains('@')) {
_mentionsOverlay = _buildMentionsOverlayEntry(); _mentionsOverlay = _buildMentionsOverlayEntry();
Overlay.of(context).insert(_mentionsOverlay); Overlay.of(context).insert(_mentionsOverlay);
} }
@@ -1718,11 +1722,7 @@ class MessageInputState extends State<MessageInput> {
if (!kIsWeb) { if (!kIsWeb) {
_keyboardListener = KeyboardVisibility.onChange.listen((visible) { _keyboardListener = KeyboardVisibility.onChange.listen((visible) {
if (visible) { _onChanged(context, textEditingController.text);
_checkCommands(textEditingController.text, context);
_checkMentions(textEditingController.text, context);
_checkEmoji(textEditingController.text, context);
}
}); });
} }
@@ -1732,6 +1732,10 @@ class MessageInputState extends State<MessageInput> {
_parseExistingMessage(widget.editMessage ?? widget.initialMessage); _parseExistingMessage(widget.editMessage ?? widget.initialMessage);
} }
textEditingController.addListener(() {
_onChanged(context, textEditingController.text);
});
_focusNode.addListener(() { _focusNode.addListener(() {
if (_focusNode.hasFocus) { if (_focusNode.hasFocus) {
_openFilePickerSection = false; _openFilePickerSection = false;
+1 -1
View File
@@ -1,7 +1,7 @@
name: stream_chat_flutter name: stream_chat_flutter
homepage: https://github.com/GetStream/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. 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 repository: https://github.com/GetStream/stream-chat-flutter
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues