diff --git a/lib/inventree/part.dart b/lib/inventree/part.dart index b15a5ca1..61381920 100644 --- a/lib/inventree/part.dart +++ b/lib/inventree/part.dart @@ -132,6 +132,13 @@ class InvenTreePart extends InvenTreeModel { @override String URL = "part/"; + @override + Map defaultGetFilters() { + return { + "category_detail": "1", // Include category detail information + }; + } + List testingTemplates = List(); int get testTemplateCount => testingTemplates.length; @@ -195,7 +202,10 @@ class InvenTreePart extends InvenTreeModel { int get categoryId => jsondata['category'] as int ?? null; // Get the category name for the Part instance - String get categoryName => jsondata['category_name'] ?? ''; + String get categoryName => jsondata['category_detail']['name'] as String ?? ''; + + // Get the category description for the Part instance + String get categoryDescription => jsondata['category_detail']['description'] as String ?? ''; // Get the image URL for the Part instance String get _image => jsondata['image'] ?? ''; diff --git a/lib/widget/category_display.dart b/lib/widget/category_display.dart index 8fe87d09..18f86349 100644 --- a/lib/widget/category_display.dart +++ b/lib/widget/category_display.dart @@ -102,6 +102,7 @@ class _CategoryDisplayState extends RefreshableState { ListTile( title: Text("Parent Category"), subtitle: Text("${category.parentpathstring}"), + leading: FaIcon(FontAwesomeIcons.sitemap), onTap: () { if (category.parentId < 0) { Navigator.push(context, MaterialPageRoute(builder: (context) => CategoryDisplayWidget(null))); diff --git a/lib/widget/refreshable_state.dart b/lib/widget/refreshable_state.dart index ab43d779..f4a35f3b 100644 --- a/lib/widget/refreshable_state.dart +++ b/lib/widget/refreshable_state.dart @@ -36,7 +36,7 @@ abstract class RefreshableState extends State { // Function to construct an appbar (override if needed) AppBar getAppBar(BuildContext context) { return AppBar( - title: Text(getAppBarTitle(context)) + title: Text(getAppBarTitle(context)), ); }