diff --git a/lib/providers/equipment_profile_provider.dart b/lib/providers/equipment_profile_provider.dart index 5ebcd8c..3be0eff 100644 --- a/lib/providers/equipment_profile_provider.dart +++ b/lib/providers/equipment_profile_provider.dart @@ -73,13 +73,13 @@ class EquipmentProfilesProviderState extends State { final oldProfile = _customProfiles[profile.id]!.value; await widget.storageService.updateProfile( id: profile.id, - name: oldProfile.name != profile.name ? profile.name : null, - apertureValues: oldProfile.apertureValues != profile.apertureValues ? profile.apertureValues : null, - shutterSpeedValues: - oldProfile.shutterSpeedValues != profile.shutterSpeedValues ? profile.shutterSpeedValues : null, - isoValues: oldProfile.isoValues != profile.isoValues ? profile.isoValues : null, - ndValues: oldProfile.ndValues != profile.ndValues ? profile.ndValues : null, - lensZoom: oldProfile.lensZoom != profile.lensZoom ? profile.lensZoom : null, + name: oldProfile.name.changedOrNull(profile.name), + apertureValues: oldProfile.apertureValues.changedOrNull(profile.apertureValues), + shutterSpeedValues: oldProfile.shutterSpeedValues.changedOrNull(profile.shutterSpeedValues), + isoValues: oldProfile.isoValues.changedOrNull(profile.isoValues), + ndValues: oldProfile.ndValues.changedOrNull(profile.ndValues), + lensZoom: oldProfile.lensZoom.changedOrNull(profile.lensZoom), + exposureOffset: oldProfile.exposureOffset.changedOrNull(profile.exposureOffset), ); _customProfiles[profile.id] = (value: profile, isUsed: _customProfiles[profile.id]!.isUsed); setState(() {}); @@ -183,3 +183,9 @@ class EquipmentProfiles extends InheritedModel<_EquipmentProfilesModelAspect> { const DeepCollectionEquality().equals(oldWidget.profiles, profiles)); } } + +extension on Object { + T? changedOrNull(T newValue) { + return this != newValue ? newValue : null; + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 395d9f3..a5dd986 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -32,11 +32,11 @@ dependencies: m3_lightmeter_iap: git: url: "https://github.com/vodemn/m3_lightmeter_iap" - ref: v2.1.3 + ref: v2.2.0 m3_lightmeter_resources: git: url: "https://github.com/vodemn/m3_lightmeter_resources" - ref: v2.1.0 + ref: v2.2.0 material_color_utilities: 0.12.0 package_info_plus: 8.1.3 permission_handler: 11.3.1 diff --git a/scripts/update_goldens.sh b/scripts/update_goldens.sh index 05d1ea6..73eeb3f 100644 --- a/scripts/update_goldens.sh +++ b/scripts/update_goldens.sh @@ -1,6 +1,6 @@ defaults -currentHost write -g AppleFontSmoothing -int 0 goldens=$(find ./test -name "*_golden_test.dart" -print) for f in $goldens; do - flutter test "$f" --dart-define cameraStubImage=assets/camera_stub_image.jpg --update-goldens + fvm flutter test "$f" --dart-define cameraStubImage=assets/camera_stub_image.jpg --update-goldens done defaults -currentHost write -g AppleFontSmoothing -int 3