mirror of
https://github.com/git-touch/git-touch
synced 2025-01-19 02:40:05 +01:00
improvement: add avatar link to commits screen
This commit is contained in:
parent
60904d763d
commit
d212f58ad1
@ -37,6 +37,7 @@ class BbCommitsScreen extends StatelessWidget {
|
||||
return CommitItem(
|
||||
url: '${auth.activeAccount.domain}/$owner/$name/commits/${v.hash}',
|
||||
avatarUrl: v.author.user?.avatarUrl,
|
||||
avatarLink: null,
|
||||
author: v.author.raw.replaceFirst(RegExp(r' <.*>'), ''),
|
||||
createdAt: v.date,
|
||||
message: v.message,
|
||||
|
@ -51,11 +51,13 @@ class GhCommitsScreen extends StatelessWidget {
|
||||
onRefresh: () => _query(context),
|
||||
onLoadMore: (cursor) => _query(context, cursor),
|
||||
itemBuilder: (payload) {
|
||||
final login = payload.author?.user?.login;
|
||||
return CommitItem(
|
||||
url: payload.url,
|
||||
avatarUrl: payload.author?.avatarUrl,
|
||||
avatarLink: login == null ? null : '/$login',
|
||||
message: payload.messageHeadline,
|
||||
author: payload.author?.user?.login ?? payload.author.name,
|
||||
author: login ?? payload.author.name,
|
||||
createdAt: payload.committedDate,
|
||||
widgets: payload.status == null
|
||||
? null
|
||||
|
@ -34,9 +34,11 @@ class GlCommitsScreen extends StatelessWidget {
|
||||
return CommitItem(
|
||||
author: c.authorName,
|
||||
avatarUrl: null,
|
||||
avatarLink: null,
|
||||
createdAt: c.createdAt,
|
||||
message: c.message,
|
||||
url: '$prefix/commit/${c.id}', // TODO:
|
||||
// url: '/gitlab/projects/$id/commit/${c.id}', // TODO:
|
||||
);
|
||||
},
|
||||
);
|
||||
|
@ -34,6 +34,7 @@ class GtCommitsScreen extends StatelessWidget {
|
||||
return CommitItem(
|
||||
author: c.author?.login ?? c.commit.author.name,
|
||||
avatarUrl: null,
|
||||
avatarLink: null,
|
||||
createdAt: c.commit.author.date,
|
||||
message: c.commit.message,
|
||||
url: c.htmlUrl,
|
||||
|
@ -9,6 +9,7 @@ import 'package:timeago/timeago.dart' as timeago;
|
||||
class CommitItem extends StatelessWidget {
|
||||
final String url;
|
||||
final String avatarUrl;
|
||||
final String avatarLink;
|
||||
final String message;
|
||||
final String author;
|
||||
final DateTime createdAt;
|
||||
@ -16,6 +17,7 @@ class CommitItem extends StatelessWidget {
|
||||
CommitItem({
|
||||
@required this.url,
|
||||
@required this.avatarUrl,
|
||||
@required this.avatarLink,
|
||||
@required this.message,
|
||||
@required this.author,
|
||||
@required this.createdAt,
|
||||
@ -31,7 +33,7 @@ class CommitItem extends StatelessWidget {
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Avatar(url: avatarUrl),
|
||||
Avatar(url: avatarUrl, linkUrl: avatarLink),
|
||||
SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
|
Loading…
Reference in New Issue
Block a user