mirror of
https://github.com/inventree/inventree-app.git
synced 2025-05-01 15:06:49 +00:00
Action tiles to create new category and new part
This commit is contained in:
parent
2dfe8921eb
commit
3447d08d7b
@ -219,18 +219,57 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
|||||||
return tiles;
|
return tiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> actionTiles() {
|
Future<void> _newCategory(BuildContext context) async {
|
||||||
|
|
||||||
|
int pk = category?.pk ?? -1;
|
||||||
|
|
||||||
|
launchApiForm(
|
||||||
|
context,
|
||||||
|
L10().categoryCreate,
|
||||||
|
InvenTreePartCategory().URL,
|
||||||
|
{
|
||||||
|
"name": {},
|
||||||
|
"description": {},
|
||||||
|
"parent": {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
modelData: {
|
||||||
|
"parent": (pk > 0) ? pk : null,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _newPart() async {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Widget> actionTiles(BuildContext context) {
|
||||||
|
|
||||||
List<Widget> tiles = [
|
List<Widget> tiles = [
|
||||||
getCategoryDescriptionCard(extra: false),
|
getCategoryDescriptionCard(extra: false),
|
||||||
ListTile(
|
|
||||||
title: Text(L10().actions,
|
|
||||||
style: TextStyle(fontWeight: FontWeight.bold)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// TODO - Actions!
|
tiles.add(
|
||||||
|
ListTile(
|
||||||
|
title: Text(L10().categoryCreate),
|
||||||
|
subtitle: Text(L10().categoryCreateDetail),
|
||||||
|
leading: FaIcon(FontAwesomeIcons.sitemap, color: COLOR_CLICK),
|
||||||
|
onTap: () async {
|
||||||
|
_newCategory(context);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (category != null) {
|
||||||
|
tiles.add(
|
||||||
|
ListTile(
|
||||||
|
title: Text(L10().partCreate),
|
||||||
|
subtitle: Text(L10().partCreateDetail),
|
||||||
|
leading: FaIcon(FontAwesomeIcons.shapes, color: COLOR_CLICK),
|
||||||
|
onTap: _newPart,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return tiles;
|
return tiles;
|
||||||
}
|
}
|
||||||
@ -251,7 +290,7 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
|||||||
);
|
);
|
||||||
case 2:
|
case 2:
|
||||||
return ListView(
|
return ListView(
|
||||||
children: actionTiles()
|
children: actionTiles(context)
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
return ListView();
|
return ListView();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user