fix(ui): fix early command check
Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
@@ -2,6 +2,7 @@ import 'dart:async';
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
|
import 'package:collection/collection.dart';
|
||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
@@ -878,24 +879,11 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
|
|
||||||
void _checkCommands(String s, BuildContext context) {
|
void _checkCommands(String s, BuildContext context) {
|
||||||
if (s.startsWith('/')) {
|
if (s.startsWith('/')) {
|
||||||
final matchedCommandsList = StreamChannel.of(context)
|
final allCommands = StreamChannel.of(context).channel.config?.commands;
|
||||||
.channel
|
final command =
|
||||||
.config
|
allCommands?.firstWhereOrNull((it) => it.name == s.substring(1));
|
||||||
?.commands
|
if (command != null) {
|
||||||
.where((element) => element.name == s.substring(1))
|
return _setCommand(command);
|
||||||
.toList() ??
|
|
||||||
[];
|
|
||||||
|
|
||||||
if (matchedCommandsList.length == 1) {
|
|
||||||
_chosenCommand = matchedCommandsList[0];
|
|
||||||
textEditingController.clear();
|
|
||||||
|
|
||||||
if (_showCommandsOverlay) {
|
|
||||||
setState(() {
|
|
||||||
_commandEnabled = true;
|
|
||||||
_showCommandsOverlay = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else if (!_showCommandsOverlay) {
|
} else if (!_showCommandsOverlay) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_showCommandsOverlay = true;
|
_showCommandsOverlay = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user