fix download image
This commit is contained in:
@@ -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,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user