From 6821a421b617fff765867c7a99ce03a314012e54 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Sun, 18 Jul 2021 12:17:56 +0200 Subject: [PATCH] fix: Make sure the textfield is unfocused before opening the camera --- lib/pages/chat.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pages/chat.dart b/lib/pages/chat.dart index ed335065..b3c34169 100644 --- a/lib/pages/chat.dart +++ b/lib/pages/chat.dart @@ -290,7 +290,8 @@ class ChatController extends State { } void openCameraAction() async { - inputFocus.unfocus(); + // Make sure the textfield is unfocused before opening the camera + FocusScope.of(context).requestFocus(FocusNode()); final file = await ImagePicker().getImage(source: ImageSource.camera); if (file == null) return; final bytes = await file.readAsBytes();