add setting page

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages committed 2022-08-15 08:56:42 +08:00
1 parent f812adedff
commit 5887334c2e
8 files changed
+1066 -460

No files matched your search

+32 -1
View File
@@ -55,7 +55,6 @@ class MyTheme {
bool isDarkTheme() {
final isDark = "Y" == Get.find<SharedPreferences>().getString("darkTheme");
debugPrint("current is dark theme: $isDark");
return isDark;
}
@@ -482,3 +481,35 @@ String translate(String name) {
}
return platformFFI.translate(name, localeName);
}
bool option2bool(String key, String value) {
bool res;
if (key.startsWith("enable-")) {
res = value != "N";
} else if (key.startsWith("allow-") ||
key == "stop-service" ||
key == "direct-server" ||
key == "stop-rendezvous-service") {
res = value == "Y";
} else {
assert(false);
res = value != "N";
}
return res;
}
String bool2option(String key, bool option) {
String res;
if (key.startsWith('enable-')) {
res = option ? '' : 'N';
} else if (key.startsWith('allow-') ||
key == "stop-service" ||
key == "direct-server" ||
key == "stop-rendezvous-service") {
res = option ? 'Y' : '';
} else {
assert(false);
res = option ? 'Y' : 'N';
}
return res;
}