支持主题切换

This commit is contained in:
NewTab
2022-01-21 19:54:59 +08:00
parent b8b195b663
commit b9d0071302
12 changed files with 813 additions and 175 deletions

View File

@@ -8,11 +8,13 @@ class UserInfoViewModel {
String? _userName;
String? _passWord;
bool _useSecertLogined = false;
int _primaryColor = 0xFF299343;
UserInfoViewModel() {
String userInfoJson = SpUtil.getString(spUserInfo);
_userName = SpUtil.getString(spUserName);
_passWord = SpUtil.getString(spPassWord);
_primaryColor = SpUtil.getInt(spCustomColor, defValue: 0xFF299343);
_useSecertLogined = SpUtil.getBool(spSecretLogined, defValue: false);
_host = SpUtil.getString(spHost, defValue: '');
@@ -39,6 +41,11 @@ class UserInfoViewModel {
SpUtil.putBool(spSecretLogined, _useSecertLogined);
}
void updateCustomColor(int color) {
_primaryColor = color;
SpUtil.putInt(spCustomColor, color);
}
void updateHost(String host) {
_host = host;
SpUtil.putString(spHost, host);
@@ -54,6 +61,8 @@ class UserInfoViewModel {
bool get useSecretLogined => _useSecertLogined;
int get primaryColor => _primaryColor;
bool isLogined() {
return token != null && token!.isNotEmpty;
}