refactor: repository screen
This commit is contained in:
parent
88984e7164
commit
fadb053b95
|
@ -29,6 +29,11 @@ targets:
|
|||
queries_glob: lib/graphql/github_user.graphql
|
||||
resolve_type_field: __typename
|
||||
add_query_prefix: true
|
||||
- schema: lib/github.schema.json
|
||||
output: lib/graphql/github_repository.dart
|
||||
queries_glob: lib/graphql/github_repository.graphql
|
||||
resolve_type_field: __typename
|
||||
add_query_prefix: true
|
||||
scalar_mapping:
|
||||
- graphql_type: URI
|
||||
dart_type: String
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,568 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'github_repository.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
GithubRepository _$GithubRepositoryFromJson(Map<String, dynamic> json) {
|
||||
return GithubRepository()
|
||||
..repository = json['repository'] == null
|
||||
? null
|
||||
: GithubRepositoryRepository.fromJson(
|
||||
json['repository'] as Map<String, dynamic>);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryToJson(GithubRepository instance) =>
|
||||
<String, dynamic>{
|
||||
'repository': instance.repository?.toJson(),
|
||||
};
|
||||
|
||||
GithubRepositoryRepository _$GithubRepositoryRepositoryFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryRepository()
|
||||
..owner = json['owner'] == null
|
||||
? null
|
||||
: GithubRepositoryRepositoryOwner.fromJson(
|
||||
json['owner'] as Map<String, dynamic>)
|
||||
..name = json['name'] as String
|
||||
..description = json['description'] as String
|
||||
..isPrivate = json['isPrivate'] as bool
|
||||
..isFork = json['isFork'] as bool
|
||||
..stargazers = json['stargazers'] == null
|
||||
? null
|
||||
: GithubRepositoryStargazerConnection.fromJson(
|
||||
json['stargazers'] as Map<String, dynamic>)
|
||||
..forks = json['forks'] == null
|
||||
? null
|
||||
: GithubRepositoryRepositoryConnection.fromJson(
|
||||
json['forks'] as Map<String, dynamic>)
|
||||
..primaryLanguage = json['primaryLanguage'] == null
|
||||
? null
|
||||
: GithubRepositoryLanguage.fromJson(
|
||||
json['primaryLanguage'] as Map<String, dynamic>)
|
||||
..id = json['id'] as String
|
||||
..diskUsage = json['diskUsage'] as int
|
||||
..hasIssuesEnabled = json['hasIssuesEnabled'] as bool
|
||||
..url = json['url'] as String
|
||||
..viewerHasStarred = json['viewerHasStarred'] as bool
|
||||
..projectsResourcePath = json['projectsResourcePath'] as String
|
||||
..watchers = json['watchers'] == null
|
||||
? null
|
||||
: GithubRepositoryUserConnection.fromJson(
|
||||
json['watchers'] as Map<String, dynamic>)
|
||||
..issues = json['issues'] == null
|
||||
? null
|
||||
: GithubRepositoryIssueConnection.fromJson(
|
||||
json['issues'] as Map<String, dynamic>)
|
||||
..pullRequests = json['pullRequests'] == null
|
||||
? null
|
||||
: GithubRepositoryPullRequestConnection.fromJson(
|
||||
json['pullRequests'] as Map<String, dynamic>)
|
||||
..projects = json['projects'] == null
|
||||
? null
|
||||
: GithubRepositoryProjectConnection.fromJson(json['projects'] as Map<String, dynamic>)
|
||||
..releases = json['releases'] == null ? null : GithubRepositoryReleaseConnection.fromJson(json['releases'] as Map<String, dynamic>)
|
||||
..languages = json['languages'] == null ? null : GithubRepositoryLanguageConnection.fromJson(json['languages'] as Map<String, dynamic>)
|
||||
..defaultBranchRef = json['defaultBranchRef'] == null ? null : GithubRepositoryRef.fromJson(json['defaultBranchRef'] as Map<String, dynamic>)
|
||||
..ref = json['ref'] == null ? null : GithubRepositoryRef.fromJson(json['ref'] as Map<String, dynamic>)
|
||||
..refs = json['refs'] == null ? null : GithubRepositoryRefConnection.fromJson(json['refs'] as Map<String, dynamic>)
|
||||
..licenseInfo = json['licenseInfo'] == null ? null : GithubRepositoryLicense.fromJson(json['licenseInfo'] as Map<String, dynamic>)
|
||||
..repositoryTopics = json['repositoryTopics'] == null ? null : GithubRepositoryRepositoryTopicConnection.fromJson(json['repositoryTopics'] as Map<String, dynamic>)
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryRepositoryToJson(
|
||||
GithubRepositoryRepository instance) =>
|
||||
<String, dynamic>{
|
||||
'owner': instance.owner?.toJson(),
|
||||
'name': instance.name,
|
||||
'description': instance.description,
|
||||
'isPrivate': instance.isPrivate,
|
||||
'isFork': instance.isFork,
|
||||
'stargazers': instance.stargazers?.toJson(),
|
||||
'forks': instance.forks?.toJson(),
|
||||
'primaryLanguage': instance.primaryLanguage?.toJson(),
|
||||
'id': instance.id,
|
||||
'diskUsage': instance.diskUsage,
|
||||
'hasIssuesEnabled': instance.hasIssuesEnabled,
|
||||
'url': instance.url,
|
||||
'viewerHasStarred': instance.viewerHasStarred,
|
||||
'projectsResourcePath': instance.projectsResourcePath,
|
||||
'watchers': instance.watchers?.toJson(),
|
||||
'issues': instance.issues?.toJson(),
|
||||
'pullRequests': instance.pullRequests?.toJson(),
|
||||
'projects': instance.projects?.toJson(),
|
||||
'releases': instance.releases?.toJson(),
|
||||
'languages': instance.languages?.toJson(),
|
||||
'defaultBranchRef': instance.defaultBranchRef?.toJson(),
|
||||
'ref': instance.ref?.toJson(),
|
||||
'refs': instance.refs?.toJson(),
|
||||
'licenseInfo': instance.licenseInfo?.toJson(),
|
||||
'repositoryTopics': instance.repositoryTopics?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubRepositoryRepositoryOwner _$GithubRepositoryRepositoryOwnerFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryRepositoryOwner()
|
||||
..login = json['login'] as String
|
||||
..avatarUrl = json['avatarUrl'] as String
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryRepositoryOwnerToJson(
|
||||
GithubRepositoryRepositoryOwner instance) =>
|
||||
<String, dynamic>{
|
||||
'login': instance.login,
|
||||
'avatarUrl': instance.avatarUrl,
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubRepositoryStargazerConnection
|
||||
_$GithubRepositoryStargazerConnectionFromJson(Map<String, dynamic> json) {
|
||||
return GithubRepositoryStargazerConnection()
|
||||
..totalCount = json['totalCount'] as int;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryStargazerConnectionToJson(
|
||||
GithubRepositoryStargazerConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'totalCount': instance.totalCount,
|
||||
};
|
||||
|
||||
GithubRepositoryRepositoryConnection
|
||||
_$GithubRepositoryRepositoryConnectionFromJson(Map<String, dynamic> json) {
|
||||
return GithubRepositoryRepositoryConnection()
|
||||
..totalCount = json['totalCount'] as int;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryRepositoryConnectionToJson(
|
||||
GithubRepositoryRepositoryConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'totalCount': instance.totalCount,
|
||||
};
|
||||
|
||||
GithubRepositoryLanguage _$GithubRepositoryLanguageFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryLanguage()
|
||||
..color = json['color'] as String
|
||||
..name = json['name'] as String
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryLanguageToJson(
|
||||
GithubRepositoryLanguage instance) =>
|
||||
<String, dynamic>{
|
||||
'color': instance.color,
|
||||
'name': instance.name,
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubRepositoryNode _$GithubRepositoryNodeFromJson(Map<String, dynamic> json) {
|
||||
return GithubRepositoryNode()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryNodeToJson(
|
||||
GithubRepositoryNode instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubRepositoryUserConnection _$GithubRepositoryUserConnectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryUserConnection()
|
||||
..totalCount = json['totalCount'] as int;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryUserConnectionToJson(
|
||||
GithubRepositoryUserConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'totalCount': instance.totalCount,
|
||||
};
|
||||
|
||||
GithubRepositoryIssueConnection _$GithubRepositoryIssueConnectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryIssueConnection()
|
||||
..totalCount = json['totalCount'] as int;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryIssueConnectionToJson(
|
||||
GithubRepositoryIssueConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'totalCount': instance.totalCount,
|
||||
};
|
||||
|
||||
GithubRepositoryPullRequestConnection
|
||||
_$GithubRepositoryPullRequestConnectionFromJson(Map<String, dynamic> json) {
|
||||
return GithubRepositoryPullRequestConnection()
|
||||
..totalCount = json['totalCount'] as int;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryPullRequestConnectionToJson(
|
||||
GithubRepositoryPullRequestConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'totalCount': instance.totalCount,
|
||||
};
|
||||
|
||||
GithubRepositoryProjectConnection _$GithubRepositoryProjectConnectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryProjectConnection()
|
||||
..totalCount = json['totalCount'] as int;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryProjectConnectionToJson(
|
||||
GithubRepositoryProjectConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'totalCount': instance.totalCount,
|
||||
};
|
||||
|
||||
GithubRepositoryReleaseConnection _$GithubRepositoryReleaseConnectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryReleaseConnection()
|
||||
..totalCount = json['totalCount'] as int;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryReleaseConnectionToJson(
|
||||
GithubRepositoryReleaseConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'totalCount': instance.totalCount,
|
||||
};
|
||||
|
||||
GithubRepositoryLanguageConnection _$GithubRepositoryLanguageConnectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryLanguageConnection()
|
||||
..totalSize = json['totalSize'] as int
|
||||
..edges = (json['edges'] as List)
|
||||
?.map((e) => e == null
|
||||
? null
|
||||
: GithubRepositoryLanguageEdge.fromJson(e as Map<String, dynamic>))
|
||||
?.toList();
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryLanguageConnectionToJson(
|
||||
GithubRepositoryLanguageConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'totalSize': instance.totalSize,
|
||||
'edges': instance.edges?.map((e) => e?.toJson())?.toList(),
|
||||
};
|
||||
|
||||
GithubRepositoryLanguageEdge _$GithubRepositoryLanguageEdgeFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryLanguageEdge()
|
||||
..size = json['size'] as int
|
||||
..node = json['node'] == null
|
||||
? null
|
||||
: GithubRepositoryLanguage.fromJson(
|
||||
json['node'] as Map<String, dynamic>);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryLanguageEdgeToJson(
|
||||
GithubRepositoryLanguageEdge instance) =>
|
||||
<String, dynamic>{
|
||||
'size': instance.size,
|
||||
'node': instance.node?.toJson(),
|
||||
};
|
||||
|
||||
GithubRepositoryRef _$GithubRepositoryRefFromJson(Map<String, dynamic> json) {
|
||||
return GithubRepositoryRef()
|
||||
..name = json['name'] as String
|
||||
..target = json['target'] == null
|
||||
? null
|
||||
: GithubRepositoryGitObject.fromJson(
|
||||
json['target'] as Map<String, dynamic>)
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryRefToJson(
|
||||
GithubRepositoryRef instance) =>
|
||||
<String, dynamic>{
|
||||
'name': instance.name,
|
||||
'target': instance.target?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubRepositoryGitObject _$GithubRepositoryGitObjectFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryGitObject()
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryGitObjectToJson(
|
||||
GithubRepositoryGitObject instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubRepositoryCommit _$GithubRepositoryCommitFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryCommit()
|
||||
..history = json['history'] == null
|
||||
? null
|
||||
: GithubRepositoryCommitHistoryConnection.fromJson(
|
||||
json['history'] as Map<String, dynamic>)
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryCommitToJson(
|
||||
GithubRepositoryCommit instance) =>
|
||||
<String, dynamic>{
|
||||
'history': instance.history?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubRepositoryCommitHistoryConnection
|
||||
_$GithubRepositoryCommitHistoryConnectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryCommitHistoryConnection()
|
||||
..totalCount = json['totalCount'] as int;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryCommitHistoryConnectionToJson(
|
||||
GithubRepositoryCommitHistoryConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'totalCount': instance.totalCount,
|
||||
};
|
||||
|
||||
GithubRepositoryPullRequestTimelineItem
|
||||
_$GithubRepositoryPullRequestTimelineItemFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryPullRequestTimelineItem();
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryPullRequestTimelineItemToJson(
|
||||
GithubRepositoryPullRequestTimelineItem instance) =>
|
||||
<String, dynamic>{};
|
||||
|
||||
GithubRepositorySubscribable _$GithubRepositorySubscribableFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositorySubscribable()
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositorySubscribableToJson(
|
||||
GithubRepositorySubscribable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubRepositoryUniformResourceLocatable
|
||||
_$GithubRepositoryUniformResourceLocatableFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryUniformResourceLocatable()
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryUniformResourceLocatableToJson(
|
||||
GithubRepositoryUniformResourceLocatable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubRepositoryRefConnection _$GithubRepositoryRefConnectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryRefConnection()
|
||||
..totalCount = json['totalCount'] as int
|
||||
..nodes = (json['nodes'] as List)
|
||||
?.map((e) => e == null
|
||||
? null
|
||||
: GithubRepositoryRef.fromJson(e as Map<String, dynamic>))
|
||||
?.toList();
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryRefConnectionToJson(
|
||||
GithubRepositoryRefConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'totalCount': instance.totalCount,
|
||||
'nodes': instance.nodes?.map((e) => e?.toJson())?.toList(),
|
||||
};
|
||||
|
||||
GithubRepositoryLicense _$GithubRepositoryLicenseFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryLicense()
|
||||
..name = json['name'] as String
|
||||
..spdxId = json['spdxId'] as String
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryLicenseToJson(
|
||||
GithubRepositoryLicense instance) =>
|
||||
<String, dynamic>{
|
||||
'name': instance.name,
|
||||
'spdxId': instance.spdxId,
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubRepositoryRepositoryTopicConnection
|
||||
_$GithubRepositoryRepositoryTopicConnectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryRepositoryTopicConnection()
|
||||
..nodes = (json['nodes'] as List)
|
||||
?.map((e) => e == null
|
||||
? null
|
||||
: GithubRepositoryRepositoryTopic.fromJson(
|
||||
e as Map<String, dynamic>))
|
||||
?.toList();
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryRepositoryTopicConnectionToJson(
|
||||
GithubRepositoryRepositoryTopicConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'nodes': instance.nodes?.map((e) => e?.toJson())?.toList(),
|
||||
};
|
||||
|
||||
GithubRepositoryRepositoryTopic _$GithubRepositoryRepositoryTopicFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryRepositoryTopic()
|
||||
..url = json['url'] as String
|
||||
..topic = json['topic'] == null
|
||||
? null
|
||||
: GithubRepositoryTopic.fromJson(json['topic'] as Map<String, dynamic>)
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryRepositoryTopicToJson(
|
||||
GithubRepositoryRepositoryTopic instance) =>
|
||||
<String, dynamic>{
|
||||
'url': instance.url,
|
||||
'topic': instance.topic?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubRepositoryTopic _$GithubRepositoryTopicFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryTopic()
|
||||
..name = json['name'] as String
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryTopicToJson(
|
||||
GithubRepositoryTopic instance) =>
|
||||
<String, dynamic>{
|
||||
'name': instance.name,
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubRepositoryStarrable _$GithubRepositoryStarrableFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryStarrable()
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryStarrableToJson(
|
||||
GithubRepositoryStarrable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubRepositoryPinnableItem _$GithubRepositoryPinnableItemFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryPinnableItem();
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryPinnableItemToJson(
|
||||
GithubRepositoryPinnableItem instance) =>
|
||||
<String, dynamic>{};
|
||||
|
||||
GithubRepositoryProjectOwner _$GithubRepositoryProjectOwnerFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryProjectOwner()
|
||||
..id = json['id'] as String
|
||||
..projectsResourcePath = json['projectsResourcePath'] as String
|
||||
..projects = json['projects'] == null
|
||||
? null
|
||||
: GithubRepositoryProjectConnection.fromJson(
|
||||
json['projects'] as Map<String, dynamic>)
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryProjectOwnerToJson(
|
||||
GithubRepositoryProjectOwner instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'projectsResourcePath': instance.projectsResourcePath,
|
||||
'projects': instance.projects?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubRepositoryRegistryPackageOwner
|
||||
_$GithubRepositoryRegistryPackageOwnerFromJson(Map<String, dynamic> json) {
|
||||
return GithubRepositoryRegistryPackageOwner()
|
||||
..id = json['id'] as String
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryRegistryPackageOwnerToJson(
|
||||
GithubRepositoryRegistryPackageOwner instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubRepositoryRegistryPackageSearch
|
||||
_$GithubRepositoryRegistryPackageSearchFromJson(Map<String, dynamic> json) {
|
||||
return GithubRepositoryRegistryPackageSearch()
|
||||
..id = json['id'] as String
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryRegistryPackageSearchToJson(
|
||||
GithubRepositoryRegistryPackageSearch instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubRepositoryRepositoryInfo _$GithubRepositoryRepositoryInfoFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryRepositoryInfo()
|
||||
..owner = json['owner'] == null
|
||||
? null
|
||||
: GithubRepositoryRepositoryOwner.fromJson(
|
||||
json['owner'] as Map<String, dynamic>)
|
||||
..name = json['name'] as String
|
||||
..description = json['description'] as String
|
||||
..isPrivate = json['isPrivate'] as bool
|
||||
..isFork = json['isFork'] as bool
|
||||
..hasIssuesEnabled = json['hasIssuesEnabled'] as bool
|
||||
..url = json['url'] as String
|
||||
..licenseInfo = json['licenseInfo'] == null
|
||||
? null
|
||||
: GithubRepositoryLicense.fromJson(
|
||||
json['licenseInfo'] as Map<String, dynamic>)
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryRepositoryInfoToJson(
|
||||
GithubRepositoryRepositoryInfo instance) =>
|
||||
<String, dynamic>{
|
||||
'owner': instance.owner?.toJson(),
|
||||
'name': instance.name,
|
||||
'description': instance.description,
|
||||
'isPrivate': instance.isPrivate,
|
||||
'isFork': instance.isFork,
|
||||
'hasIssuesEnabled': instance.hasIssuesEnabled,
|
||||
'url': instance.url,
|
||||
'licenseInfo': instance.licenseInfo?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubRepositoryArguments _$GithubRepositoryArgumentsFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubRepositoryArguments(
|
||||
owner: json['owner'] as String,
|
||||
name: json['name'] as String,
|
||||
branchSpecified: json['branchSpecified'] as bool,
|
||||
branch: json['branch'] as String,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubRepositoryArgumentsToJson(
|
||||
GithubRepositoryArguments instance) =>
|
||||
<String, dynamic>{
|
||||
'owner': instance.owner,
|
||||
'name': instance.name,
|
||||
'branchSpecified': instance.branchSpecified,
|
||||
'branch': instance.branch,
|
||||
};
|
|
@ -0,0 +1,98 @@
|
|||
query(
|
||||
$owner: String!
|
||||
$name: String!
|
||||
$branchSpecified: Boolean!
|
||||
$branch: String!
|
||||
) {
|
||||
repository(owner: $owner, name: $name) {
|
||||
owner {
|
||||
__typename
|
||||
login
|
||||
avatarUrl
|
||||
}
|
||||
name
|
||||
description
|
||||
isPrivate
|
||||
isFork
|
||||
stargazers {
|
||||
totalCount
|
||||
}
|
||||
forks {
|
||||
totalCount
|
||||
}
|
||||
primaryLanguage {
|
||||
color
|
||||
name
|
||||
}
|
||||
id
|
||||
diskUsage
|
||||
hasIssuesEnabled
|
||||
url
|
||||
viewerHasStarred
|
||||
# viewerSubscription # TODO
|
||||
projectsResourcePath
|
||||
watchers {
|
||||
totalCount
|
||||
}
|
||||
issues(states: OPEN) {
|
||||
totalCount
|
||||
}
|
||||
pullRequests(states: OPEN) {
|
||||
totalCount
|
||||
}
|
||||
projects {
|
||||
totalCount
|
||||
}
|
||||
releases {
|
||||
totalCount
|
||||
}
|
||||
languages(first: 10, orderBy: { field: SIZE, direction: DESC }) {
|
||||
totalSize
|
||||
edges {
|
||||
size
|
||||
node {
|
||||
name
|
||||
color
|
||||
}
|
||||
}
|
||||
}
|
||||
defaultBranchRef @skip(if: $branchSpecified) {
|
||||
name
|
||||
target {
|
||||
... on Commit {
|
||||
history {
|
||||
totalCount
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ref(qualifiedName: $branch) @include(if: $branchSpecified) {
|
||||
name
|
||||
target {
|
||||
... on Commit {
|
||||
history {
|
||||
totalCount
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
refs(first: 100, refPrefix: "refs/heads/") {
|
||||
totalCount
|
||||
nodes {
|
||||
name
|
||||
}
|
||||
}
|
||||
licenseInfo {
|
||||
name
|
||||
spdxId
|
||||
}
|
||||
repositoryTopics(first: 100) {
|
||||
nodes {
|
||||
url
|
||||
topic {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ import 'dart:convert';
|
|||
import 'package:filesize/filesize.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:git_touch/graphql/github_repository.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/scaffolds/refresh_stateful.dart';
|
||||
import 'package:git_touch/screens/repositories.dart';
|
||||
|
@ -15,6 +16,7 @@ import 'package:git_touch/models/theme.dart';
|
|||
import 'package:git_touch/screens/commits.dart';
|
||||
import 'package:git_touch/screens/object.dart';
|
||||
import 'package:git_touch/widgets/repository_item.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
import '../widgets/entry_item.dart';
|
||||
import '../screens/issues.dart';
|
||||
import 'package:git_touch/widgets/action_button.dart';
|
||||
|
@ -26,81 +28,18 @@ class RepositoryScreen extends StatelessWidget {
|
|||
|
||||
RepositoryScreen(this.owner, this.name, {this.branch});
|
||||
|
||||
get branchInfoKey => getBranchQueryKey(branch);
|
||||
|
||||
Future queryRepo(BuildContext context) async {
|
||||
var branchKey = getBranchQueryKey(branch, withParams: true);
|
||||
var data = await Provider.of<AuthModel>(context).query('''
|
||||
{
|
||||
repository(owner: "$owner", name: "$name") {
|
||||
$repoChunk
|
||||
id
|
||||
diskUsage
|
||||
hasIssuesEnabled
|
||||
url
|
||||
viewerHasStarred
|
||||
viewerSubscription
|
||||
projectsResourcePath
|
||||
watchers {
|
||||
totalCount
|
||||
}
|
||||
issues(states: OPEN) {
|
||||
totalCount
|
||||
}
|
||||
pullRequests(states: OPEN) {
|
||||
totalCount
|
||||
}
|
||||
projects {
|
||||
totalCount
|
||||
}
|
||||
releases {
|
||||
totalCount
|
||||
}
|
||||
languages(first: 10, orderBy: {field: SIZE, direction: DESC}) {
|
||||
totalSize
|
||||
edges {
|
||||
size
|
||||
node {
|
||||
name
|
||||
color
|
||||
}
|
||||
}
|
||||
}
|
||||
$branchKey {
|
||||
name
|
||||
target {
|
||||
... on Commit {
|
||||
history {
|
||||
totalCount
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
refs(first: 100, refPrefix: "refs/heads/") {
|
||||
totalCount
|
||||
nodes {
|
||||
name
|
||||
}
|
||||
}
|
||||
licenseInfo {
|
||||
name
|
||||
spdxId
|
||||
}
|
||||
repositoryTopics(first: 100) {
|
||||
nodes {
|
||||
url
|
||||
topic {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
''');
|
||||
return data['repository'];
|
||||
Future<GithubRepositoryRepository> _query(BuildContext context) async {
|
||||
var res = await Provider.of<AuthModel>(context).gqlClient.execute(
|
||||
GithubRepositoryQuery(
|
||||
variables: GithubRepositoryArguments(
|
||||
owner: owner,
|
||||
name: name,
|
||||
branchSpecified: branch != null,
|
||||
branch: branch ?? '')));
|
||||
return res.data.repository;
|
||||
}
|
||||
|
||||
Future<String> fetchReadme(BuildContext context) async {
|
||||
Future<String> _fetchReadme(BuildContext context) async {
|
||||
var data = await Provider.of<AuthModel>(context)
|
||||
.getWithCredentials('/repos/$owner/$name/readme');
|
||||
|
||||
|
@ -115,65 +54,70 @@ class RepositoryScreen extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RefreshStatefulScaffold(
|
||||
return RefreshStatefulScaffold<Tuple2<GithubRepositoryRepository, String>>(
|
||||
title: AppBarTitle('Repository'),
|
||||
fetchData: () => Future.wait([
|
||||
queryRepo(context),
|
||||
fetchReadme(context),
|
||||
]),
|
||||
fetchData: () async {
|
||||
final rs = await Future.wait([
|
||||
_query(context),
|
||||
_fetchReadme(context),
|
||||
]);
|
||||
return Tuple2(rs[0] as GithubRepositoryRepository, rs[1] as String);
|
||||
},
|
||||
actionBuilder: (data, setState) {
|
||||
if (data == null)
|
||||
return ActionButton(title: 'Repository Actions', items: []);
|
||||
|
||||
final repo = data.item1;
|
||||
return ActionButton(
|
||||
title: 'Repository Actions',
|
||||
items: [
|
||||
if (data != null) ...[
|
||||
ActionItem(
|
||||
text: data[0]['viewerHasStarred'] ? 'Unstar' : 'Star',
|
||||
onPress: (_) async {
|
||||
if (data[0]['viewerHasStarred']) {
|
||||
await Provider.of<AuthModel>(context)
|
||||
.deleteWithCredentials('/user/starred/$owner/$name');
|
||||
data[0]['viewerHasStarred'] = false;
|
||||
} else {
|
||||
await Provider.of<AuthModel>(context)
|
||||
.putWithCredentials('/user/starred/$owner/$name');
|
||||
data[0]['viewerHasStarred'] = true;
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
ActionItem(
|
||||
text: data[0]['viewerSubscription'] == 'SUBSCRIBED'
|
||||
? 'Unwatch'
|
||||
: 'Watch',
|
||||
onPress: (_) async {
|
||||
if (data[0]['viewerSubscription'] == 'SUBSCRIBED') {
|
||||
await Provider.of<AuthModel>(context).deleteWithCredentials(
|
||||
'/repos/$owner/$name/subscription');
|
||||
data[0]['viewerSubscription'] = 'UNSUBSCRIBED';
|
||||
} else {
|
||||
await Provider.of<AuthModel>(context)
|
||||
.putWithCredentials('/repos/$owner/$name/subscription');
|
||||
data[0]['viewerSubscription'] = 'SUBSCRIBED';
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
],
|
||||
if (data != null) ...[
|
||||
ActionItem.share(data[0]['url']),
|
||||
ActionItem.launch(data[0]['url']),
|
||||
],
|
||||
ActionItem(
|
||||
text: repo.viewerHasStarred ? 'Unstar' : 'Star',
|
||||
onPress: (_) async {
|
||||
if (repo.viewerHasStarred) {
|
||||
await Provider.of<AuthModel>(context)
|
||||
.deleteWithCredentials('/user/starred/$owner/$name');
|
||||
repo.viewerHasStarred = false;
|
||||
} else {
|
||||
await Provider.of<AuthModel>(context)
|
||||
.putWithCredentials('/user/starred/$owner/$name');
|
||||
repo.viewerHasStarred = true;
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
// TODO:
|
||||
// ActionItem(
|
||||
// text: data[0]['viewerSubscription'] == 'SUBSCRIBED'
|
||||
// ? 'Unwatch'
|
||||
// : 'Watch',
|
||||
// onPress: (_) async {
|
||||
// if (data[0]['viewerSubscription'] == 'SUBSCRIBED') {
|
||||
// await Provider.of<AuthModel>(context).deleteWithCredentials(
|
||||
// '/repos/$owner/$name/subscription');
|
||||
// data[0]['viewerSubscription'] = 'UNSUBSCRIBED';
|
||||
// } else {
|
||||
// await Provider.of<AuthModel>(context)
|
||||
// .putWithCredentials('/repos/$owner/$name/subscription');
|
||||
// data[0]['viewerSubscription'] = 'SUBSCRIBED';
|
||||
// }
|
||||
// setState(() {});
|
||||
// },
|
||||
// ),
|
||||
ActionItem.share(repo.url),
|
||||
ActionItem.launch(repo.url),
|
||||
],
|
||||
);
|
||||
},
|
||||
bodyBuilder: (data, _) {
|
||||
var repo = data[0];
|
||||
var readme = data[1] as String;
|
||||
final repo = data.item1;
|
||||
final readme = data.item2;
|
||||
final ref = branch == null ? repo.defaultBranchRef : repo.ref;
|
||||
|
||||
final langWidth = MediaQuery.of(context).size.width -
|
||||
CommonStyle.padding.left -
|
||||
CommonStyle.padding.right -
|
||||
(repo['languages']['edges'] as List).length +
|
||||
repo.languages.edges.length +
|
||||
1;
|
||||
|
||||
final theme = Provider.of<ThemeModel>(context);
|
||||
|
@ -181,22 +125,34 @@ class RepositoryScreen extends StatelessWidget {
|
|||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
RepositoryItem(repo, inRepoScreen: true),
|
||||
RepositoryItem.raw(
|
||||
repo.owner.login,
|
||||
repo.owner.avatarUrl,
|
||||
repo.name,
|
||||
repo.description,
|
||||
Octicons.repo, // TODO:
|
||||
repo.stargazers.totalCount,
|
||||
repo.forks.totalCount,
|
||||
repo.primaryLanguage?.name,
|
||||
repo.primaryLanguage?.color,
|
||||
null,
|
||||
repo.repositoryTopics.nodes,
|
||||
inRepoScreen: true),
|
||||
CommonStyle.border,
|
||||
Row(
|
||||
children: <Widget>[
|
||||
EntryItem(
|
||||
count: repo['watchers']['totalCount'],
|
||||
count: repo.watchers.totalCount,
|
||||
text: 'Watchers',
|
||||
screenBuilder: (context) => UsersScreen.watchers(owner, name),
|
||||
),
|
||||
EntryItem(
|
||||
count: repo['stargazers']['totalCount'],
|
||||
count: repo.stargazers.totalCount,
|
||||
text: 'Stars',
|
||||
screenBuilder: (context) => UsersScreen.stars(owner, name),
|
||||
),
|
||||
EntryItem(
|
||||
count: repo['forks']['totalCount'],
|
||||
count: repo.forks.totalCount,
|
||||
text: 'Forks',
|
||||
screenBuilder: (context) =>
|
||||
RepositoriesScreen.forks(owner, name),
|
||||
|
@ -204,7 +160,7 @@ class RepositoryScreen extends StatelessWidget {
|
|||
],
|
||||
),
|
||||
CommonStyle.verticalGap,
|
||||
if ((repo['languages']['edges'] as List).isNotEmpty)
|
||||
if (repo.languages.edges.isNotEmpty)
|
||||
Container(
|
||||
color: theme.palette.background,
|
||||
padding: CommonStyle.padding.copyWith(top: 8, bottom: 8),
|
||||
|
@ -215,12 +171,12 @@ class RepositoryScreen extends StatelessWidget {
|
|||
child: Row(
|
||||
children: join(
|
||||
SizedBox(width: 1),
|
||||
(repo['languages']['edges'] as List)
|
||||
repo.languages.edges
|
||||
.map((lang) => Container(
|
||||
color: convertColor(lang['node']['color']),
|
||||
color: convertColor(lang.node.color),
|
||||
width: langWidth *
|
||||
lang['size'] /
|
||||
repo['languages']['totalSize']))
|
||||
lang.size /
|
||||
repo.languages.totalSize))
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
|
@ -230,31 +186,30 @@ class RepositoryScreen extends StatelessWidget {
|
|||
TableView(
|
||||
hasIcon: true,
|
||||
items: [
|
||||
if (repo[branchInfoKey] != null)
|
||||
if (ref != null)
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.code,
|
||||
text: Text('Code'),
|
||||
rightWidget:
|
||||
Text(filesize((repo['diskUsage'] as int) * 1000)),
|
||||
rightWidget: Text(filesize(repo.diskUsage * 1000)),
|
||||
screenBuilder: (_) => ObjectScreen(
|
||||
owner,
|
||||
name,
|
||||
repo[branchInfoKey]['name'] as String,
|
||||
ref.name,
|
||||
),
|
||||
),
|
||||
if (repo['hasIssuesEnabled'] as bool)
|
||||
if (repo.hasIssuesEnabled)
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.issue_opened,
|
||||
text: Text('Issues'),
|
||||
rightWidget:
|
||||
Text(numberFormat.format(repo['issues']['totalCount'])),
|
||||
Text(numberFormat.format(repo.issues.totalCount)),
|
||||
screenBuilder: (_) => IssuesScreen(owner, name),
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.git_pull_request,
|
||||
text: Text('Pull requests'),
|
||||
rightWidget: Text(
|
||||
numberFormat.format(repo['pullRequests']['totalCount'])),
|
||||
rightWidget:
|
||||
Text(numberFormat.format(repo.pullRequests.totalCount)),
|
||||
screenBuilder: (_) =>
|
||||
IssuesScreen(owner, name, isPullRequest: true),
|
||||
),
|
||||
|
@ -262,8 +217,8 @@ class RepositoryScreen extends StatelessWidget {
|
|||
leftIconData: Octicons.project,
|
||||
text: Text('Projects'),
|
||||
rightWidget:
|
||||
Text(numberFormat.format(repo['projects']['totalCount'])),
|
||||
url: 'https://github.com' + repo['projectsResourcePath'],
|
||||
Text(numberFormat.format(repo.projects.totalCount)),
|
||||
url: 'https://github.com' + repo.projectsResourcePath,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -271,33 +226,32 @@ class RepositoryScreen extends StatelessWidget {
|
|||
TableView(
|
||||
hasIcon: true,
|
||||
items: [
|
||||
if (repo[branchInfoKey] != null) ...[
|
||||
if (ref != null) ...[
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.history,
|
||||
text: Text('Commits'),
|
||||
rightWidget: Text(numberFormat.format(repo[branchInfoKey]
|
||||
['target']['history']['totalCount'])),
|
||||
// rightWidget: Text(numberFormat
|
||||
// .format(ref['target']['history']['totalCount'])),
|
||||
screenBuilder: (_) =>
|
||||
CommitsScreen(owner, name, branch: branch),
|
||||
),
|
||||
if (repo['refs'] != null)
|
||||
if (repo.refs != null)
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.git_branch,
|
||||
text: Text('Branches'),
|
||||
rightWidget: Text(repo[branchInfoKey]['name'] +
|
||||
rightWidget: Text(ref.name +
|
||||
' • ' +
|
||||
numberFormat.format(repo['refs']['totalCount'])),
|
||||
numberFormat.format(repo.refs.totalCount)),
|
||||
onTap: () async {
|
||||
var refs = repo['refs']['nodes'] as List;
|
||||
final refs = repo.refs.nodes;
|
||||
if (refs.length < 2) return;
|
||||
|
||||
await Provider.of<ThemeModel>(context).showPicker(
|
||||
context,
|
||||
PickerGroupItem(
|
||||
value: repo[branchInfoKey]['name'],
|
||||
value: ref.name,
|
||||
items: refs
|
||||
.map((b) => PickerItem(b['name'] as String,
|
||||
text: (b['name'] as String)))
|
||||
.map((b) => PickerItem(b.name, text: b.name))
|
||||
.toList(),
|
||||
onClose: (result) {
|
||||
if (result != branch) {
|
||||
|
@ -317,17 +271,15 @@ class RepositoryScreen extends StatelessWidget {
|
|||
TableViewItem(
|
||||
leftIconData: Octicons.tag,
|
||||
text: Text('Releases'),
|
||||
rightWidget:
|
||||
Text((repo['releases']['totalCount'] as int).toString()),
|
||||
url: repo['url'] + '/releases',
|
||||
rightWidget: Text(repo.releases.totalCount.toString()),
|
||||
url: repo.url + '/releases',
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.law,
|
||||
text: Text('License'),
|
||||
rightWidget: Text(repo['licenseInfo'] == null
|
||||
rightWidget: Text(repo.licenseInfo == null
|
||||
? 'Unknown'
|
||||
: (repo['licenseInfo']['spdxId'] ??
|
||||
repo['licenseInfo']['name'])),
|
||||
: (repo.licenseInfo.spdxId ?? repo.licenseInfo.name)),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:git_touch/graphql/github_repository.dart';
|
||||
import 'package:git_touch/graphql/github_user.dart';
|
||||
import 'package:git_touch/models/gitea.dart';
|
||||
import 'package:git_touch/models/gitlab.dart';
|
||||
|
@ -46,7 +47,7 @@ class RepositoryItem extends StatelessWidget {
|
|||
final String primaryLanguageColor;
|
||||
final Widget Function(BuildContext context) screenBuilder;
|
||||
final bool inRepoScreen;
|
||||
final List topics;
|
||||
final Iterable<GithubRepositoryRepositoryTopic> topics;
|
||||
|
||||
RepositoryItem.raw(
|
||||
this.owner,
|
||||
|
@ -78,9 +79,7 @@ class RepositoryItem extends StatelessWidget {
|
|||
: payload['primaryLanguage']['color'],
|
||||
this.screenBuilder = ((_) =>
|
||||
RepositoryScreen(payload['owner']['login'], payload['name'])),
|
||||
this.topics = payload['repositoryTopics'] == null
|
||||
? []
|
||||
: payload['repositoryTopics']['nodes'];
|
||||
this.topics = [];
|
||||
|
||||
RepositoryItem.github(GithubUserRepository payload,
|
||||
{this.inRepoScreen = false})
|
||||
|
@ -206,7 +205,7 @@ class RepositoryItem extends StatelessWidget {
|
|||
borderRadius: BorderRadius.all(Radius.circular(4)),
|
||||
),
|
||||
child: Text(
|
||||
node['topic']['name'],
|
||||
node.topic.name,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: theme.palette.primary,
|
||||
|
|
Loading…
Reference in New Issue