hyzp_ybqx-Commit097:优化。已经能够保存已登录的用户信息

This commit is contained in:
WinUser01
2022-01-26 02:03:00 +08:00
parent d70a3cefd2
commit bfe8777199
+69 -53
View File
@@ -418,65 +418,81 @@ class _LoginPageState extends State<LoginByName3> {
///构建历史账号ListView
Widget _buildListView() {
if (g_can_expand_ListView) {
return Column(
children: [
ListView.builder(
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, index) {
UserAccount user = g_users[index];
return GestureDetector(
child: Column(
children: [
Container(
width: ScreenUtil().screenWidth * 0.9,
// color: Colors.grey[200],
color: Colors.grey[200],
padding: EdgeInsets.only(left: 8, top: 8, right: 8, bottom: 8),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text("${user.username}"),
GestureDetector(
child: Padding(
padding: EdgeInsets.all(0),
child: Icon(
// Icons.remove_circle_outline,
Icons.highlight_off,
color: Colors.grey,
return Center(
child: Container(
width: ScreenUtil().screenWidth * 0.9,
decoration: BoxDecoration(
border: Border(
left: BorderSide(width: 1, color: Colors.black),
right: BorderSide(width: 1, color: Colors.black),
bottom: BorderSide(width: 1, color: Colors.black),
),
),
// decoration: new BoxDecoration(
// border: new Border.all(color: Colors.black, width: 0.5),
// // color: Colors.black,
// // borderRadius: new BorderRadius.circular((20.0)),
// ),
child: Column(
children: [
ListView.builder(
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, index) {
UserAccount user = g_users[index];
return GestureDetector(
child: Column(
children: [
Container(
// color: Colors.grey[200],
color: Colors.grey[200],
padding: EdgeInsets.only(left: 8, top: 8, right: 8, bottom: 8),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text("${user.username}"),
GestureDetector(
child: Padding(
padding: EdgeInsets.all(0),
child: Icon(
// Icons.remove_circle_outline,
Icons.highlight_off,
color: Colors.grey,
),
),
onTap: () {
setState(() {
g_users.remove(user);
SaveAccountPasswordManager.delUser(user);
//处理最后一个数据,假如最后一个被删掉,将Expand置为false
//如果个数大于1个或者唯一一个账号跟当前账号不一样才弹出历史账号
g_can_expand_ListView = g_users.isNotEmpty;
});
},
),
),
onTap: () {
setState(() {
g_users.remove(user);
SaveAccountPasswordManager.delUser(user);
//处理最后一个数据,假如最后一个被删掉,将Expand置为false
//如果个数大于1个或者唯一一个账号跟当前账号不一样才弹出历史账号
g_can_expand_ListView = g_users.isNotEmpty;
});
},
],
),
Divider(height: 1.0, color: Colors.black),
],
),
Divider(height: 1.0, color: Colors.black),
],
),
),
],
),
],
),
onTap: () {
setState(() {
g_userInfo.username = user.username;
g_userInfo.password = user.password;
});
onTap: () {
setState(() {
g_userInfo.username = user.username;
g_userInfo.password = user.password;
});
},
);
},
);
},
itemCount: g_users.length,
)
],
itemCount: g_users.length,
)
],
),
),
);
}
return Container();