diff --git a/lib/screens/issue.dart b/lib/screens/issue.dart index 736582e..bfb330f 100644 --- a/lib/screens/issue.dart +++ b/lib/screens/issue.dart @@ -20,17 +20,12 @@ $key: reactions(content: $key) { /// Screen for issue and pull request class IssueScreen extends StatefulWidget { - final int number; final String owner; final String name; + final int number; final bool isPullRequest; - IssueScreen({ - @required this.number, - @required this.owner, - @required this.name, - this.isPullRequest = false, - }); + IssueScreen(this.owner, this.name, this.number, {this.isPullRequest = false}); @override _IssueScreenState createState() => _IssueScreenState(); diff --git a/lib/screens/issues.dart b/lib/screens/issues.dart index a63da0e..4dcf12f 100644 --- a/lib/screens/issues.dart +++ b/lib/screens/issues.dart @@ -14,11 +14,7 @@ class IssuesScreen extends StatelessWidget { final String name; final bool isPullRequest; - IssuesScreen({ - @required this.owner, - @required this.name, - this.isPullRequest = false, - }); + IssuesScreen(this.owner, this.name, {this.isPullRequest = false}); Future _query(BuildContext context, [String cursor]) async { var cursorChunk = cursor == null ? '' : ', after: "$cursor"'; diff --git a/lib/screens/object.dart b/lib/screens/object.dart index 3907acf..1f49c7b 100644 --- a/lib/screens/object.dart +++ b/lib/screens/object.dart @@ -26,13 +26,8 @@ class ObjectScreen extends StatelessWidget { final List paths; final String type; - ObjectScreen({ - @required this.owner, - @required this.name, - @required this.branch, - this.paths = const [], - this.type = 'tree', - }); + ObjectScreen(this.owner, this.name, this.branch, + {this.paths = const [], this.type = 'tree'}); String get _expression => '$branch:$_path'; String get _extname { @@ -100,9 +95,9 @@ class ObjectScreen extends StatelessWidget { screenBuilder: (_) { if (item['type'] == 'commit') return null; return ObjectScreen( - name: name, - owner: owner, - branch: branch, + owner, + name, + branch, paths: [...paths, item['name']], type: item['type'], ); diff --git a/lib/screens/repository.dart b/lib/screens/repository.dart index 05a32ab..b8d6405 100644 --- a/lib/screens/repository.dart +++ b/lib/screens/repository.dart @@ -233,9 +233,9 @@ class RepositoryScreen extends StatelessWidget { rightWidget: Text(filesize((repo['diskUsage'] as int) * 1000)), screenBuilder: (_) => ObjectScreen( - owner: owner, - name: name, - branch: repo[branchInfoKey]['name'], + owner, + name, + repo[branchInfoKey]['name'] as String, ), ), if (repo['hasIssuesEnabled'] as bool) @@ -244,16 +244,15 @@ class RepositoryScreen extends StatelessWidget { text: Text('Issues'), rightWidget: Text(numberFormat.format(repo['issues']['totalCount'])), - screenBuilder: (_) => - IssuesScreen(owner: owner, name: name), + screenBuilder: (_) => IssuesScreen(owner, name), ), TableViewItem( leftIconData: Octicons.git_pull_request, text: Text('Pull requests'), rightWidget: Text( numberFormat.format(repo['pullRequests']['totalCount'])), - screenBuilder: (_) => IssuesScreen( - owner: owner, name: name, isPullRequest: true), + screenBuilder: (_) => + IssuesScreen(owner, name, isPullRequest: true), ), TableViewItem( leftIconData: Octicons.project, diff --git a/lib/widgets/action_button.dart b/lib/widgets/action_button.dart index f97381c..f39b6b4 100644 --- a/lib/widgets/action_button.dart +++ b/lib/widgets/action_button.dart @@ -44,8 +44,8 @@ class ActionItem { ActionItem.issue(String owner, String name, int number) : text = '#$number', onPress = ((context) { - Provider.of(context).pushRoute(context, - (_) => IssueScreen(owner: owner, name: name, number: number)); + Provider.of(context) + .pushRoute(context, (_) => IssueScreen(owner, name, number)); }); } diff --git a/lib/widgets/event_item.dart b/lib/widgets/event_item.dart index ee86353..f2327e6 100644 --- a/lib/widgets/event_item.dart +++ b/lib/widgets/event_item.dart @@ -232,9 +232,9 @@ class EventItem extends StatelessWidget { detail: event.payload['comment']['body'], iconData: Octicons.comment_discussion, screenBuilder: (_) => IssueScreen( - owner: event.repoOwner, - name: event.repoName, - number: number, + event.repoOwner, + event.repoName, + number, isPullRequest: isPullRequest, ), actionItems: [ @@ -258,11 +258,8 @@ class EventItem extends StatelessWidget { ], iconData: Octicons.issue_opened, detail: event.payload['issue']['title'], - screenBuilder: (_) => IssueScreen( - owner: event.repoOwner, - name: event.repoName, - number: number, - ), + screenBuilder: (_) => + IssueScreen(event.repoOwner, event.repoName, number), actionItems: [ ActionItem.user(event.actorLogin), ActionItem.user(event.repoOwner), @@ -299,9 +296,9 @@ class EventItem extends StatelessWidget { iconData: Octicons.git_pull_request, detail: event.payload['pull_request']['title'], screenBuilder: (_) => IssueScreen( - owner: event.repoOwner, - name: event.repoName, - number: number, + event.repoOwner, + event.repoName, + number, isPullRequest: true, ), actionItems: [ @@ -327,9 +324,9 @@ class EventItem extends StatelessWidget { ], detail: event.payload['comment']['body'], screenBuilder: (_) => IssueScreen( - owner: event.repoOwner, - name: event.repoName, - number: number, + event.repoOwner, + event.repoName, + number, isPullRequest: true, ), actionItems: [ diff --git a/lib/widgets/issue_item.dart b/lib/widgets/issue_item.dart index 510de9b..bcea880 100644 --- a/lib/widgets/issue_item.dart +++ b/lib/widgets/issue_item.dart @@ -43,9 +43,9 @@ class IssueItem extends StatelessWidget { return Link( screenBuilder: (context) { return IssueScreen( - number: payload['number'], - owner: payload['repository']['owner']['login'], - name: payload['repository']['name'], + payload['repository']['owner']['login'] as String, + payload['repository']['name'] as String, + payload['number'] as int, isPullRequest: isPullRequest, ); }, diff --git a/lib/widgets/markdown_view.dart b/lib/widgets/markdown_view.dart index a9b22d3..97f5239 100644 --- a/lib/widgets/markdown_view.dart +++ b/lib/widgets/markdown_view.dart @@ -38,9 +38,9 @@ class MarkdownView extends StatelessWidget { return Provider.of(context).pushRoute( context, (_) => IssueScreen( - owner: m['owner'], - name: m['name'], - number: int.parse(m['number']), + m['owner'], + m['name'], + int.parse(m['number']), isPullRequest: true, )); } @@ -50,9 +50,9 @@ class MarkdownView extends StatelessWidget { return Provider.of(context).pushRoute( context, (_) => IssueScreen( - owner: m['owner'], - name: m['name'], - number: int.parse(m['number']), + m['owner'], + m['name'], + int.parse(m['number']), )); } diff --git a/lib/widgets/notification_item.dart b/lib/widgets/notification_item.dart index 339e4d9..5b3f785 100644 --- a/lib/widgets/notification_item.dart +++ b/lib/widgets/notification_item.dart @@ -106,9 +106,9 @@ class _NotificationItemState extends State { Provider.of(context).pushRoute( context, (_) => IssueScreen( - number: payload.number, - owner: payload.owner, - name: payload.name, + payload.owner, + payload.name, + payload.number, isPullRequest: payload.type == 'PullRequest', ));