强制横屏

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