mirror of
https://github.com/git-touch/git-touch
synced 2024-12-19 19:54:54 +01:00
improvement: add avatar link url
This commit is contained in:
parent
5fe740f450
commit
2bc130b91a
@ -56,7 +56,10 @@ class GitlabIssueScreen extends StatelessWidget {
|
||||
Text(issue.title),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Avatar(url: issue.author.avatarUrl),
|
||||
Avatar(
|
||||
url: issue.author.avatarUrl,
|
||||
linkUrl: '/user/${issue.author}',
|
||||
),
|
||||
Expanded(
|
||||
child: Text(issue.description),
|
||||
),
|
||||
|
@ -12,12 +12,13 @@ class AvatarSize {
|
||||
class Avatar extends StatelessWidget {
|
||||
final String url;
|
||||
final double size;
|
||||
final String linkUrl;
|
||||
|
||||
Avatar.large({
|
||||
Avatar({
|
||||
@required this.url,
|
||||
}) : size = 48;
|
||||
|
||||
Avatar({this.url, this.size = AvatarSize.medium});
|
||||
this.size = AvatarSize.medium,
|
||||
this.linkUrl,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -34,9 +35,43 @@ class Avatar extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
// Provider.of<ThemeModel>(context).push(
|
||||
// context, '/$login');
|
||||
if (linkUrl != null)
|
||||
Provider.of<ThemeModel>(context).push(context, linkUrl);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class GithubAvatar extends StatelessWidget {
|
||||
final String url;
|
||||
final double size;
|
||||
final String login;
|
||||
|
||||
GithubAvatar({
|
||||
@required this.url,
|
||||
this.size = AvatarSize.medium,
|
||||
this.login,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Avatar(url: url, size: size, linkUrl: '/$login');
|
||||
}
|
||||
}
|
||||
|
||||
class GitlabAvatar extends StatelessWidget {
|
||||
final String url;
|
||||
final double size;
|
||||
final String login;
|
||||
|
||||
GitlabAvatar({
|
||||
@required this.url,
|
||||
this.size = AvatarSize.medium,
|
||||
this.login,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Avatar(url: url, size: size, linkUrl: '/$login');
|
||||
}
|
||||
}
|
||||
|
@ -45,9 +45,9 @@ class CommentItem extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(children: <Widget>[
|
||||
Link(
|
||||
url: '/' + payload['author']['login'],
|
||||
child: Avatar(url: payload['author']['avatarUrl']),
|
||||
Avatar(
|
||||
url: payload['author']['avatarUrl'],
|
||||
linkUrl: '/' + payload['author']['login'],
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
|
@ -52,10 +52,7 @@ class EventItem extends StatelessWidget {
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Link(
|
||||
url: '/' + e.actor.login,
|
||||
child: Avatar(url: e.actor.avatarUrl),
|
||||
),
|
||||
Avatar(url: e.actor.avatarUrl, linkUrl: '/' + e.actor.login),
|
||||
SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
|
@ -148,7 +148,7 @@ class RepositoryItem extends StatelessWidget {
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Avatar(url: avatarUrl, size: AvatarSize.small),
|
||||
Avatar(url: avatarUrl, size: AvatarSize.small, linkUrl: '/$owner'),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
|
@ -88,10 +88,7 @@ class UserItem extends StatelessWidget {
|
||||
if (inUserScreen) {
|
||||
return widget;
|
||||
} else {
|
||||
return Link(
|
||||
url: '/$login',
|
||||
child: widget,
|
||||
);
|
||||
return Link(url: '/$login', child: widget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user