From 1412ce2b3e5c20bd19f4a79423721980b3143dd6 Mon Sep 17 00:00:00 2001 From: Vadim <44135514+vodemn@users.noreply.github.com> Date: Thu, 10 Jul 2025 13:52:48 +0200 Subject: [PATCH] added photo update --- lib/providers/logbook_photos_provider.dart | 19 +++++++++-------- .../bloc_logbook_photo_edit.dart | 1 - .../state_logbook_photo_edit.dart | 21 +++++-------------- 3 files changed, 15 insertions(+), 26 deletions(-) diff --git a/lib/providers/logbook_photos_provider.dart b/lib/providers/logbook_photos_provider.dart index f8c35a2..d91b638 100644 --- a/lib/providers/logbook_photos_provider.dart +++ b/lib/providers/logbook_photos_provider.dart @@ -70,7 +70,6 @@ class LogbookPhotosProviderState extends State { ev: ev100, iso: iso, nd: nd, - film: Films.selectedOf(context), coordinates: null, // TODO ); //await widget.storageService.addPhoto(photo); @@ -83,14 +82,16 @@ class LogbookPhotosProviderState extends State { Future updateProfile(LogbookPhoto photo) async { final oldProfile = _photos[photo.id]!; - if (oldProfile.note != photo.note) { - await widget.storageService.updatePhoto( - id: photo.id, - note: photo.note, - ); - _photos[photo.id] = photo; - setState(() {}); - } + await widget.storageService.updatePhoto( + id: photo.id, + note: oldProfile.note != photo.note ? photo.note : null, + apertureValue: oldProfile.apertureValue != photo.apertureValue ? photo.apertureValue : null, + removeApertureValue: photo.apertureValue == null, + shutterSpeedValue: oldProfile.shutterSpeedValue != photo.shutterSpeedValue ? photo.shutterSpeedValue : null, + removeShutterSpeedValue: photo.shutterSpeedValue == null, + ); + _photos[photo.id] = photo; + setState(() {}); } Future deleteProfile(LogbookPhoto photo) async { diff --git a/lib/screens/logbook_photo_edit/bloc_logbook_photo_edit.dart b/lib/screens/logbook_photo_edit/bloc_logbook_photo_edit.dart index 461ac13..2a794d9 100644 --- a/lib/screens/logbook_photo_edit/bloc_logbook_photo_edit.dart +++ b/lib/screens/logbook_photo_edit/bloc_logbook_photo_edit.dart @@ -22,7 +22,6 @@ class LogbookPhotoEditBloc extends Bloc LogbookPhotoEditState( - id: id ?? this.id, + id: id, name: name ?? this.name, - timestamp: timestamp ?? this.timestamp, - ev: ev ?? this.ev, - iso: iso ?? this.iso, - nd: nd ?? this.nd, - film: film ?? this.film, - coordinates: coordinates ?? this.coordinates, + timestamp: timestamp, + ev: ev, + iso: iso, + nd: nd, aperture: aperture ?? this.aperture, shutterSpeed: shutterSpeed ?? this.shutterSpeed, note: note ?? this.note,