hyzp_ybqx-Commit094:优化。但还不能保存已登录的用户

This commit is contained in:
WinUser01
2022-01-26 00:40:49 +08:00
parent e28e645e13
commit c5e1a014b0
3 changed files with 17 additions and 11 deletions
+7 -7
View File
@@ -40,7 +40,7 @@ class _LoginPageState extends State<LoginByName3> {
bool bRemmberPW = false;
GlobalKey _globalKey = new GlobalKey(); //用来标记控件
bool _can_expand_ListView = false; //是否能够打开历史账号
// bool g_can_expand_ListView = false; //是否能够打开历史账号
// List<UserAccount> g_users = new List(); //历史账号
@override
@@ -256,7 +256,7 @@ class _LoginPageState extends State<LoginByName3> {
if (g_users.isNotEmpty) {
//如果个数大于1个或者唯一一个账号跟当前账号不一样才弹出历史账号
// _can_expand_ListView = !_can_expand_ListView;
_can_expand_ListView = false;
g_can_expand_ListView = false;
}
setState(() {});
}
@@ -286,17 +286,17 @@ class _LoginPageState extends State<LoginByName3> {
if (g_users.isNotEmpty) {
//如果个数大于1个或者唯一一个账号跟当前账号不一样才弹出历史账号
setState(() {
_can_expand_ListView = !_can_expand_ListView;
g_can_expand_ListView = !g_can_expand_ListView;
});
}
},
onEndBtn2: () {
// FocusManager.instance.primaryFocus.unfocus(); // 【Flutter 实战】全局点击空白处隐藏键盘
// 全局点击空白处隐藏账号输入框
print('xx2');
// print('xx2');
if (g_users.isNotEmpty) {
//如果个数大于1个或者唯一一个账号跟当前账号不一样才弹出历史账号
_can_expand_ListView = false;
g_can_expand_ListView = false;
}
setState(() {});
},
@@ -424,7 +424,7 @@ class _LoginPageState extends State<LoginByName3> {
///构建历史账号ListView
Widget _buildListView() {
if (_can_expand_ListView) {
if (g_can_expand_ListView) {
return Column(
children: [
ListView.builder(
@@ -460,7 +460,7 @@ class _LoginPageState extends State<LoginByName3> {
SaveAccountPasswordManager.delUser(user);
//处理最后一个数据,假如最后一个被删掉,将Expand置为false
//如果个数大于1个或者唯一一个账号跟当前账号不一样才弹出历史账号
_can_expand_ListView = g_users.isNotEmpty;
g_can_expand_ListView = g_users.isNotEmpty;
});
},
),