Fixed MeteringScreenLayoutConfig updates

This commit is contained in:
Vadim 2023-08-14 11:20:09 +02:00
parent 4ea9288741
commit fe4d1dfb58

View file

@ -75,7 +75,7 @@ class _UserPreferencesProviderState extends State<UserPreferencesProvider>
late bool dynamicColor = userPreferencesService.dynamicColor; late bool dynamicColor = userPreferencesService.dynamicColor;
late EvSourceType evSourceType; late EvSourceType evSourceType;
late final MeteringScreenLayoutConfig meteringScreenLayout = late MeteringScreenLayoutConfig meteringScreenLayout =
ServicesProvider.of(context).userPreferencesService.meteringScreenLayout; ServicesProvider.of(context).userPreferencesService.meteringScreenLayout;
late Color primaryColor = userPreferencesService.primaryColor; late Color primaryColor = userPreferencesService.primaryColor;
late StopType stopType = userPreferencesService.stopType; late StopType stopType = userPreferencesService.stopType;
@ -174,13 +174,7 @@ class _UserPreferencesProviderState extends State<UserPreferencesProvider>
void setMeteringScreenLayout(MeteringScreenLayoutConfig config) { void setMeteringScreenLayout(MeteringScreenLayoutConfig config) {
setState(() { setState(() {
config.forEach((key, value) { meteringScreenLayout = config;
meteringScreenLayout.update(
key,
(_) => value,
ifAbsent: () => value,
);
});
}); });
ServicesProvider.of(context).userPreferencesService.meteringScreenLayout = meteringScreenLayout; ServicesProvider.of(context).userPreferencesService.meteringScreenLayout = meteringScreenLayout;
} }