add setLocale method on settings

This commit is contained in:
Shawn 2022-09-07 13:25:56 -06:00
parent 828f353d26
commit b080a5b2e9

View File

@ -1,4 +1,5 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:wonders/common_libs.dart';
import 'package:wonders/logic/common/save_load_mixin.dart'; import 'package:wonders/logic/common/save_load_mixin.dart';
class SettingsLogic with ThrottledSaveLoadMixin { class SettingsLogic with ThrottledSaveLoadMixin {
@ -24,4 +25,11 @@ class SettingsLogic with ThrottledSaveLoadMixin {
'hasDismissedSearchMessage': hasDismissedSearchMessage.value, 'hasDismissedSearchMessage': hasDismissedSearchMessage.value,
}; };
} }
Future<void> setLocale(Locale value) async {
currentLocale.value = value.languageCode;
await localeLogic.refreshIfChanged(value);
wondersLogic.init();
timelineLogic.init();
}
} }