mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 11:36:24 +00:00
Display number of attachments on part view
This commit is contained in:
parent
10783cd1c4
commit
fcfda4ebff
1 changed files with 9 additions and 1 deletions
|
|
@ -39,6 +39,8 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
||||||
|
|
||||||
InvenTreePart? parentPart;
|
InvenTreePart? parentPart;
|
||||||
|
|
||||||
|
int attachmentCount = 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getAppBarTitle(BuildContext context) => L10().partDetails;
|
String getAppBarTitle(BuildContext context) => L10().partDetails;
|
||||||
|
|
||||||
|
|
@ -110,6 +112,12 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
await part.getTestTemplates();
|
await part.getTestTemplates();
|
||||||
|
|
||||||
|
attachmentCount = await InvenTreePartAttachment().count(
|
||||||
|
filters: {
|
||||||
|
"part": part.pk.toString()
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future <void> _toggleStar() async {
|
Future <void> _toggleStar() async {
|
||||||
|
|
@ -405,7 +413,7 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(L10().attachments),
|
title: Text(L10().attachments),
|
||||||
leading: FaIcon(FontAwesomeIcons.fileAlt, color: COLOR_CLICK),
|
leading: FaIcon(FontAwesomeIcons.fileAlt, color: COLOR_CLICK),
|
||||||
trailing: Text(""),
|
trailing: attachmentCount > 0 ? Text(attachmentCount.toString()) : null,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue