强制横屏

This commit is contained in:
jyuesong
2022-05-30 14:22:09 +08:00
parent 5f91160d9a
commit 62537f5814

View File

@ -26,8 +26,7 @@ class UserInfoViewModel {
_useSecertLogined = SpUtil.getBool(spSecretLogined, defValue: false);
_host = SpUtil.getString(spHost, defValue: '');
List<dynamic>? tempList =
jsonDecode(SpUtil.getString(spLoginHistory, defValue: '[]'));
List<dynamic>? tempList = jsonDecode(SpUtil.getString(spLoginHistory, defValue: '[]'));
if (tempList != null && tempList.isNotEmpty) {
for (Map<String, dynamic> value in tempList) {
@ -41,8 +40,7 @@ class UserInfoViewModel {
SpUtil.putString(spUserInfo, token);
}
void updateUserName(
String host, String userName, String password, bool secretLogin) {
void updateUserName(String host, String userName, String password, bool secretLogin) {
updateHost(host);
_useSecretLogin(secretLogin);
_userName = userName;
@ -95,13 +93,11 @@ class UserInfoViewModel {
historyAccounts.removeWhere((element) => element.host == _host);
historyAccounts.insert(
0,
UserInfoBean(
userName: _userName,
password: _passWord,
useSecretLogined: _useSecertLogined,
host: _host));
historyAccounts.insert(0, UserInfoBean(userName: _userName, password: _passWord, useSecretLogined: _useSecertLogined, host: _host));
while (historyAccounts.length > 5) {
historyAccounts.removeLast();
}
SpUtil.putString(spLoginHistory, jsonEncode(historyAccounts));
}
@ -121,8 +117,7 @@ class UserInfoBean {
bool useSecretLogined = false;
String? host;
UserInfoBean(
{this.userName, this.password, this.useSecretLogined = false, this.host});
UserInfoBean({this.userName, this.password, this.useSecretLogined = false, this.host});
UserInfoBean.fromJson(Map<String, dynamic> json) {
userName = json['userName'];