From 941b211e63a8bb72208621849a121eb9833f59d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kate=C5=99ina=20Churanov=C3=A1?= Date: Sun, 25 Oct 2020 17:34:14 +0100 Subject: [PATCH] fix: send file dialog - prevent multiple file sending --- lib/components/dialogs/send_file_dialog.dart | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/components/dialogs/send_file_dialog.dart b/lib/components/dialogs/send_file_dialog.dart index 1ad33ef..061c0b7 100644 --- a/lib/components/dialogs/send_file_dialog.dart +++ b/lib/components/dialogs/send_file_dialog.dart @@ -19,7 +19,7 @@ class SendFileDialog extends StatefulWidget { class _SendFileDialogState extends State { bool origImage = false; - + bool _isSending = false; Future _send() async { var file = widget.file; if (file is MatrixImageFile && !origImage) { @@ -82,10 +82,16 @@ class _SendFileDialogState extends State { ), FlatButton( child: Text(L10n.of(context).send), - onPressed: () async { - await SimpleDialogs(context).tryRequestWithLoadingDialog(_send()); - await Navigator.of(context).pop(); - }, + onPressed: _isSending + ? null + : () async { + setState(() { + _isSending = true; + }); + await SimpleDialogs(context) + .tryRequestWithLoadingDialog(_send()); + await Navigator.of(context).pop(); + }, ), ], );