mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 13:36:50 +00:00
Navigate "up" the category path to the parent category
This commit is contained in:
parent
683f1e8efd
commit
15d5bf3fb5
@ -110,12 +110,18 @@ class _CategoryDisplayState extends State<CategoryDisplayWidget> {
|
|||||||
title: Text("Parent Category"),
|
title: Text("Parent Category"),
|
||||||
subtitle: Text("${category.parentpathstring}"),
|
subtitle: Text("${category.parentpathstring}"),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
if (category.parentId < 0) {
|
||||||
|
Navigator.push(context, MaterialPageRoute(builder: (context) => CategoryDisplayWidget(null)));
|
||||||
|
} else {
|
||||||
// TODO - Refactor this code into the InvenTreePart class
|
// TODO - Refactor this code into the InvenTreePart class
|
||||||
InvenTreePartCategory().get(category.parentId).then((var cat) {
|
InvenTreePartCategory().get(category.parentId).then((
|
||||||
|
var cat) {
|
||||||
if (cat is InvenTreePartCategory) {
|
if (cat is InvenTreePartCategory) {
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => CategoryDisplayWidget(cat)));
|
Navigator.push(context, MaterialPageRoute(builder: (
|
||||||
|
context) => CategoryDisplayWidget(cat)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
@ -158,6 +164,7 @@ class _CategoryDisplayState extends State<CategoryDisplayWidget> {
|
|||||||
headerBuilder: (BuildContext context, bool isExpanded) {
|
headerBuilder: (BuildContext context, bool isExpanded) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text("Subcategories"),
|
title: Text("Subcategories"),
|
||||||
|
leading: FaIcon(FontAwesomeIcons.stream),
|
||||||
trailing: Text("${_subcategories.length}"),
|
trailing: Text("${_subcategories.length}"),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -173,6 +180,7 @@ class _CategoryDisplayState extends State<CategoryDisplayWidget> {
|
|||||||
headerBuilder: (BuildContext context, bool isExpanded) {
|
headerBuilder: (BuildContext context, bool isExpanded) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text("Parts"),
|
title: Text("Parts"),
|
||||||
|
leading: FaIcon(FontAwesomeIcons.shapes),
|
||||||
trailing: Text("${_parts.length}"),
|
trailing: Text("${_parts.length}"),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user