1
0
mirror of https://github.com/git-touch/git-touch synced 2024-12-18 19:22:54 +01:00

fix: avatar click

This commit is contained in:
Rongjian Zhang 2020-01-12 21:39:03 +08:00
parent a9265c3367
commit cd38d96a91
3 changed files with 20 additions and 19 deletions

View File

@ -133,10 +133,11 @@ class RepositoryScreen extends StatelessWidget {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
GithubAvatar(
url: repo.owner.avatarUrl,
size: AvatarSize.small,
login: owner),
Avatar(
url: repo.owner.avatarUrl,
size: AvatarSize.small,
linkUrl: '/$owner',
),
SizedBox(width: 8),
Text(
'$owner / $name',

View File

@ -256,7 +256,7 @@ class UserScreen extends StatelessWidget {
leftIconData: Octicons.organization,
text: TextContainsOrganization(
p.company,
style: TextStyle(fontSize: 16, color: theme.palette.text),
style: TextStyle(fontSize: 17, color: theme.palette.text),
oneLine: true,
),
),

View File

@ -25,21 +25,22 @@ class Avatar extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GestureDetector(
child: ClipRRect(
borderRadius: borderRadius ?? BorderRadius.circular(size / 2),
child: FadeInImage.assetNetwork(
placeholder: 'images/avatar.png',
image: url ?? 'images/avatar.png',
width: size,
height: size,
fadeInDuration: Duration(milliseconds: 200),
fadeOutDuration: Duration(milliseconds: 100),
),
final widget = ClipRRect(
borderRadius: borderRadius ?? BorderRadius.circular(size / 2),
child: FadeInImage.assetNetwork(
placeholder: 'images/avatar.png',
image: url ?? 'images/avatar.png',
width: size,
height: size,
fadeInDuration: Duration(milliseconds: 200),
fadeOutDuration: Duration(milliseconds: 100),
),
);
if (linkUrl == null) return widget;
return GestureDetector(
child: widget,
onTap: () {
if (linkUrl != null)
Provider.of<ThemeModel>(context).push(context, linkUrl);
Provider.of<ThemeModel>(context).push(context, linkUrl);
},
);
}
@ -79,7 +80,6 @@ class GitlabAvatar extends StatelessWidget {
url: url,
size: size,
linkUrl: '/user/$id',
borderRadius: BorderRadius.circular(size / 2),
);
}
}