Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 28 additions & 20 deletions lib/router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ class GithubRouter {
});
static final repo = RouterScreen('/:owner/:name', (context, parameters) {
if (parameters['ref'] == null) {
return GhRepoScreen(parameters['owner']!.first, parameters['name']!.first);
return GhRepoScreen(
parameters['owner']!.first, parameters['name']!.first);
} else {
return GhRepoScreen(parameters['owner']!.first, parameters['name']!.first,
branch: parameters['ref']!.first);
Expand Down Expand Up @@ -182,8 +183,8 @@ class GithubRouter {
});
static final issues = RouterScreen(
'/:owner/:name/issues',
(context, parameters) =>
GhIssuesScreen(parameters['owner']!.first, parameters['name']!.first));
(context, parameters) => GhIssuesScreen(
parameters['owner']!.first, parameters['name']!.first));
static final pulls = RouterScreen(
'/:owner/:name/pulls',
(context, parameters) =>
Expand Down Expand Up @@ -263,8 +264,10 @@ class GitlabRouter {
GitlabRouter.issueAdd,
GitlabRouter.issue,
];
static final user = RouterScreen('/user/:id',
(context, parameters) => GlUserScreen(int.parse(parameters['id']!.first)));
static final user = RouterScreen(
'/user/:id',
(context, parameters) =>
GlUserScreen(int.parse(parameters['id']!.first)));
static final group = RouterScreen(
'/group/:id',
(context, parameters) =>
Expand Down Expand Up @@ -316,8 +319,8 @@ class GitlabRouter {
});
static final commit = RouterScreen(
'/projects/:id/commit/:sha',
(context, parameters) =>
GlCommitScreen(parameters['id']!.first, sha: parameters['sha']!.first));
(context, parameters) => GlCommitScreen(parameters['id']!.first,
sha: parameters['sha']!.first));
static final projectMembers = RouterScreen(
'/projects/:id/members',
(context, parameters) =>
Expand Down Expand Up @@ -412,12 +415,12 @@ class GiteaRouter {
});
static final commits = RouterScreen(
'/:owner/:name/commits',
(context, parameters) =>
GtCommitsScreen(parameters['owner']!.first, parameters['name']!.first));
(context, parameters) => GtCommitsScreen(
parameters['owner']!.first, parameters['name']!.first));
static final issues = RouterScreen(
'/:owner/:name/issues',
(context, parameters) =>
GtIssuesScreen(parameters['owner']!.first, parameters['name']!.first));
(context, parameters) => GtIssuesScreen(
parameters['owner']!.first, parameters['name']!.first));
static final pulls = RouterScreen(
'/:owner/:name/pulls',
(context, parameters) => GtIssuesScreen(
Expand Down Expand Up @@ -458,7 +461,8 @@ class BitbucketRouter {
isTeam: parameters['team']!.first == '1'));
static final repo = RouterScreen('/:owner/:name', (context, parameters) {
if (parameters['branch'] == null) {
return BbRepoScreen(parameters['owner']!.first, parameters['name']!.first);
return BbRepoScreen(
parameters['owner']!.first, parameters['name']!.first);
} else {
return BbRepoScreen(parameters['owner']!.first, parameters['name']!.first,
branch: parameters['branch']!.first);
Expand All @@ -475,8 +479,8 @@ class BitbucketRouter {
);
static final issues = RouterScreen(
'/:owner/:name/issues',
(context, parameters) =>
BbIssuesScreen(parameters['owner']!.first, parameters['name']!.first));
(context, parameters) => BbIssuesScreen(
parameters['owner']!.first, parameters['name']!.first));
static final commits = RouterScreen(
'/:owner/:name/commits/:ref',
(context, parameters) => BbCommitsScreen(parameters['owner']!.first,
Expand Down Expand Up @@ -549,7 +553,8 @@ class GiteeRouter {
return GeRepoScreen(
parameters['owner']!.first, parameters['name']!.first);
} else {
return GeRepoScreen(parameters['owner']!.first, parameters['name']!.first,
return GeRepoScreen(
parameters['owner']!.first, parameters['name']!.first,
branch: parameters['branch']!.first);
}
},
Expand Down Expand Up @@ -597,7 +602,8 @@ class GiteeRouter {
static final issues = RouterScreen(
'/:owner/:name/issues',
(context, parameters) {
return GeIssuesScreen(parameters['owner']!.first, parameters['name']!.first,
return GeIssuesScreen(
parameters['owner']!.first, parameters['name']!.first,
isPr: false);
},
);
Expand All @@ -610,7 +616,8 @@ class GiteeRouter {
static final pulls = RouterScreen(
'/:owner/:name/pulls',
(context, parameters) {
return GePullsScreen(parameters['owner']!.first, parameters['name']!.first,
return GePullsScreen(
parameters['owner']!.first, parameters['name']!.first,
isPr: true);
},
);
Expand Down Expand Up @@ -701,7 +708,8 @@ class GogsRouter {
return GoRepoScreen(
parameters['owner']!.first, parameters['name']!.first);
} else {
return GoRepoScreen(parameters['owner']!.first, parameters['name']!.first,
return GoRepoScreen(
parameters['owner']!.first, parameters['name']!.first,
branch: parameters['branch']!.first);
}
},
Expand All @@ -722,6 +730,6 @@ class GogsRouter {
branch: parameters['ref']?.first));
static final issues = RouterScreen(
'/:owner/:name/issues',
(context, parameters) =>
GoIssuesScreen(parameters['owner']!.first, parameters['name']!.first));
(context, parameters) => GoIssuesScreen(
parameters['owner']!.first, parameters['name']!.first));
}
2 changes: 1 addition & 1 deletion lib/screens/ge_search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class _GeSearchScreenState extends State<GeSearchScreen> {
List<List> _payloads = [[], [], []];

TextEditingController? _controller;
String get _keyword => _controller!.text?.trim() ?? '';
String get _keyword => _controller!.text.trim();

@override
void initState() {
Expand Down
3 changes: 2 additions & 1 deletion lib/screens/gh_events.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class GhEventsScreen extends StatelessWidget {
page = page ?? 1;
final events = await context.read<AuthModel>().ghClient!.getJSON(
'/users/$login/events?page=$page&per_page=$pageSize',
convert: (dynamic vs) => [for (var v in vs) GithubEvent.fromJson(v)]);
convert: (dynamic vs) =>
[for (var v in vs) GithubEvent.fromJson(v)]);
return ListPayload(
cursor: page + 1,
hasMore: events.length == pageSize,
Expand Down
23 changes: 11 additions & 12 deletions lib/screens/gh_issue.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ class GhIssueScreen extends StatelessWidget {

@override
Widget build(BuildContext context) {
return LongListStatefulScaffold<GIssueData_repository, dynamic>(
return LongListStatefulScaffold<GIssueData_repository?, dynamic>(
title: Text('$owner/$name #$number'),
trailingBuilder: (p) {
if (p.issueOrPullRequest!.G__typename == 'Issue') {
final d = p.issueOrPullRequest
if (p?.issueOrPullRequest!.G__typename == 'Issue') {
final d = p?.issueOrPullRequest
as GIssueData_repository_issueOrPullRequest__asIssue;
return ActionButton(
title: 'Actions',
Expand All @@ -126,7 +126,7 @@ class GhIssueScreen extends StatelessWidget {
],
);
} else {
final d = p.issueOrPullRequest
final d = p?.issueOrPullRequest
as GIssueData_repository_issueOrPullRequest__asPullRequest;
return ActionButton(
title: 'Actions',
Expand All @@ -138,8 +138,8 @@ class GhIssueScreen extends StatelessWidget {
},
headerBuilder: (p) {
final theme = Provider.of<ThemeModel>(context);
if (p.issueOrPullRequest!.G__typename == 'Issue') {
final issue = p.issueOrPullRequest
if (p?.issueOrPullRequest!.G__typename == 'Issue') {
final issue = p?.issueOrPullRequest
as GIssueData_repository_issueOrPullRequest__asIssue;

return _buildHeader(
Expand Down Expand Up @@ -204,7 +204,7 @@ class GhIssueScreen extends StatelessWidget {
}),
);
} else {
final pr = p.issueOrPullRequest
final pr = p?.issueOrPullRequest
as GIssueData_repository_issueOrPullRequest__asPullRequest;
return _buildHeader(
context,
Expand Down Expand Up @@ -257,10 +257,9 @@ class GhIssueScreen extends StatelessWidget {
},
itemBuilder: (p) => TimelineItem(p),
onRefresh: () async {
final res =
await (_queryIssue(context) as Future<GIssueData_repository>);
if (res.issueOrPullRequest!.G__typename == 'Issue') {
final issue = res.issueOrPullRequest
final res = await _queryIssue(context);
if (res?.issueOrPullRequest!.G__typename == 'Issue') {
final issue = res?.issueOrPullRequest
as GIssueData_repository_issueOrPullRequest__asIssue;
return LongListPayload(
header: res,
Expand All @@ -270,7 +269,7 @@ class GhIssueScreen extends StatelessWidget {
trailingItems: [],
);
} else {
final pr = res.issueOrPullRequest
final pr = res?.issueOrPullRequest
as GIssueData_repository_issueOrPullRequest__asPullRequest;
return LongListPayload(
header: res,
Expand Down
8 changes: 4 additions & 4 deletions lib/screens/gh_repo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class GhRepoScreen extends StatelessWidget {
SizedBox(width: 8),
MutationButton(
active: repo.viewerHasStarred,
text: repo.viewerHasStarred? 'Unstar' : 'Star',
text: repo.viewerHasStarred ? 'Unstar' : 'Star',
onTap: () async {
final activityApi =
context.read<AuthModel>().ghClient!.activity;
Expand Down Expand Up @@ -232,7 +232,7 @@ class GhRepoScreen extends StatelessWidget {
for (var edge in repo.languages!.edges!)
LanguageBarItem(
name: edge.node.name,
ratio: edge.size/ repo.languages!.totalSize,
ratio: edge.size / repo.languages!.totalSize,
hexColor: edge.node.color,
)
]),
Expand Down Expand Up @@ -270,15 +270,15 @@ class GhRepoScreen extends StatelessWidget {
leftIconData: Octicons.history,
text: Text(AppLocalizations.of(context)!.commits),
rightWidget: Text(
((ref.target as GRepoCommit).history?.totalCount ?? 0)
((ref.target as GRepoCommit).history.totalCount)
.toString()),
url: '/github/$owner/$name/commits/${ref.name}',
),
if (repo.refs != null)
TableViewItem(
leftIconData: Octicons.git_branch,
text: Text(AppLocalizations.of(context)!.branches),
rightWidget: Text(ref.name+
rightWidget: Text(ref.name +
' • ' +
numberFormat.format(repo.refs!.totalCount)),
onTap: () async {
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/gh_search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class _GhSearchScreenState extends State<GhSearchScreen> {

TextEditingController? _controller;

String get _keyword => _controller!.text?.trim() ?? '';
String get _keyword => _controller!.text.trim();

@override
void initState() {
Expand Down
3 changes: 2 additions & 1 deletion lib/screens/gh_user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,8 @@ class GhUser extends StatelessWidget {
if (p.viewerCanFollow)
MutationButton(
active: p.viewerIsFollowing,
text: p.viewerIsFollowing? AppLocalizations.of(context)!.unfollow
text: p.viewerIsFollowing
? AppLocalizations.of(context)!.unfollow
: AppLocalizations.of(context)!.follow,
onTap: () async {
if (p.viewerIsFollowing) {
Expand Down
3 changes: 2 additions & 1 deletion lib/screens/gl_issue.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ class GlIssueScreen extends StatelessWidget {
padding: CommonStyle.padding,
child: Text.rich(
TextSpan(children: [
WidgetSpan(child: Avatar(url: note.author!.avatarUrl)),
WidgetSpan(
child: Avatar(url: note.author!.avatarUrl)),
TextSpan(text: note.author!.name),
TextSpan(text: note.body),
]),
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/gl_search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class _GlSearchScreenState extends State<GlSearchScreen> {

TextEditingController? _controller;

String get _keyword => _controller!.text?.trim() ?? '';
String get _keyword => _controller!.text.trim();

@override
void initState() {
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/release_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class ReleaseItem extends StatelessWidget {
color: theme.palette.secondaryText,
fontSize: 16,
),
child:
Text(login! + " released " + timeago.format(publishedAt!)),
child: Text(
login! + " released " + timeago.format(publishedAt!)),
),
],
),
Expand Down
6 changes: 4 additions & 2 deletions lib/widgets/timeline_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ class TimelineItem extends StatelessWidget {
textSpan: TextSpan(
children: [
TextSpan(
text: ' transferred this issue from ' + p.fromRepository!.name)
text:
' transferred this issue from ' + p.fromRepository!.name)
],
),
);
Expand Down Expand Up @@ -331,7 +332,8 @@ class TimelineItem extends StatelessWidget {
return TimelineEventItem(
actor: p.actor!.login,
textSpan: TextSpan(
text: ' deployed the pull request ' + p.pullRequest.headRef!.name),
text:
' deployed the pull request ' + p.pullRequest.headRef!.name),
);
case 'DeploymentEnvironmentChangedEvent':
final p = node as GDeploymentEnvironmentChangedEventParts;
Expand Down