From 5a5b20eb7e636fed0852bbd0b4bf61e991837096 Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Fri, 7 Oct 2022 15:24:56 +0800 Subject: [PATCH] refactor: login screen styles --- lib/screens/login.dart | 70 +++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 45 deletions(-) diff --git a/lib/screens/login.dart b/lib/screens/login.dart index c8723d3..d5bfe51 100644 --- a/lib/screens/login.dart +++ b/lib/screens/login.dart @@ -33,9 +33,6 @@ class _LoginScreenState extends State { final auth = Provider.of(context); final account = auth.accounts![index]; return LinkWidget( - onTap: () { - auth.setActiveAccountAndReload(index); - }, onLongPress: () { theme.showActions(context, [ ActionItem( @@ -48,52 +45,35 @@ class _LoginScreenState extends State { ]); }, child: AntListItem( - child: Row( - children: [ - Avatar(url: account.avatarUrl, size: AvatarSize.large), - const Padding(padding: EdgeInsets.only(left: 10)), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - account.login, - style: TextStyle( - fontSize: 20, color: AntTheme.of(context).colorText), - ), - const Padding(padding: EdgeInsets.only(top: 6)), - Text( - account.domain, - style: TextStyle( - color: AntTheme.of(context).colorTextSecondary), - ) - ], - ), - ), - (index == auth.activeAccountIndex) - ? const Icon(Ionicons.checkmark) - : Container(), - ], - ), + onClick: () { + auth.setActiveAccountAndReload(index); + }, + arrow: null, + prefix: Avatar(url: account.avatarUrl), + extra: index == auth.activeAccountIndex + ? const Icon(Ionicons.checkmark) + : null, + description: Text(account.domain), + child: Text(account.login), ), ); } - Widget _buildAddItem( - {IconData? brand, required String text, Function? onTap}) { - return LinkWidget( - onTap: onTap, - child: AntListItem( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Icon(Ionicons.add), - const SizedBox(width: 4), - Icon(brand), - const SizedBox(width: 8), - Text(text, style: const TextStyle(fontSize: 16)), - ], - ), + Widget _buildAddItem({ + IconData? brand, + required String text, + void Function()? onTap, + }) { + return AntListItem( + onClick: onTap, + child: Row( + children: [ + const Icon(Ionicons.add), + const SizedBox(width: 4), + Icon(brand), + const SizedBox(width: 8), + Text(text, style: const TextStyle(fontSize: 15)), + ], ), ); }