Select Git revision
GeneratedPluginRegistrant.m
settings_global.dart 1.30 KiB
import 'package:jeweled/config/default_global_settings.dart';
class GlobalSettings {
final int colorsTheme;
final int graphicTheme;
GlobalSettings({
required this.colorsTheme,
required this.graphicTheme,
});
static int getColorsThemeValueFromUnsafe(int colorsTheme) {
if (DefaultGlobalSettings.allowedColorsThemeValues.contains(colorsTheme)) {
return colorsTheme;
}
return DefaultGlobalSettings.defaultColorsThemeValue;
}
static int getGraphicThemeValueFromUnsafe(int graphicTheme) {
if (DefaultGlobalSettings.allowedGraphicThemeValues.contains(graphicTheme)) {
return graphicTheme;
}
return DefaultGlobalSettings.defaultGraphicThemeValue;
}
factory GlobalSettings.createDefault() {
return GlobalSettings(
colorsTheme: DefaultGlobalSettings.defaultColorsThemeValue,
graphicTheme: DefaultGlobalSettings.defaultGraphicThemeValue,
);
}
void dump() {
print('Settings: ');
print(' colorsTheme: ' + colorsTheme.toString());
print(' graphicTheme: ' + graphicTheme.toString());
}
String toString() {
return 'GlobalSettings(' + this.toJson().toString() + ')';
}
Map<String, dynamic>? toJson() {
return <String, dynamic>{
'colorsTheme': this.colorsTheme,
'graphicTheme': this.graphicTheme,
};
}
}