From bfef637224f738f50901079553e82c0d1fbf6e22 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Fri, 10 Apr 2020 10:31:02 +0200 Subject: [PATCH] refs #18: disable textfield before getting image. --- lib/src/message_input.dart | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index 6f86d9de..aeacab8d 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -90,6 +90,7 @@ class _MessageInputState extends State { final List _mentionedUsers = []; TextEditingController _textController; + bool _inputEnabled = true; bool _messageIsPresent = false; bool _typingStarted = false; OverlayEntry _commandsOverlay, _mentionsOverlay; @@ -153,6 +154,7 @@ class _MessageInputState extends State { maxHeight: widget.maxHeight, child: TextField( key: Key('messageInputText'), + enabled: _inputEnabled, minLines: null, maxLines: null, onSubmitted: (_) { @@ -590,6 +592,10 @@ class _MessageInputState extends State { } void _pickFile(FileType type, bool camera) async { + setState(() { + _inputEnabled = false; + }); + File file; if (camera) { @@ -602,6 +608,10 @@ class _MessageInputState extends State { file = await FilePicker.getFile(type: type); } + setState(() { + _inputEnabled = true; + }); + if (file == null) { return; }