mirror of
https://github.com/inventree/inventree-app.git
synced 2025-05-03 07:48:53 +00:00
Fix null ptr errors
This commit is contained in:
parent
911f988fa5
commit
33483eb9e1
@ -40,22 +40,40 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
List<Widget> getAppBarActions(BuildContext context) {
|
List<Widget> getAppBarActions(BuildContext context) {
|
||||||
return <Widget>[
|
|
||||||
IconButton(
|
List<Widget> actions = [];
|
||||||
|
|
||||||
|
actions.add(
|
||||||
|
IconButton(
|
||||||
icon: FaIcon(FontAwesomeIcons.search),
|
icon: FaIcon(FontAwesomeIcons.search),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
|
||||||
|
Map<String, String> filters = {};
|
||||||
|
|
||||||
|
if (category != null) {
|
||||||
|
filters["category"] = "${category.pk}";
|
||||||
|
}
|
||||||
|
|
||||||
showSearch(
|
showSearch(
|
||||||
context: context,
|
context: context,
|
||||||
delegate: PartSearchDelegate(context, filters: {"category": "${category.pk}"})
|
delegate: PartSearchDelegate(context, filters: filters)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
),
|
)
|
||||||
IconButton(
|
);
|
||||||
icon: FaIcon(FontAwesomeIcons.edit),
|
|
||||||
tooltip: I18N.of(context).edit,
|
if (category != null) {
|
||||||
onPressed: _editCategoryDialog,
|
actions.add(
|
||||||
),
|
IconButton(
|
||||||
];
|
icon: FaIcon(FontAwesomeIcons.edit),
|
||||||
|
tooltip: I18N.of(context).edit,
|
||||||
|
onPressed: _editCategoryDialog,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return actions;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _editCategory(Map<String, String> values) async {
|
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);
|
final bool result = await category.update(context, values: values);
|
||||||
|
|
||||||
showSnackIcon(
|
showSnackIcon(
|
||||||
refreshableKey,
|
|
||||||
result ? "Category edited" : "Category editing failed",
|
result ? "Category edited" : "Category editing failed",
|
||||||
success: result
|
success: result
|
||||||
);
|
);
|
||||||
|
@ -39,22 +39,39 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
List<Widget> getAppBarActions(BuildContext context) {
|
List<Widget> getAppBarActions(BuildContext context) {
|
||||||
return <Widget>[
|
|
||||||
|
List<Widget> actions = [];
|
||||||
|
|
||||||
|
actions.add(
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: FaIcon(FontAwesomeIcons.search),
|
icon: FaIcon(FontAwesomeIcons.search),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
|
||||||
|
Map<String, String> filters = {};
|
||||||
|
|
||||||
|
if (location != null) {
|
||||||
|
filters["location"] = "${location.pk}";
|
||||||
|
}
|
||||||
|
|
||||||
showSearch(
|
showSearch(
|
||||||
context: context,
|
context: context,
|
||||||
delegate: StockSearchDelegate(context, filters: {"location": "${location.pk}"})
|
delegate: StockSearchDelegate(context, filters: filters)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
IconButton(
|
);
|
||||||
icon: FaIcon(FontAwesomeIcons.edit),
|
|
||||||
tooltip: I18N.of(context).edit,
|
if (location != null) {
|
||||||
onPressed: _editLocationDialog,
|
actions.add(
|
||||||
)
|
IconButton(
|
||||||
];
|
icon: FaIcon(FontAwesomeIcons.edit),
|
||||||
|
tooltip: I18N.of(context).edit,
|
||||||
|
onPressed: _editLocationDialog,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _editLocation(Map<String, String> values) async {
|
void _editLocation(Map<String, String> values) async {
|
||||||
@ -62,7 +79,6 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
|||||||
final bool result = await location.update(context, values: values);
|
final bool result = await location.update(context, values: values);
|
||||||
|
|
||||||
showSnackIcon(
|
showSnackIcon(
|
||||||
refreshableKey,
|
|
||||||
result ? "Location edited" : "Location editing failed",
|
result ? "Location edited" : "Location editing failed",
|
||||||
success: result
|
success: result
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user