added photo update

This commit is contained in:
Vadim 2025-07-10 13:52:48 +02:00
parent 4e7c080b97
commit 1412ce2b3e
3 changed files with 15 additions and 26 deletions

View file

@ -70,7 +70,6 @@ class LogbookPhotosProviderState extends State<LogbookPhotosProvider> {
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<LogbookPhotosProvider> {
Future<void> 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<void> deleteProfile(LogbookPhoto photo) async {

View file

@ -22,7 +22,6 @@ class LogbookPhotoEditBloc extends Bloc<LogbookPhotoEditEvent, LogbookPhotoEditS
ev: photo.ev,
iso: photo.iso,
nd: photo.nd,
film: photo.film,
coordinates: photo.coordinates,
aperture: null,
shutterSpeed: null,

View file

@ -7,7 +7,6 @@ class LogbookPhotoEditState {
final double ev;
final int iso;
final int nd;
final Film film;
final Coordinates? coordinates;
final ApertureValue? aperture;
final ShutterSpeedValue? shutterSpeed;
@ -22,7 +21,6 @@ class LogbookPhotoEditState {
required this.ev,
required this.iso,
required this.nd,
required this.film,
this.coordinates,
this.aperture,
this.shutterSpeed,
@ -32,14 +30,7 @@ class LogbookPhotoEditState {
});
LogbookPhotoEditState copyWith({
String? id,
String? name,
DateTime? timestamp,
double? ev,
int? iso,
int? nd,
Film? film,
Coordinates? coordinates,
ApertureValue? aperture,
ShutterSpeedValue? shutterSpeed,
String? note,
@ -47,14 +38,12 @@ class LogbookPhotoEditState {
bool? isLoading,
}) =>
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,