2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-13 18:55:34 +00:00

Fix null ptr errors

This commit is contained in:
Oliver Walters
2021-02-16 23:24:10 +11:00
parent 911f988fa5
commit 33483eb9e1
2 changed files with 53 additions and 20 deletions

View File

@ -40,22 +40,40 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
@override
List<Widget> getAppBarActions(BuildContext context) {
return <Widget>[
IconButton(
List<Widget> actions = [];
actions.add(
IconButton(
icon: FaIcon(FontAwesomeIcons.search),
onPressed: () {
Map<String, String> filters = {};
if (category != null) {
filters["category"] = "${category.pk}";
}
showSearch(
context: context,
delegate: PartSearchDelegate(context, filters: {"category": "${category.pk}"})
delegate: PartSearchDelegate(context, filters: filters)
);
}
),
IconButton(
icon: FaIcon(FontAwesomeIcons.edit),
tooltip: I18N.of(context).edit,
onPressed: _editCategoryDialog,
),
];
)
);
if (category != null) {
actions.add(
IconButton(
icon: FaIcon(FontAwesomeIcons.edit),
tooltip: I18N.of(context).edit,
onPressed: _editCategoryDialog,
)
);
}
return actions;
}
void _editCategory(Map<String, String> values) async {
@ -63,7 +81,6 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
final bool result = await category.update(context, values: values);
showSnackIcon(
refreshableKey,
result ? "Category edited" : "Category editing failed",
success: result
);