1
0
mirror of https://github.com/git-touch/git-touch synced 2024-12-12 16:38:36 +01:00

refactor: login screen styles

This commit is contained in:
Rongjian Zhang 2022-10-07 15:24:56 +08:00
parent efd74ccd86
commit 5a5b20eb7e

View File

@ -33,9 +33,6 @@ class _LoginScreenState extends State<LoginScreen> {
final auth = Provider.of<AuthModel>(context); final auth = Provider.of<AuthModel>(context);
final account = auth.accounts![index]; final account = auth.accounts![index];
return LinkWidget( return LinkWidget(
onTap: () {
auth.setActiveAccountAndReload(index);
},
onLongPress: () { onLongPress: () {
theme.showActions(context, [ theme.showActions(context, [
ActionItem( ActionItem(
@ -48,52 +45,35 @@ class _LoginScreenState extends State<LoginScreen> {
]); ]);
}, },
child: AntListItem( child: AntListItem(
child: Row( onClick: () {
children: <Widget>[ auth.setActiveAccountAndReload(index);
Avatar(url: account.avatarUrl, size: AvatarSize.large), },
const Padding(padding: EdgeInsets.only(left: 10)), arrow: null,
Expanded( prefix: Avatar(url: account.avatarUrl),
child: Column( extra: index == auth.activeAccountIndex
crossAxisAlignment: CrossAxisAlignment.start, ? const Icon(Ionicons.checkmark)
children: <Widget>[ : null,
Text( description: Text(account.domain),
account.login, child: 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(),
],
),
), ),
); );
} }
Widget _buildAddItem( Widget _buildAddItem({
{IconData? brand, required String text, Function? onTap}) { IconData? brand,
return LinkWidget( required String text,
onTap: onTap, void Function()? onTap,
child: AntListItem( }) {
child: Row( return AntListItem(
mainAxisAlignment: MainAxisAlignment.center, onClick: onTap,
children: <Widget>[ child: Row(
const Icon(Ionicons.add), children: <Widget>[
const SizedBox(width: 4), const Icon(Ionicons.add),
Icon(brand), const SizedBox(width: 4),
const SizedBox(width: 8), Icon(brand),
Text(text, style: const TextStyle(fontSize: 16)), const SizedBox(width: 8),
], Text(text, style: const TextStyle(fontSize: 15)),
), ],
), ),
); );
} }