Merge pull request #1 from GetStream/master
Merge latest from base repo
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
## 0.1.15
|
||||||
|
|
||||||
|
- Fix MessageInput overflow
|
||||||
|
|
||||||
## 0.1.14
|
## 0.1.14
|
||||||
|
|
||||||
- Add automatic keep alive to streamchat
|
- Add automatic keep alive to streamchat
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ The example is available under the [example](https://github.com/GetStream/stream
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
dependencies:
|
dependencies:
|
||||||
stream_chat_flutter: ^0.1.13
|
stream_chat_flutter: ^0.1.15
|
||||||
```
|
```
|
||||||
|
|
||||||
You should then run `flutter packages get`
|
You should then run `flutter packages get`
|
||||||
|
|||||||
+58
-50
@@ -56,12 +56,13 @@ import 'stream_channel.dart';
|
|||||||
/// The widget renders the ui based on the first ancestor of type [StreamChatTheme].
|
/// The widget renders the ui based on the first ancestor of type [StreamChatTheme].
|
||||||
/// Modify it to change the widget appearance.
|
/// Modify it to change the widget appearance.
|
||||||
class MessageInput extends StatefulWidget {
|
class MessageInput extends StatefulWidget {
|
||||||
MessageInput({
|
MessageInput(
|
||||||
Key key,
|
{Key key,
|
||||||
this.onMessageSent,
|
this.onMessageSent,
|
||||||
this.parentMessage,
|
this.parentMessage,
|
||||||
this.editMessage,
|
this.editMessage,
|
||||||
}) : super(key: key);
|
this.maxHeight = 150})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
/// Message to edit
|
/// Message to edit
|
||||||
final Message editMessage;
|
final Message editMessage;
|
||||||
@@ -72,6 +73,9 @@ class MessageInput extends StatefulWidget {
|
|||||||
/// Parent message in case of a thread
|
/// Parent message in case of a thread
|
||||||
final Message parentMessage;
|
final Message parentMessage;
|
||||||
|
|
||||||
|
/// Maximum Height for the TextField to grow before it starts scrolling
|
||||||
|
final double maxHeight;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MessageInputState createState() => _MessageInputState();
|
_MessageInputState createState() => _MessageInputState();
|
||||||
}
|
}
|
||||||
@@ -111,6 +115,7 @@ class _MessageInputState extends State<MessageInput> {
|
|||||||
Flex _buildTextField(BuildContext context) {
|
Flex _buildTextField(BuildContext context) {
|
||||||
return Flex(
|
return Flex(
|
||||||
direction: Axis.horizontal,
|
direction: Axis.horizontal,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
_buildAttachmentButton(),
|
_buildAttachmentButton(),
|
||||||
_buildTextInput(context),
|
_buildTextInput(context),
|
||||||
@@ -133,54 +138,57 @@ class _MessageInputState extends State<MessageInput> {
|
|||||||
|
|
||||||
Expanded _buildTextInput(BuildContext context) {
|
Expanded _buildTextInput(BuildContext context) {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: TextField(
|
child: LimitedBox(
|
||||||
key: Key('messageInputText'),
|
maxHeight: widget.maxHeight,
|
||||||
minLines: null,
|
child: TextField(
|
||||||
maxLines: null,
|
key: Key('messageInputText'),
|
||||||
onSubmitted: (_) {
|
minLines: null,
|
||||||
_sendMessage(context);
|
maxLines: null,
|
||||||
},
|
onSubmitted: (_) {
|
||||||
controller: _textController,
|
_sendMessage(context);
|
||||||
focusNode: _focusNode,
|
},
|
||||||
onChanged: (s) {
|
controller: _textController,
|
||||||
StreamChannel.of(context).channel.keyStroke();
|
focusNode: _focusNode,
|
||||||
|
onChanged: (s) {
|
||||||
|
StreamChannel.of(context).channel.keyStroke();
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_messageIsPresent = s.trim().isNotEmpty;
|
_messageIsPresent = s.trim().isNotEmpty;
|
||||||
});
|
});
|
||||||
|
|
||||||
_commandsOverlay?.remove();
|
_commandsOverlay?.remove();
|
||||||
_commandsOverlay = null;
|
_commandsOverlay = null;
|
||||||
_mentionsOverlay?.remove();
|
_mentionsOverlay?.remove();
|
||||||
_mentionsOverlay = null;
|
_mentionsOverlay = null;
|
||||||
|
|
||||||
if (s.startsWith('/')) {
|
if (s.startsWith('/')) {
|
||||||
_commandsOverlay = _buildCommandsOverlayEntry();
|
_commandsOverlay = _buildCommandsOverlayEntry();
|
||||||
Overlay.of(context).insert(_commandsOverlay);
|
Overlay.of(context).insert(_commandsOverlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_textController.selection.isCollapsed &&
|
if (_textController.selection.isCollapsed &&
|
||||||
(s[_textController.selection.start - 1] == '@' ||
|
(s[_textController.selection.start - 1] == '@' ||
|
||||||
_textController.text
|
_textController.text
|
||||||
.substring(0, _textController.selection.start)
|
.substring(0, _textController.selection.start)
|
||||||
.split(' ')
|
.split(' ')
|
||||||
.last
|
.last
|
||||||
.contains('@'))) {
|
.contains('@'))) {
|
||||||
_mentionsOverlay = _buildMentionsOverlayEntry();
|
_mentionsOverlay = _buildMentionsOverlayEntry();
|
||||||
Overlay.of(context).insert(_mentionsOverlay);
|
Overlay.of(context).insert(_mentionsOverlay);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_typingStarted = true;
|
_typingStarted = true;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
style: Theme.of(context).textTheme.body1,
|
style: Theme.of(context).textTheme.body1,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: 'Write a message',
|
hintText: 'Write a message',
|
||||||
prefixText: ' ',
|
prefixText: ' ',
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
+1
-1
@@ -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.1.14
|
version: 0.1.15
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.3.0 <3.0.0"
|
sdk: ">=2.3.0 <3.0.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user