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,
|
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,15 +82,17 @@ 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: photo.note,
|
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;
|
_photos[photo.id] = photo;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> deleteProfile(LogbookPhoto photo) async {
|
Future<void> deleteProfile(LogbookPhoto photo) async {
|
||||||
await widget.storageService.deletePhoto(photo.id);
|
await widget.storageService.deletePhoto(photo.id);
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue