mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2025-08-05 04:36:41 +00:00
added photo update
This commit is contained in:
parent
4e7c080b97
commit
1412ce2b3e
3 changed files with 15 additions and 26 deletions
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue