Added download
This commit is contained in:
@@ -14,6 +14,7 @@ import 'package:fotodocumentation/pages/ui_utils/general_style.dart';
|
||||
import 'package:fotodocumentation/utils/di_container.dart';
|
||||
import 'package:fotodocumentation/utils/global_router.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:fotodocumentation/utils/file_download.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class CustomerWidget extends StatefulWidget {
|
||||
@@ -202,6 +203,7 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
|
||||
final dateStr = _dateFormat.format(pictureDto.pictureDate);
|
||||
final evaluationColor = _generalStyle.evaluationColor(value: pictureDto.evaluation);
|
||||
Header cred = HeaderUtils().getAuthHeader();
|
||||
return InkWell(
|
||||
key: Key("table_row_${customerDto.id}"),
|
||||
onTap: () => _actionSelect(context, customerDto, pictureDto),
|
||||
@@ -219,6 +221,7 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 70, maxHeight: 70),
|
||||
child: Image.network(
|
||||
headers: {cred.name: cred.value},
|
||||
pictureDto.thumbnailSizeUrl,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
@@ -334,6 +337,10 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
}
|
||||
|
||||
Future<void> _actionDownload(BuildContext context, CustomerDto customerDto, PictureDto? pictureDto) async {
|
||||
// FIXME: implement a download from the export
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user