2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-16 04:05:28 +00:00

Format code

This commit is contained in:
Asterix\Oliver
2025-06-14 10:59:13 +10:00
parent 0349ebb0b3
commit 387dc1eb39
96 changed files with 5478 additions and 7340 deletions

View File

@ -11,19 +11,15 @@ import "package:inventree/widget/snacks.dart";
import "package:inventree/l10.dart";
class PartImageWidget extends StatefulWidget {
const PartImageWidget(this.part, {Key? key}) : super(key: key);
final InvenTreePart part;
@override
_PartImageState createState() => _PartImageState(part);
}
class _PartImageState extends RefreshableState<PartImageWidget> {
_PartImageState(this.part);
final InvenTreePart part;
@ -38,32 +34,24 @@ class _PartImageState extends RefreshableState<PartImageWidget> {
@override
List<Widget> appBarActions(BuildContext context) {
List<Widget> actions = [];
if (part.canEdit) {
// File upload
actions.add(
IconButton(
icon: Icon(TablerIcons.file_upload),
onPressed: () async {
actions.add(IconButton(
icon: Icon(TablerIcons.file_upload),
onPressed: () async {
FilePickerDialog.pickFile(onPicked: (File file) async {
final result = await part.uploadImage(file);
FilePickerDialog.pickFile(
onPicked: (File file) async {
final result = await part.uploadImage(file);
if (!result) {
showSnackIcon(L10().uploadFailed, success: false);
}
if (!result) {
showSnackIcon(L10().uploadFailed, success: false);
}
refresh(context);
}
);
},
)
);
refresh(context);
});
},
));
}
return actions;
@ -73,5 +61,4 @@ class _PartImageState extends RefreshableState<PartImageWidget> {
Widget getBody(BuildContext context) {
return InvenTreeAPI().getImage(part.image);
}
}
}