fix download image

This commit is contained in:
Salvatore Giordano
2021-04-30 15:00:52 +02:00
parent 236f0a4f15
commit 75e167b4ed
@@ -120,7 +120,7 @@ class AttachmentActionsModal extends StatelessWidget {
received,
);
},
).catchError((_) {
).catchError((e, stk) {
progressNotifier.value = null;
});
@@ -225,16 +225,14 @@ class AttachmentActionsModal extends StatelessWidget {
ValueNotifier<_DownloadProgress?> progressNotifier,
) {
final theme = StreamChatTheme.of(context);
return WillPopScope(
onWillPop: () => Future.value(false),
child: ValueListenableBuilder(
return ValueListenableBuilder(
valueListenable: progressNotifier,
builder: (_, _DownloadProgress? progress, __) {
// Pop the dialog in case the progress is null or it's completed.
if (progress == null || progress.toProgressIndicatorValue == 1.0) {
Future.delayed(
const Duration(milliseconds: 500),
Navigator.of(context).maybePop,
() => Navigator.of(context).maybePop(),
);
}
return Material(
@@ -294,7 +292,6 @@ class AttachmentActionsModal extends StatelessWidget {
),
);
},
),
);
}
@@ -310,7 +307,7 @@ class AttachmentActionsModal extends StatelessWidget {
final contentType = responseHeaders[Headers.contentTypeHeader]!;
final mimeType = contentType.first.split('/').last;
filePath ??= '${appDocDir.path}/${attachment.id}.$mimeType';
return filePath;
return filePath!;
},
onReceiveProgress: progressCallback,
);