fix messageinput
This commit is contained in:
+10
-10
@@ -364,7 +364,10 @@ class MessageInputState extends State<MessageInput> {
|
||||
controller: textEditingController,
|
||||
focusNode: _focusNode,
|
||||
onChanged: (s) {
|
||||
StreamChannel.of(context).channel.keyStroke();
|
||||
StreamChannel.of(context)
|
||||
.channel
|
||||
.keyStroke()
|
||||
.catchError((e) {});
|
||||
|
||||
setState(() {
|
||||
_messageIsPresent = s.trim().isNotEmpty;
|
||||
@@ -479,7 +482,9 @@ class MessageInputState extends State<MessageInput> {
|
||||
|
||||
void _checkMentions(String s, BuildContext context) {
|
||||
if (textEditingController.selection.isCollapsed &&
|
||||
(s.isNotEmpty && s[textEditingController.selection.start - 1] == '@' ||
|
||||
(s.isNotEmpty &&
|
||||
textEditingController.selection.start > 0 &&
|
||||
s[textEditingController.selection.start - 1] == '@' ||
|
||||
textEditingController.text
|
||||
.substring(0, textEditingController.selection.start)
|
||||
.split(' ')
|
||||
@@ -1569,14 +1574,9 @@ class MessageInputState extends State<MessageInput> {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
sendMessage();
|
||||
},
|
||||
child: Icon(
|
||||
_getIdleSendIcon(),
|
||||
color: Colors.grey,
|
||||
),
|
||||
child: Icon(
|
||||
_getIdleSendIcon(),
|
||||
color: Colors.grey,
|
||||
)),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -12,12 +12,14 @@ class StreamChannel extends StatefulWidget {
|
||||
Key key,
|
||||
@required this.child,
|
||||
@required this.channel,
|
||||
this.showLoading = true,
|
||||
}) : super(
|
||||
key: key,
|
||||
);
|
||||
|
||||
final Widget child;
|
||||
final Channel channel;
|
||||
final bool showLoading;
|
||||
|
||||
/// Use this method to get the current [StreamChannelState] instance
|
||||
static StreamChannelState of(BuildContext context) {
|
||||
@@ -155,7 +157,7 @@ class StreamChannelState extends State<StreamChannel> {
|
||||
future: widget.channel.initialized,
|
||||
initialData: widget.channel.state != null,
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData || !snapshot.data) {
|
||||
if (widget.showLoading && (!snapshot.hasData || !snapshot.data)) {
|
||||
return Container(
|
||||
height: 30,
|
||||
child: Center(
|
||||
|
||||
Reference in New Issue
Block a user