From 11f81eaee81548d32435953849699689391df964 Mon Sep 17 00:00:00 2001 From: mlch911 Date: Sun, 19 Jun 2022 23:59:04 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20UI=20Bug:=20=E7=99=BB=E5=BD=95=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/Login/LoginByName3.dart | 79 +++++++++++++------------------ 1 file changed, 32 insertions(+), 47 deletions(-) diff --git a/lib/pages/Login/LoginByName3.dart b/lib/pages/Login/LoginByName3.dart index af90f12..a006974 100644 --- a/lib/pages/Login/LoginByName3.dart +++ b/lib/pages/Login/LoginByName3.dart @@ -433,7 +433,7 @@ class _LoginPageState extends State { ///构建历史账号ListView Widget _buildListView() { double _line_height = 110; - int _height = g_users.length * _line_height.toInt(); + double _height = g_users.length * _line_height; if (_height > 550) { _height = 550; } @@ -450,60 +450,45 @@ class _LoginPageState extends State { 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: ListView.builder( shrinkWrap: true, - physics: BouncingScrollPhysics(), + physics: ClampingScrollPhysics(), + padding: EdgeInsets.zero, itemBuilder: (context, index) { UserAccount user = g_users[index]; return GestureDetector( - child: Column( - children: [ - Container( - // height: ScreenUtil().setHeight(_line_height), - // color: Colors.grey[200], - color: Colors.grey[200], - // padding: EdgeInsets.only(left: 8, top: 4, right: 8, bottom: 4), - padding: EdgeInsets.symmetric( - horizontal: ScreenUtil().setHeight(35), - vertical: ScreenUtil().setHeight(17)), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text("${(index + 1).toString()}、${user.username}"), - GestureDetector( - child: Padding( - padding: EdgeInsets.all(0), - child: Icon( - // Icons.remove_circle_outline, - Icons.highlight_off, - color: Colors.grey, - ), + child: Container( + color: Colors.grey[200], + child: Column( + children: [ + Container( + height: ScreenUtil().setHeight(_line_height - 1), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text("${(index + 1).toString()}、${user.username}"), + GestureDetector( + child: Padding( + padding: EdgeInsets.all(0), + child: Icon( + 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; - g_can_expand_ListView = g_users.length > 1; - }); - }, ), - ], - ), - Divider(height: 1.0, color: Colors.black), - ], + onTap: () { + setState(() { + g_users.remove(user); + SaveAccountPasswordManager.delUser(user); + g_can_expand_ListView = g_users.length > 1; + }); + }, + ), + ], + ), ), - ), - ], + Divider(height: ScreenUtil().setHeight(1), color: Colors.black), + ], + ), ), onTap: () { setState(() {