Merge branch 'shine/send-file-multiple-event-send-fix' into 'main'

fix: send file dialog - prevent multiple file sending

See merge request ChristianPauly/fluffychat-flutter!242
This commit is contained in:
Christian Pauly 2020-10-26 11:18:44 +00:00
commit d74c3e2187
1 changed files with 11 additions and 5 deletions

View File

@ -19,7 +19,7 @@ class SendFileDialog extends StatefulWidget {
class _SendFileDialogState extends State<SendFileDialog> { class _SendFileDialogState extends State<SendFileDialog> {
bool origImage = false; bool origImage = false;
bool _isSending = false;
Future<void> _send() async { Future<void> _send() async {
var file = widget.file; var file = widget.file;
if (file is MatrixImageFile && !origImage) { if (file is MatrixImageFile && !origImage) {
@ -82,10 +82,16 @@ class _SendFileDialogState extends State<SendFileDialog> {
), ),
FlatButton( FlatButton(
child: Text(L10n.of(context).send), child: Text(L10n.of(context).send),
onPressed: () async { onPressed: _isSending
await SimpleDialogs(context).tryRequestWithLoadingDialog(_send()); ? null
await Navigator.of(context).pop(); : () async {
}, setState(() {
_isSending = true;
});
await SimpleDialogs(context)
.tryRequestWithLoadingDialog(_send());
await Navigator.of(context).pop();
},
), ),
], ],
); );