reset selected equipment profile when layout feature is disabled

This commit is contained in:
Vadim 2023-07-14 00:06:18 +02:00
parent b42ad01b7c
commit 7633f3fd27

View file

@ -76,13 +76,23 @@ class _InheritedListeners extends StatelessWidget {
onDidChangeDependencies: (value) { onDidChangeDependencies: (value) {
context.read<MeteringBloc>().add(EquipmentProfileChangedEvent(value)); context.read<MeteringBloc>().add(EquipmentProfileChangedEvent(value));
}, },
child: InheritedModelAspectListener<MeteringScreenLayoutFeature, bool>(
aspect: MeteringScreenLayoutFeature.equipmentProfiles,
onDidChangeDependencies: (value) {
if (!value) {
EquipmentProfileProvider.of(context).setProfile(context.get<EquipmentProfiles>().first);
}
},
child: InheritedModelAspectListener<MeteringScreenLayoutFeature, bool>( child: InheritedModelAspectListener<MeteringScreenLayoutFeature, bool>(
aspect: MeteringScreenLayoutFeature.filmPicker, aspect: MeteringScreenLayoutFeature.filmPicker,
onDidChangeDependencies: (value) { onDidChangeDependencies: (value) {
if (!value) context.read<MeteringBloc>().add(const FilmChangedEvent(Film.other())); if (!value) {
context.read<MeteringBloc>().add(const FilmChangedEvent(Film.other()));
}
}, },
child: child, child: child,
), ),
),
); );
} }
} }