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, ev: ev100,
iso: iso, iso: iso,
nd: nd, nd: nd,
film: Films.selectedOf(context),
coordinates: null, // TODO coordinates: null, // TODO
); );
//await widget.storageService.addPhoto(photo); //await widget.storageService.addPhoto(photo);
@ -83,14 +82,16 @@ class LogbookPhotosProviderState extends State<LogbookPhotosProvider> {
Future<void> updateProfile(LogbookPhoto photo) async { Future<void> updateProfile(LogbookPhoto photo) async {
final oldProfile = _photos[photo.id]!; final oldProfile = _photos[photo.id]!;
if (oldProfile.note != photo.note) { await widget.storageService.updatePhoto(
await widget.storageService.updatePhoto( id: photo.id,
id: photo.id, note: oldProfile.note != photo.note ? photo.note : null,
note: photo.note, apertureValue: oldProfile.apertureValue != photo.apertureValue ? photo.apertureValue : null,
); removeApertureValue: photo.apertureValue == null,
_photos[photo.id] = photo; shutterSpeedValue: oldProfile.shutterSpeedValue != photo.shutterSpeedValue ? photo.shutterSpeedValue : null,
setState(() {}); removeShutterSpeedValue: photo.shutterSpeedValue == null,
} );
_photos[photo.id] = photo;
setState(() {});
} }
Future<void> deleteProfile(LogbookPhoto photo) async { Future<void> deleteProfile(LogbookPhoto photo) async {

View file

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

View file

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