diff --git a/hartmann-foto-documentation-frontend/lib/pages/customer/customer_widget.dart b/hartmann-foto-documentation-frontend/lib/pages/customer/customer_widget.dart index c530121..7c12996 100644 --- a/hartmann-foto-documentation-frontend/lib/pages/customer/customer_widget.dart +++ b/hartmann-foto-documentation-frontend/lib/pages/customer/customer_widget.dart @@ -337,8 +337,24 @@ class _CustomerWidgetState extends State { } Future _actionDownload(BuildContext context, CustomerDto customerDto, PictureDto? pictureDto) async { - final bytes = await _customerController.export(customerId: customerDto.id, pictureId: pictureDto?.id); - final fileName = pictureDto != null ? '${customerDto.customerNumber}_${pictureDto.id}.pdf' : '${customerDto.customerNumber}.pdf'; - await downloadFile(bytes, fileName); + showDialog( + context: context, + barrierDismissible: false, + builder: (context) => const Center(child: CircularProgressIndicator()), + ); + + try { + final bytes = await _customerController.export(customerId: customerDto.id, pictureId: pictureDto?.id); + final fileName = pictureDto != null ? '${customerDto.customerNumber}_${pictureDto.id}.pdf' : '${customerDto.customerNumber}.pdf'; + if (context.mounted) { + Navigator.of(context).pop(); + } + await downloadFile(bytes, fileName); + } catch (e) { + if (context.mounted) { + Navigator.of(context).pop(); + } + rethrow; + } } }