2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-13 10:45:29 +00:00

Edit attachment (#598)
Some checks failed
CI / test (push) Has been cancelled
iOS / build (push) Has been cancelled
Android / build (push) Has been cancelled

* Edit attachment

- Allow editing of attachments once updloaed

* Update release notes

* Remove duplicate func
This commit is contained in:
Oliver
2025-01-11 17:11:17 +11:00
committed by GitHub
parent 94d43bc377
commit 1363f7ee3a
5 changed files with 58 additions and 4 deletions

View File

@ -97,6 +97,14 @@ class _AttachmentWidgetState extends RefreshableState<AttachmentWidget> {
refresh(context);
}
Future<void> editAttachment(BuildContext context, InvenTreeAttachment attachment) async
{
attachment.editForm(context, L10().editAttachment).then((result) => {
refresh(context)
});
}
/*
* Delete the specified attachment
*/
@ -117,6 +125,7 @@ class _AttachmentWidgetState extends RefreshableState<AttachmentWidget> {
* Display an option context menu for the selected attachment
*/
Future<void> showOptionsMenu(BuildContext context, InvenTreeAttachment attachment) async {
OneContext().showDialog(
builder: (BuildContext ctx) {
return SimpleDialog(
@ -125,12 +134,22 @@ class _AttachmentWidgetState extends RefreshableState<AttachmentWidget> {
Divider(),
SimpleDialogOption(
onPressed: () async {
Navigator.of(ctx).pop();
OneContext().popDialog();
editAttachment(context, attachment);
},
child: ListTile(
title: Text(L10().edit),
leading: Icon(TablerIcons.edit),
)
),
SimpleDialogOption(
onPressed: () async {
OneContext().popDialog();
deleteAttachment(context, attachment);
},
child: ListTile(
title: Text(L10().delete),
leading: Icon(TablerIcons.trash),
leading: Icon(TablerIcons.trash, color: COLOR_DANGER),
)
)
]
@ -162,6 +181,9 @@ class _AttachmentWidgetState extends RefreshableState<AttachmentWidget> {
}
}
});
setState(() {
});
}
@override