From d86fe629fc54eeff76271f137acd6063cde248f8 Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Sat, 1 Feb 2020 13:37:44 +0800 Subject: [PATCH] improvement(gitlab): commit router --- lib/router.dart | 6 ++++-- lib/screens/gitlab_commits.dart | 7 +++---- lib/screens/gitlab_project.dart | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/router.dart b/lib/router.dart index f1dbe05..ae7d20a 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -166,8 +166,10 @@ class GitlabRouter { params['id'].first, prefix: params['prefix'].first, )); - static final commits = RouterScreen('/projects/:id/commits', - (context, params) => GitlabCommitsScreen(params['id'].first)); + static final commits = RouterScreen( + '/projects/:id/commits', + (context, params) => GitlabCommitsScreen(params['id'].first, + prefix: params['prefix'].first)); static final projectMembers = RouterScreen( '/projects/:id/members', (context, parameters) => diff --git a/lib/screens/gitlab_commits.dart b/lib/screens/gitlab_commits.dart index 805577c..9b35a95 100644 --- a/lib/screens/gitlab_commits.dart +++ b/lib/screens/gitlab_commits.dart @@ -8,9 +8,9 @@ import 'package:provider/provider.dart'; class GitlabCommitsScreen extends StatelessWidget { final String id; + final String prefix; // final String branch; // TODO: - - GitlabCommitsScreen(this.id); + GitlabCommitsScreen(this.id, {this.prefix}); Future> _query(BuildContext context, [int page = 1]) async { @@ -36,8 +36,7 @@ class GitlabCommitsScreen extends StatelessWidget { avatarUrl: null, createdAt: c.createdAt, message: c.message, - // url: '${auth.activeAccount.domain}/', - url: null, // TODO: + url: '$prefix/commit/${c.id}', // TODO: ); }, ); diff --git a/lib/screens/gitlab_project.dart b/lib/screens/gitlab_project.dart index dceaf63..1db1a58 100644 --- a/lib/screens/gitlab_project.dart +++ b/lib/screens/gitlab_project.dart @@ -134,7 +134,7 @@ class GitlabProjectScreen extends StatelessWidget { leftIconData: Octicons.history, text: Text('Commits'), rightWidget: Text(p.statistics.commitCount.toString()), - url: '/gitlab/projects/$id/commits', + url: '/gitlab/projects/$id/commits?prefix=$prefix', ), ], ),