diff --git a/lib/widget/part_attachments_widget.dart b/lib/widget/part_attachments_widget.dart index 2f90c6ca..73483f53 100644 --- a/lib/widget/part_attachments_widget.dart +++ b/lib/widget/part_attachments_widget.dart @@ -26,6 +26,8 @@ class _PartAttachmentDisplayState extends RefreshableState attachments = []; + @override String getAppBarTitle(BuildContext context) => L10().attachments; @@ -48,7 +50,22 @@ class _PartAttachmentDisplayState extends RefreshableState request() async { - // TODO - Request part attachments from the server + + await InvenTreePartAttachment().list( + filters: { + "part": "${part.pk}" + } + ).then((var results) { + + attachments.clear(); + + for (var result in results) { + if (result is InvenTreePartAttachment) { + attachments.add(result); + } + } + }); + } @override @@ -68,6 +85,24 @@ class _PartAttachmentDisplayState extends RefreshableState tiles = []; + for (var attachment in attachments) { + tiles.add(ListTile( + title: Text(attachment.filename), + subtitle: Text(attachment.comment), + leading: FaIcon(attachment.icon), + )); + } + + if (tiles.length == 0) { + tiles.add(ListTile( + title: Text(L10().attachmentNone), + subtitle: Text( + L10().attachmentNonePartDetail, + style: TextStyle(fontStyle: FontStyle.italic), + ), + )); + } + return tiles; }