update equipment profile from dialog

This commit is contained in:
Vadim 2023-09-08 21:41:10 +02:00
parent 16c81a7116
commit 46ee72174f
2 changed files with 5 additions and 9 deletions

View file

@ -84,16 +84,8 @@ class _InheritedListeners extends StatelessWidget {
context.read<MeteringBloc>().add(const FilmChangedEvent(Film.other()));
}
},
child: MeteringScreenLayoutFeatureListener(
feature: MeteringScreenLayoutFeature.equipmentProfiles,
onDidChangeDependencies: (value) {
if (!value) {
EquipmentProfileProvider.of(context).setProfile(EquipmentProfiles.of(context).first);
}
},
child: child,
),
),
);
}
}

View file

@ -3,6 +3,7 @@ import 'package:lightmeter/data/models/metering_screen_layout_config.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/providers/user_preferences_provider.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
class MeteringScreenLayoutFeaturesDialog extends StatefulWidget {
const MeteringScreenLayoutFeaturesDialog({super.key});
@ -48,6 +49,9 @@ class _MeteringScreenLayoutFeaturesDialogState extends State<MeteringScreenLayou
),
TextButton(
onPressed: () {
if (!_features[MeteringScreenLayoutFeature.equipmentProfiles]!) {
EquipmentProfileProvider.of(context).setProfile(EquipmentProfiles.of(context).first);
}
UserPreferencesProvider.of(context).setMeteringScreenLayout(_features);
Navigator.of(context).pop();
},