refs #18: unfocus keyboard before picking attachment

This commit is contained in:
Salvatore Giordano
2020-04-10 09:54:47 +02:00
parent 3e0c74923f
commit 354fd43953
3 changed files with 23 additions and 10 deletions
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
+15 -8
View File
@@ -56,13 +56,13 @@ import 'stream_channel.dart';
/// The widget renders the ui based on the first ancestor of type [StreamChatTheme].
/// Modify it to change the widget appearance.
class MessageInput extends StatefulWidget {
MessageInput(
{Key key,
this.onMessageSent,
this.parentMessage,
this.editMessage,
this.maxHeight = 150})
: super(key: key);
MessageInput({
Key key,
this.onMessageSent,
this.parentMessage,
this.editMessage,
this.maxHeight = 150,
}) : super(key: key);
/// Message to edit
final Message editMessage;
@@ -506,6 +506,10 @@ class _MessageInputState extends State<MessageInput> {
}
void _showAttachmentModal() {
if (_focusNode.hasFocus) {
_focusNode.unfocus();
}
showModalBottomSheet(
clipBehavior: Clip.hardEdge,
shape: RoundedRectangleBorder(
@@ -548,7 +552,6 @@ class _MessageInputState extends State<MessageInput> {
leading: Icon(Icons.camera_alt),
title: Text('Photo from camera'),
onTap: () {
ImagePicker.pickImage(source: ImageSource.camera);
_pickFile(FileType.image, true);
Navigator.pop(context);
},
@@ -587,6 +590,10 @@ class _MessageInputState extends State<MessageInput> {
file = await FilePicker.getFile(type: type);
}
if (file == null) {
return;
}
final channel = StreamChannel.of(context).channel;
final bytes = await file.readAsBytes();
-2
View File
@@ -10,8 +10,6 @@ dependencies:
flutter:
sdk: flutter
rxdart: ^0.23.1
jiffy: ^3.0.1
cached_network_image: ^2.0.0
flutter_markdown: ^0.3.4