Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit 2625d32

Browse files
Vande Perre NathanPiotrFLEURY
authored andcommitted
fix(camera) : fixed error on camera cancel
1 parent a5cd081 commit 2625d32

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
144144
- Analytics : Added new analytics
145145
- Wishlist color : wishslist color is now fixed on a new wishlist
146146
- Item image : items with old images now have an icon
147+
- Camera : fixed error on camera cancel
147148

148149
### Security
149150

lib/pages/items_page.dart

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -465,18 +465,25 @@ class EditItemPageState extends State<EditItemPage> {
465465
}
466466

467467
Future<void> pickImage() async {
468-
await _imageService
469-
.pickCamera(30, 720, 720)
470-
.then((image) => pickedImage = File(image.path));
468+
String path;
471469

472-
setState(() {
473-
_itemImage = Image(
474-
image: FileImage(pickedImage),
475-
fit: BoxFit.cover,
476-
);
470+
await _imageService.pickCamera(30, 720, 720).then((image) {
471+
if (image != null && image.path != null) {
472+
path = image.path;
473+
}
477474
});
478475

479-
imageType = "Picked";
476+
if (path != null) {
477+
pickedImage = File(path);
478+
setState(() {
479+
_itemImage = Image(
480+
image: FileImage(pickedImage),
481+
fit: BoxFit.cover,
482+
);
483+
});
484+
485+
imageType = "Picked";
486+
}
480487
}
481488

482489
int getTypeIndex() {

0 commit comments

Comments
 (0)