2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-05-13 12:33:11 +00:00

Add "actions" tab for Part display

This commit is contained in:
Oliver Walters 2021-01-31 21:56:06 +11:00
parent 13780b0c80
commit 40df490a21

View File

@ -142,6 +142,16 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
} }
Widget headerTile() {
return Card(
child: ListTile(
title: Text("${part.fullname}"),
subtitle: Text("${part.description}"),
leading: InvenTreeAPI().getImage(part.thumbnail),
)
);
}
/* /*
* Build a list of tiles to display under the part description * Build a list of tiles to display under the part description
*/ */
@ -151,13 +161,7 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
// Image / name / description // Image / name / description
tiles.add( tiles.add(
Card( headerTile()
child: ListTile(
title: Text("${part.fullname}"),
subtitle: Text("${part.description}"),
leading: InvenTreeAPI().getImage(part.thumbnail),
)
)
); );
// Category information // Category information
@ -274,7 +278,8 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
); );
} }
if (part.isTrackable) { // TODO - Add request tests?
if (false && part.isTrackable) {
tiles.add(ListTile( tiles.add(ListTile(
title: Text("Required Tests"), title: Text("Required Tests"),
leading: FaIcon(FontAwesomeIcons.tasks), leading: FaIcon(FontAwesomeIcons.tasks),
@ -300,6 +305,32 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
} }
List<Widget> actionTiles() {
List<Widget> tiles = [];
tiles.add(headerTile());
tiles.add(
ListTile(
title: Text("Create Stock Item"),
leading: FaIcon(FontAwesomeIcons.box),
onTap: null,
)
);
tiles.add(
ListTile(
title: Text("Scan New Stock Item"),
leading: FaIcon(FontAwesomeIcons.box),
trailing: FaIcon(FontAwesomeIcons.qrcode),
onTap: null,
),
);
return tiles;
}
Widget getSelectedWidget(int index) { Widget getSelectedWidget(int index) {
switch (index) { switch (index) {
case 0: case 0:
@ -311,12 +342,7 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
case 1: case 1:
return Center( return Center(
child: ListView( child: ListView(
children: <Widget>[ children: actionTiles(),
ListTile(
title: Text("Stock"),
subtitle: Text("Stock info goes here!"),
)
],
) )
); );
default: default:
@ -335,12 +361,8 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
title: Text("Details"), title: Text("Details"),
), ),
BottomNavigationBarItem( BottomNavigationBarItem(
icon: FaIcon(FontAwesomeIcons.thList), icon: FaIcon(FontAwesomeIcons.wrench),
title: Text("BOM"), title: Text("Actions"),
),
BottomNavigationBarItem(
icon: FaIcon(FontAwesomeIcons.boxes),
title: Text("Stock"),
), ),
] ]
); );