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 4f5268f..c0a8a12 100644 --- a/lib/screens/logbook_photo_edit/bloc_logbook_photo_edit.dart +++ b/lib/screens/logbook_photo_edit/bloc_logbook_photo_edit.dart @@ -51,7 +51,7 @@ class LogbookPhotoEditBloc extends Bloc extends StatelessWidget { final String title; final T? selectedValue; final List values; - final ValueChanged onChanged; + final ValueChanged> onChanged; const PickerListTile({ required this.icon, @@ -26,14 +26,17 @@ class PickerListTile extends StatelessWidget { title: Text(title), trailing: Text(selectedValue?.toString() ?? S.of(context).notSet), onTap: () { - showDialog( + showDialog>( context: context, - builder: (_) => DialogPicker( + builder: (_) => DialogPicker>( icon: icon, title: title, - selectedValue: selectedValue, - values: [null, ...values], - titleAdapter: (context, value) => value?.toString() ?? S.of(context).notSet, + selectedValue: Optional(selectedValue), + values: [ + const Optional(null), + ...values.toSet().map((e) => Optional(e)), + ], + titleAdapter: (context, value) => value.value?.toString() ?? S.of(context).notSet, ), ).then((value) { if (value != null) { diff --git a/lib/screens/logbook_photo_edit/screen_logbook_photo_edit.dart b/lib/screens/logbook_photo_edit/screen_logbook_photo_edit.dart index c9de7f4..804ec87 100644 --- a/lib/screens/logbook_photo_edit/screen_logbook_photo_edit.dart +++ b/lib/screens/logbook_photo_edit/screen_logbook_photo_edit.dart @@ -224,7 +224,7 @@ class _AperturePickerListTile extends StatelessWidget { values: ApertureValue.values, selectedValue: state.aperture, onChanged: (value) { - context.read().add(LogbookPhotoApertureChangedEvent(value)); + context.read().add(LogbookPhotoApertureChangedEvent(value.value)); }, ), ); @@ -244,7 +244,7 @@ class _ShutterSpeedPickerListTile extends StatelessWidget { values: ShutterSpeedValue.values, selectedValue: state.shutterSpeed, onChanged: (value) { - context.read().add(LogbookPhotoShutterSpeedChangedEvent(value)); + context.read().add(LogbookPhotoShutterSpeedChangedEvent(value.value)); }, ), ); diff --git a/lib/screens/logbook_photo_edit/state_logbook_photo_edit.dart b/lib/screens/logbook_photo_edit/state_logbook_photo_edit.dart index bb68760..f205fe5 100644 --- a/lib/screens/logbook_photo_edit/state_logbook_photo_edit.dart +++ b/lib/screens/logbook_photo_edit/state_logbook_photo_edit.dart @@ -31,8 +31,8 @@ class LogbookPhotoEditState { LogbookPhotoEditState copyWith({ String? name, - ApertureValue? aperture, - ShutterSpeedValue? shutterSpeed, + Optional? aperture, + Optional? shutterSpeed, String? note, bool? canSave, bool? isLoading, @@ -44,8 +44,8 @@ class LogbookPhotoEditState { ev: ev, iso: iso, nd: nd, - aperture: aperture ?? this.aperture, - shutterSpeed: shutterSpeed ?? this.shutterSpeed, + aperture: aperture != null ? aperture.value : this.aperture, + shutterSpeed: shutterSpeed != null ? shutterSpeed.value : this.shutterSpeed, note: note ?? this.note, canSave: canSave ?? this.canSave, isLoading: isLoading ?? this.isLoading, diff --git a/pubspec.lock b/pubspec.lock index 7e56007..e95eb64 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -894,11 +894,11 @@ packages: dependency: "direct main" description: path: "." - ref: "v2.3.0" - resolved-ref: a8c419f21fcda06d76d26cc2416de459f0d51a60 + ref: "v2.3.1" + resolved-ref: "8b39ac1927b791652618509abe0391f844229b93" url: "https://github.com/vodemn/m3_lightmeter_resources" source: git - version: "2.3.0+11" + version: "2.3.1+12" macros: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index e57257a..a1ce9b7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -37,7 +37,7 @@ dependencies: m3_lightmeter_resources: git: url: "https://github.com/vodemn/m3_lightmeter_resources" - ref: v2.3.0 + ref: v2.3.1 map_launcher: 3.2.0 material_color_utilities: 0.12.0 package_info_plus: 8.1.3 @@ -68,6 +68,10 @@ dev_dependencies: dependency_overrides: geolocator_android: 4.6.1 + m3_lightmeter_resources: + git: + url: "https://github.com/vodemn/m3_lightmeter_resources" + ref: v2.3.1 material_color_utilities: 0.11.1 flutter: