fix for unfocusing bug
This commit is contained in:
@@ -204,6 +204,7 @@ class MessageInput extends StatefulWidget {
|
|||||||
this.commandButtonBuilder,
|
this.commandButtonBuilder,
|
||||||
this.customOverlays = const [],
|
this.customOverlays = const [],
|
||||||
this.mentionAllAppUsers = false,
|
this.mentionAllAppUsers = false,
|
||||||
|
this.shouldKeepFocusAfterMessage,
|
||||||
}) : assert(
|
}) : assert(
|
||||||
initialMessage == null || editMessage == null,
|
initialMessage == null || editMessage == null,
|
||||||
"Can't provide both `initialMessage` and `editMessage`",
|
"Can't provide both `initialMessage` and `editMessage`",
|
||||||
@@ -322,6 +323,8 @@ class MessageInput extends StatefulWidget {
|
|||||||
/// Defaults to false.
|
/// Defaults to false.
|
||||||
final bool mentionAllAppUsers;
|
final bool mentionAllAppUsers;
|
||||||
|
|
||||||
|
final bool? shouldKeepFocusAfterMessage;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
MessageInputState createState() => MessageInputState();
|
MessageInputState createState() => MessageInputState();
|
||||||
|
|
||||||
@@ -1759,7 +1762,9 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final shouldUnfocus = _commandEnabled;
|
var shouldKeepFocus = widget.shouldKeepFocusAfterMessage;
|
||||||
|
|
||||||
|
shouldKeepFocus ??= !_commandEnabled;
|
||||||
|
|
||||||
if (_commandEnabled) {
|
if (_commandEnabled) {
|
||||||
text = '${'/${_chosenCommand!.name} '}$text';
|
text = '${'/${_chosenCommand!.name} '}$text';
|
||||||
@@ -1822,8 +1827,10 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
sendingFuture = channel.updateMessage(message);
|
sendingFuture = channel.updateMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shouldUnfocus) {
|
if (shouldKeepFocus) {
|
||||||
FocusScope.of(context).requestFocus(_focusNode);
|
FocusScope.of(context).requestFocus(_focusNode);
|
||||||
|
} else {
|
||||||
|
FocusScope.of(context).unfocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
final resp = await sendingFuture;
|
final resp = await sendingFuture;
|
||||||
|
|||||||
@@ -444,7 +444,7 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
message: statusString,
|
message: statusString,
|
||||||
child: LazyLoadScrollView(
|
child: LazyLoadScrollView(
|
||||||
onPageScrollStart: () {
|
onPageScrollStart: () {
|
||||||
FocusScope.of(context).unfocus();
|
//FocusScope.of(context).unfocus();
|
||||||
},
|
},
|
||||||
onStartOfPage: () async {
|
onStartOfPage: () async {
|
||||||
_inBetweenList = false;
|
_inBetweenList = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user