This commit is contained in:
Vadim 2023-08-14 12:01:59 +02:00
parent 301814c6b2
commit f9f22324db

View file

@ -74,7 +74,7 @@ class _UserPreferencesProviderState extends State<UserPreferencesProvider>
late bool dynamicColor = userPreferencesService.dynamicColor; late bool dynamicColor = userPreferencesService.dynamicColor;
late EvSourceType evSourceType; late EvSourceType evSourceType;
late MeteringScreenLayoutConfig meteringScreenLayout = late MeteringScreenLayoutConfig meteringScreenLayout =
ServicesProvider.of(context).userPreferencesService.meteringScreenLayout; userPreferencesService.meteringScreenLayout;
late Color primaryColor = userPreferencesService.primaryColor; late Color primaryColor = userPreferencesService.primaryColor;
late StopType stopType = userPreferencesService.stopType; late StopType stopType = userPreferencesService.stopType;
late SupportedLocale locale = userPreferencesService.locale; late SupportedLocale locale = userPreferencesService.locale;
@ -83,7 +83,7 @@ class _UserPreferencesProviderState extends State<UserPreferencesProvider>
@override @override
void initState() { void initState() {
super.initState(); super.initState();
evSourceType = ServicesProvider.of(context).userPreferencesService.evSourceType; evSourceType = userPreferencesService.evSourceType;
evSourceType = evSourceType == EvSourceType.sensor && evSourceType = evSourceType == EvSourceType.sensor &&
!ServicesProvider.of(context).environment.hasLightSensor !ServicesProvider.of(context).environment.hasLightSensor
? EvSourceType.camera ? EvSourceType.camera
@ -145,7 +145,7 @@ class _UserPreferencesProviderState extends State<UserPreferencesProvider>
setState(() { setState(() {
dynamicColor = enable; dynamicColor = enable;
}); });
ServicesProvider.of(context).userPreferencesService.dynamicColor = enable; userPreferencesService.dynamicColor = enable;
} }
void toggleEvSourceType() { void toggleEvSourceType() {
@ -160,7 +160,7 @@ class _UserPreferencesProviderState extends State<UserPreferencesProvider>
evSourceType = EvSourceType.camera; evSourceType = EvSourceType.camera;
} }
}); });
ServicesProvider.of(context).userPreferencesService.evSourceType = evSourceType; userPreferencesService.evSourceType = evSourceType;
} }
void setLocale(SupportedLocale locale) { void setLocale(SupportedLocale locale) {
@ -168,7 +168,7 @@ class _UserPreferencesProviderState extends State<UserPreferencesProvider>
setState(() { setState(() {
this.locale = locale; this.locale = locale;
}); });
ServicesProvider.of(context).userPreferencesService.locale = locale; userPreferencesService.locale = locale;
}); });
} }
@ -176,28 +176,28 @@ class _UserPreferencesProviderState extends State<UserPreferencesProvider>
setState(() { setState(() {
meteringScreenLayout = config; meteringScreenLayout = config;
}); });
ServicesProvider.of(context).userPreferencesService.meteringScreenLayout = meteringScreenLayout; userPreferencesService.meteringScreenLayout = meteringScreenLayout;
} }
void setPrimaryColor(Color primaryColor) { void setPrimaryColor(Color primaryColor) {
setState(() { setState(() {
this.primaryColor = primaryColor; this.primaryColor = primaryColor;
}); });
ServicesProvider.of(context).userPreferencesService.primaryColor = primaryColor; userPreferencesService.primaryColor = primaryColor;
} }
void setStopType(StopType stopType) { void setStopType(StopType stopType) {
setState(() { setState(() {
this.stopType = stopType; this.stopType = stopType;
}); });
ServicesProvider.of(context).userPreferencesService.stopType = stopType; userPreferencesService.stopType = stopType;
} }
void setThemeType(ThemeType themeType) { void setThemeType(ThemeType themeType) {
setState(() { setState(() {
this.themeType = themeType; this.themeType = themeType;
}); });
ServicesProvider.of(context).userPreferencesService.themeType = themeType; userPreferencesService.themeType = themeType;
} }
Brightness get _themeBrightness { Brightness get _themeBrightness {