mirror of
https://github.com/git-touch/git-touch
synced 2024-12-16 10:20:55 +01:00
refactor: issue and pull item
This commit is contained in:
parent
5f502ae29e
commit
8012ea6544
1545
lib/graphql/gh.dart
1545
lib/graphql/gh.dart
File diff suppressed because it is too large
Load Diff
@ -3597,3 +3597,822 @@ Map<String, dynamic> _$GhRepoIdArgumentsToJson(GhRepoIdArguments instance) =>
|
||||
'owner': instance.owner,
|
||||
'name': instance.name,
|
||||
};
|
||||
|
||||
GhIssues _$GhIssuesFromJson(Map<String, dynamic> json) {
|
||||
return GhIssues(
|
||||
repository: json['repository'] == null
|
||||
? null
|
||||
: GhIssuesRepository.fromJson(
|
||||
json['repository'] as Map<String, dynamic>),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesToJson(GhIssues instance) => <String, dynamic>{
|
||||
'repository': instance.repository?.toJson(),
|
||||
};
|
||||
|
||||
GhIssuesRepository _$GhIssuesRepositoryFromJson(Map<String, dynamic> json) {
|
||||
return GhIssuesRepository(
|
||||
issues: json['issues'] == null
|
||||
? null
|
||||
: GhIssuesIssueConnection.fromJson(
|
||||
json['issues'] as Map<String, dynamic>),
|
||||
)
|
||||
..owner = json['owner'] == null
|
||||
? null
|
||||
: GhIssuesRepositoryOwner.fromJson(
|
||||
json['owner'] as Map<String, dynamic>)
|
||||
..name = json['name'] as String
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesRepositoryToJson(GhIssuesRepository instance) =>
|
||||
<String, dynamic>{
|
||||
'owner': instance.owner?.toJson(),
|
||||
'name': instance.name,
|
||||
'issues': instance.issues?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesRepositoryOwner _$GhIssuesRepositoryOwnerFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhIssuesRepositoryOwner(
|
||||
login: json['login'] as String,
|
||||
)..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesRepositoryOwnerToJson(
|
||||
GhIssuesRepositoryOwner instance) =>
|
||||
<String, dynamic>{
|
||||
'login': instance.login,
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesIssueConnection _$GhIssuesIssueConnectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhIssuesIssueConnection(
|
||||
pageInfo: json['pageInfo'] == null
|
||||
? null
|
||||
: GhIssuesPageInfo.fromJson(json['pageInfo'] as Map<String, dynamic>),
|
||||
nodes: (json['nodes'] as List)
|
||||
?.map((e) => e == null
|
||||
? null
|
||||
: GhIssuesIssue.fromJson(e as Map<String, dynamic>))
|
||||
?.toList(),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesIssueConnectionToJson(
|
||||
GhIssuesIssueConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'pageInfo': instance.pageInfo?.toJson(),
|
||||
'nodes': instance.nodes?.map((e) => e?.toJson())?.toList(),
|
||||
};
|
||||
|
||||
GhIssuesPageInfo _$GhIssuesPageInfoFromJson(Map<String, dynamic> json) {
|
||||
return GhIssuesPageInfo(
|
||||
hasNextPage: json['hasNextPage'] as bool,
|
||||
endCursor: json['endCursor'] as String,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesPageInfoToJson(GhIssuesPageInfo instance) =>
|
||||
<String, dynamic>{
|
||||
'hasNextPage': instance.hasNextPage,
|
||||
'endCursor': instance.endCursor,
|
||||
};
|
||||
|
||||
GhIssuesIssue _$GhIssuesIssueFromJson(Map<String, dynamic> json) {
|
||||
return GhIssuesIssue(
|
||||
number: json['number'] as int,
|
||||
title: json['title'] as String,
|
||||
comments: json['comments'] == null
|
||||
? null
|
||||
: GhIssuesIssueCommentConnection.fromJson(
|
||||
json['comments'] as Map<String, dynamic>),
|
||||
)
|
||||
..repository = json['repository'] == null
|
||||
? null
|
||||
: GhIssuesRepository.fromJson(
|
||||
json['repository'] as Map<String, dynamic>)
|
||||
..updatedAt = json['updatedAt'] == null
|
||||
? null
|
||||
: DateTime.parse(json['updatedAt'] as String)
|
||||
..author = json['author'] == null
|
||||
? null
|
||||
: GhIssuesActor.fromJson(json['author'] as Map<String, dynamic>)
|
||||
..labels = json['labels'] == null
|
||||
? null
|
||||
: GhIssuesLabelConnection.fromJson(
|
||||
json['labels'] as Map<String, dynamic>)
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesIssueToJson(GhIssuesIssue instance) =>
|
||||
<String, dynamic>{
|
||||
'repository': instance.repository?.toJson(),
|
||||
'number': instance.number,
|
||||
'title': instance.title,
|
||||
'updatedAt': instance.updatedAt?.toIso8601String(),
|
||||
'author': instance.author?.toJson(),
|
||||
'labels': instance.labels?.toJson(),
|
||||
'comments': instance.comments?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesPinnableItem _$GhIssuesPinnableItemFromJson(Map<String, dynamic> json) {
|
||||
return GhIssuesPinnableItem();
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesPinnableItemToJson(
|
||||
GhIssuesPinnableItem instance) =>
|
||||
<String, dynamic>{};
|
||||
|
||||
GhIssuesNode _$GhIssuesNodeFromJson(Map<String, dynamic> json) {
|
||||
return GhIssuesNode()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesNodeToJson(GhIssuesNode instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesProjectOwner _$GhIssuesProjectOwnerFromJson(Map<String, dynamic> json) {
|
||||
return GhIssuesProjectOwner()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesProjectOwnerToJson(
|
||||
GhIssuesProjectOwner instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesRegistryPackageOwner _$GhIssuesRegistryPackageOwnerFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhIssuesRegistryPackageOwner()
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesRegistryPackageOwnerToJson(
|
||||
GhIssuesRegistryPackageOwner instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesRegistryPackageSearch _$GhIssuesRegistryPackageSearchFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhIssuesRegistryPackageSearch()
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesRegistryPackageSearchToJson(
|
||||
GhIssuesRegistryPackageSearch instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesSubscribable _$GhIssuesSubscribableFromJson(Map<String, dynamic> json) {
|
||||
return GhIssuesSubscribable()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesSubscribableToJson(
|
||||
GhIssuesSubscribable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesStarrable _$GhIssuesStarrableFromJson(Map<String, dynamic> json) {
|
||||
return GhIssuesStarrable()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesStarrableToJson(GhIssuesStarrable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesUniformResourceLocatable _$GhIssuesUniformResourceLocatableFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhIssuesUniformResourceLocatable()
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesUniformResourceLocatableToJson(
|
||||
GhIssuesUniformResourceLocatable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesRepositoryInfo _$GhIssuesRepositoryInfoFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhIssuesRepositoryInfo(
|
||||
owner: json['owner'] == null
|
||||
? null
|
||||
: GhIssuesRepositoryOwner.fromJson(
|
||||
json['owner'] as Map<String, dynamic>),
|
||||
name: json['name'] as String,
|
||||
)..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesRepositoryInfoToJson(
|
||||
GhIssuesRepositoryInfo instance) =>
|
||||
<String, dynamic>{
|
||||
'owner': instance.owner?.toJson(),
|
||||
'name': instance.name,
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesActor _$GhIssuesActorFromJson(Map<String, dynamic> json) {
|
||||
return GhIssuesActor(
|
||||
login: json['login'] as String,
|
||||
avatarUrl: json['avatarUrl'] as String,
|
||||
)..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesActorToJson(GhIssuesActor instance) =>
|
||||
<String, dynamic>{
|
||||
'login': instance.login,
|
||||
'avatarUrl': instance.avatarUrl,
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesLabelConnection _$GhIssuesLabelConnectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhIssuesLabelConnection(
|
||||
nodes: (json['nodes'] as List)
|
||||
?.map((e) => e == null
|
||||
? null
|
||||
: GhIssuesLabel.fromJson(e as Map<String, dynamic>))
|
||||
?.toList(),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesLabelConnectionToJson(
|
||||
GhIssuesLabelConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'nodes': instance.nodes?.map((e) => e?.toJson())?.toList(),
|
||||
};
|
||||
|
||||
GhIssuesLabel _$GhIssuesLabelFromJson(Map<String, dynamic> json) {
|
||||
return GhIssuesLabel(
|
||||
name: json['name'] as String,
|
||||
color: json['color'] as String,
|
||||
)..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesLabelToJson(GhIssuesLabel instance) =>
|
||||
<String, dynamic>{
|
||||
'name': instance.name,
|
||||
'color': instance.color,
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesIssueCommentConnection _$GhIssuesIssueCommentConnectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhIssuesIssueCommentConnection(
|
||||
totalCount: json['totalCount'] as int,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesIssueCommentConnectionToJson(
|
||||
GhIssuesIssueCommentConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'totalCount': instance.totalCount,
|
||||
};
|
||||
|
||||
GhIssuesProjectCardItem _$GhIssuesProjectCardItemFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhIssuesProjectCardItem();
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesProjectCardItemToJson(
|
||||
GhIssuesProjectCardItem instance) =>
|
||||
<String, dynamic>{};
|
||||
|
||||
GhIssuesAssignable _$GhIssuesAssignableFromJson(Map<String, dynamic> json) {
|
||||
return GhIssuesAssignable()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesAssignableToJson(GhIssuesAssignable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesClosable _$GhIssuesClosableFromJson(Map<String, dynamic> json) {
|
||||
return GhIssuesClosable()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesClosableToJson(GhIssuesClosable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesComment _$GhIssuesCommentFromJson(Map<String, dynamic> json) {
|
||||
return GhIssuesComment(
|
||||
updatedAt: json['updatedAt'] == null
|
||||
? null
|
||||
: DateTime.parse(json['updatedAt'] as String),
|
||||
author: json['author'] == null
|
||||
? null
|
||||
: GhIssuesActor.fromJson(json['author'] as Map<String, dynamic>),
|
||||
)..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesCommentToJson(GhIssuesComment instance) =>
|
||||
<String, dynamic>{
|
||||
'updatedAt': instance.updatedAt?.toIso8601String(),
|
||||
'author': instance.author?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesUpdatable _$GhIssuesUpdatableFromJson(Map<String, dynamic> json) {
|
||||
return GhIssuesUpdatable()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesUpdatableToJson(GhIssuesUpdatable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesUpdatableComment _$GhIssuesUpdatableCommentFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhIssuesUpdatableComment()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesUpdatableCommentToJson(
|
||||
GhIssuesUpdatableComment instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesLabelable _$GhIssuesLabelableFromJson(Map<String, dynamic> json) {
|
||||
return GhIssuesLabelable(
|
||||
labels: json['labels'] == null
|
||||
? null
|
||||
: GhIssuesLabelConnection.fromJson(
|
||||
json['labels'] as Map<String, dynamic>),
|
||||
)..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesLabelableToJson(GhIssuesLabelable instance) =>
|
||||
<String, dynamic>{
|
||||
'labels': instance.labels?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesLockable _$GhIssuesLockableFromJson(Map<String, dynamic> json) {
|
||||
return GhIssuesLockable()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesLockableToJson(GhIssuesLockable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesReactable _$GhIssuesReactableFromJson(Map<String, dynamic> json) {
|
||||
return GhIssuesReactable()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesReactableToJson(GhIssuesReactable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesRepositoryNode _$GhIssuesRepositoryNodeFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhIssuesRepositoryNode(
|
||||
repository: json['repository'] == null
|
||||
? null
|
||||
: GhIssuesRepository.fromJson(
|
||||
json['repository'] as Map<String, dynamic>),
|
||||
)..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesRepositoryNodeToJson(
|
||||
GhIssuesRepositoryNode instance) =>
|
||||
<String, dynamic>{
|
||||
'repository': instance.repository?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhIssuesArguments _$GhIssuesArgumentsFromJson(Map<String, dynamic> json) {
|
||||
return GhIssuesArguments(
|
||||
owner: json['owner'] as String,
|
||||
name: json['name'] as String,
|
||||
cursor: json['cursor'] as String,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhIssuesArgumentsToJson(GhIssuesArguments instance) =>
|
||||
<String, dynamic>{
|
||||
'owner': instance.owner,
|
||||
'name': instance.name,
|
||||
'cursor': instance.cursor,
|
||||
};
|
||||
|
||||
GhPulls _$GhPullsFromJson(Map<String, dynamic> json) {
|
||||
return GhPulls(
|
||||
repository: json['repository'] == null
|
||||
? null
|
||||
: GhPullsRepository.fromJson(
|
||||
json['repository'] as Map<String, dynamic>),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsToJson(GhPulls instance) => <String, dynamic>{
|
||||
'repository': instance.repository?.toJson(),
|
||||
};
|
||||
|
||||
GhPullsRepository _$GhPullsRepositoryFromJson(Map<String, dynamic> json) {
|
||||
return GhPullsRepository(
|
||||
pullRequests: json['pullRequests'] == null
|
||||
? null
|
||||
: GhPullsPullRequestConnection.fromJson(
|
||||
json['pullRequests'] as Map<String, dynamic>),
|
||||
)
|
||||
..owner = json['owner'] == null
|
||||
? null
|
||||
: GhPullsRepositoryOwner.fromJson(json['owner'] as Map<String, dynamic>)
|
||||
..name = json['name'] as String
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsRepositoryToJson(GhPullsRepository instance) =>
|
||||
<String, dynamic>{
|
||||
'owner': instance.owner?.toJson(),
|
||||
'name': instance.name,
|
||||
'pullRequests': instance.pullRequests?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsRepositoryOwner _$GhPullsRepositoryOwnerFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhPullsRepositoryOwner(
|
||||
login: json['login'] as String,
|
||||
)..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsRepositoryOwnerToJson(
|
||||
GhPullsRepositoryOwner instance) =>
|
||||
<String, dynamic>{
|
||||
'login': instance.login,
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsPullRequestConnection _$GhPullsPullRequestConnectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhPullsPullRequestConnection(
|
||||
pageInfo: json['pageInfo'] == null
|
||||
? null
|
||||
: GhPullsPageInfo.fromJson(json['pageInfo'] as Map<String, dynamic>),
|
||||
nodes: (json['nodes'] as List)
|
||||
?.map((e) => e == null
|
||||
? null
|
||||
: GhPullsPullRequest.fromJson(e as Map<String, dynamic>))
|
||||
?.toList(),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsPullRequestConnectionToJson(
|
||||
GhPullsPullRequestConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'pageInfo': instance.pageInfo?.toJson(),
|
||||
'nodes': instance.nodes?.map((e) => e?.toJson())?.toList(),
|
||||
};
|
||||
|
||||
GhPullsPageInfo _$GhPullsPageInfoFromJson(Map<String, dynamic> json) {
|
||||
return GhPullsPageInfo(
|
||||
hasNextPage: json['hasNextPage'] as bool,
|
||||
endCursor: json['endCursor'] as String,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsPageInfoToJson(GhPullsPageInfo instance) =>
|
||||
<String, dynamic>{
|
||||
'hasNextPage': instance.hasNextPage,
|
||||
'endCursor': instance.endCursor,
|
||||
};
|
||||
|
||||
GhPullsPullRequest _$GhPullsPullRequestFromJson(Map<String, dynamic> json) {
|
||||
return GhPullsPullRequest(
|
||||
number: json['number'] as int,
|
||||
title: json['title'] as String,
|
||||
comments: json['comments'] == null
|
||||
? null
|
||||
: GhPullsIssueCommentConnection.fromJson(
|
||||
json['comments'] as Map<String, dynamic>),
|
||||
)
|
||||
..repository = json['repository'] == null
|
||||
? null
|
||||
: GhPullsRepository.fromJson(json['repository'] as Map<String, dynamic>)
|
||||
..updatedAt = json['updatedAt'] == null
|
||||
? null
|
||||
: DateTime.parse(json['updatedAt'] as String)
|
||||
..author = json['author'] == null
|
||||
? null
|
||||
: GhPullsActor.fromJson(json['author'] as Map<String, dynamic>)
|
||||
..labels = json['labels'] == null
|
||||
? null
|
||||
: GhPullsLabelConnection.fromJson(
|
||||
json['labels'] as Map<String, dynamic>)
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsPullRequestToJson(GhPullsPullRequest instance) =>
|
||||
<String, dynamic>{
|
||||
'repository': instance.repository?.toJson(),
|
||||
'number': instance.number,
|
||||
'title': instance.title,
|
||||
'updatedAt': instance.updatedAt?.toIso8601String(),
|
||||
'author': instance.author?.toJson(),
|
||||
'labels': instance.labels?.toJson(),
|
||||
'comments': instance.comments?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsPinnableItem _$GhPullsPinnableItemFromJson(Map<String, dynamic> json) {
|
||||
return GhPullsPinnableItem();
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsPinnableItemToJson(
|
||||
GhPullsPinnableItem instance) =>
|
||||
<String, dynamic>{};
|
||||
|
||||
GhPullsNode _$GhPullsNodeFromJson(Map<String, dynamic> json) {
|
||||
return GhPullsNode()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsNodeToJson(GhPullsNode instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsProjectOwner _$GhPullsProjectOwnerFromJson(Map<String, dynamic> json) {
|
||||
return GhPullsProjectOwner()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsProjectOwnerToJson(
|
||||
GhPullsProjectOwner instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsRegistryPackageOwner _$GhPullsRegistryPackageOwnerFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhPullsRegistryPackageOwner()
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsRegistryPackageOwnerToJson(
|
||||
GhPullsRegistryPackageOwner instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsRegistryPackageSearch _$GhPullsRegistryPackageSearchFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhPullsRegistryPackageSearch()
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsRegistryPackageSearchToJson(
|
||||
GhPullsRegistryPackageSearch instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsSubscribable _$GhPullsSubscribableFromJson(Map<String, dynamic> json) {
|
||||
return GhPullsSubscribable()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsSubscribableToJson(
|
||||
GhPullsSubscribable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsStarrable _$GhPullsStarrableFromJson(Map<String, dynamic> json) {
|
||||
return GhPullsStarrable()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsStarrableToJson(GhPullsStarrable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsUniformResourceLocatable _$GhPullsUniformResourceLocatableFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhPullsUniformResourceLocatable()
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsUniformResourceLocatableToJson(
|
||||
GhPullsUniformResourceLocatable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsRepositoryInfo _$GhPullsRepositoryInfoFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhPullsRepositoryInfo(
|
||||
owner: json['owner'] == null
|
||||
? null
|
||||
: GhPullsRepositoryOwner.fromJson(
|
||||
json['owner'] as Map<String, dynamic>),
|
||||
name: json['name'] as String,
|
||||
)..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsRepositoryInfoToJson(
|
||||
GhPullsRepositoryInfo instance) =>
|
||||
<String, dynamic>{
|
||||
'owner': instance.owner?.toJson(),
|
||||
'name': instance.name,
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsActor _$GhPullsActorFromJson(Map<String, dynamic> json) {
|
||||
return GhPullsActor(
|
||||
login: json['login'] as String,
|
||||
avatarUrl: json['avatarUrl'] as String,
|
||||
)..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsActorToJson(GhPullsActor instance) =>
|
||||
<String, dynamic>{
|
||||
'login': instance.login,
|
||||
'avatarUrl': instance.avatarUrl,
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsLabelConnection _$GhPullsLabelConnectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhPullsLabelConnection(
|
||||
nodes: (json['nodes'] as List)
|
||||
?.map((e) =>
|
||||
e == null ? null : GhPullsLabel.fromJson(e as Map<String, dynamic>))
|
||||
?.toList(),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsLabelConnectionToJson(
|
||||
GhPullsLabelConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'nodes': instance.nodes?.map((e) => e?.toJson())?.toList(),
|
||||
};
|
||||
|
||||
GhPullsLabel _$GhPullsLabelFromJson(Map<String, dynamic> json) {
|
||||
return GhPullsLabel(
|
||||
name: json['name'] as String,
|
||||
color: json['color'] as String,
|
||||
)..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsLabelToJson(GhPullsLabel instance) =>
|
||||
<String, dynamic>{
|
||||
'name': instance.name,
|
||||
'color': instance.color,
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsIssueCommentConnection _$GhPullsIssueCommentConnectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhPullsIssueCommentConnection(
|
||||
totalCount: json['totalCount'] as int,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsIssueCommentConnectionToJson(
|
||||
GhPullsIssueCommentConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'totalCount': instance.totalCount,
|
||||
};
|
||||
|
||||
GhPullsProjectCardItem _$GhPullsProjectCardItemFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhPullsProjectCardItem();
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsProjectCardItemToJson(
|
||||
GhPullsProjectCardItem instance) =>
|
||||
<String, dynamic>{};
|
||||
|
||||
GhPullsAssignable _$GhPullsAssignableFromJson(Map<String, dynamic> json) {
|
||||
return GhPullsAssignable()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsAssignableToJson(GhPullsAssignable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsClosable _$GhPullsClosableFromJson(Map<String, dynamic> json) {
|
||||
return GhPullsClosable()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsClosableToJson(GhPullsClosable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsComment _$GhPullsCommentFromJson(Map<String, dynamic> json) {
|
||||
return GhPullsComment(
|
||||
updatedAt: json['updatedAt'] == null
|
||||
? null
|
||||
: DateTime.parse(json['updatedAt'] as String),
|
||||
author: json['author'] == null
|
||||
? null
|
||||
: GhPullsActor.fromJson(json['author'] as Map<String, dynamic>),
|
||||
)..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsCommentToJson(GhPullsComment instance) =>
|
||||
<String, dynamic>{
|
||||
'updatedAt': instance.updatedAt?.toIso8601String(),
|
||||
'author': instance.author?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsUpdatable _$GhPullsUpdatableFromJson(Map<String, dynamic> json) {
|
||||
return GhPullsUpdatable()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsUpdatableToJson(GhPullsUpdatable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsUpdatableComment _$GhPullsUpdatableCommentFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhPullsUpdatableComment()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsUpdatableCommentToJson(
|
||||
GhPullsUpdatableComment instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsLabelable _$GhPullsLabelableFromJson(Map<String, dynamic> json) {
|
||||
return GhPullsLabelable(
|
||||
labels: json['labels'] == null
|
||||
? null
|
||||
: GhPullsLabelConnection.fromJson(
|
||||
json['labels'] as Map<String, dynamic>),
|
||||
)..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsLabelableToJson(GhPullsLabelable instance) =>
|
||||
<String, dynamic>{
|
||||
'labels': instance.labels?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsLockable _$GhPullsLockableFromJson(Map<String, dynamic> json) {
|
||||
return GhPullsLockable()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsLockableToJson(GhPullsLockable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsReactable _$GhPullsReactableFromJson(Map<String, dynamic> json) {
|
||||
return GhPullsReactable()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsReactableToJson(GhPullsReactable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsRepositoryNode _$GhPullsRepositoryNodeFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GhPullsRepositoryNode(
|
||||
repository: json['repository'] == null
|
||||
? null
|
||||
: GhPullsRepository.fromJson(
|
||||
json['repository'] as Map<String, dynamic>),
|
||||
)..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsRepositoryNodeToJson(
|
||||
GhPullsRepositoryNode instance) =>
|
||||
<String, dynamic>{
|
||||
'repository': instance.repository?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GhPullsArguments _$GhPullsArgumentsFromJson(Map<String, dynamic> json) {
|
||||
return GhPullsArguments(
|
||||
owner: json['owner'] as String,
|
||||
name: json['name'] as String,
|
||||
cursor: json['cursor'] as String,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GhPullsArgumentsToJson(GhPullsArguments instance) =>
|
||||
<String, dynamic>{
|
||||
'owner': instance.owner,
|
||||
'name': instance.name,
|
||||
'cursor': instance.cursor,
|
||||
};
|
||||
|
43
lib/graphql/gh_issues.graphql
Normal file
43
lib/graphql/gh_issues.graphql
Normal file
@ -0,0 +1,43 @@
|
||||
query GhIssues($owner: String!, $name: String!, $cursor: String) {
|
||||
repository(owner: $owner, name: $name) {
|
||||
owner {
|
||||
login
|
||||
}
|
||||
name
|
||||
issues(
|
||||
states: OPEN
|
||||
orderBy: { field: CREATED_AT, direction: DESC }
|
||||
first: 30
|
||||
after: $cursor
|
||||
) {
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
endCursor
|
||||
}
|
||||
nodes {
|
||||
repository {
|
||||
owner {
|
||||
login
|
||||
}
|
||||
name
|
||||
}
|
||||
number
|
||||
title
|
||||
updatedAt
|
||||
author {
|
||||
login
|
||||
avatarUrl
|
||||
}
|
||||
labels(first: 10) {
|
||||
nodes {
|
||||
name
|
||||
color
|
||||
}
|
||||
}
|
||||
comments {
|
||||
totalCount
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
43
lib/graphql/gh_pulls.graphql
Normal file
43
lib/graphql/gh_pulls.graphql
Normal file
@ -0,0 +1,43 @@
|
||||
query GhPulls($owner: String!, $name: String!, $cursor: String) {
|
||||
repository(owner: $owner, name: $name) {
|
||||
owner {
|
||||
login
|
||||
}
|
||||
name
|
||||
pullRequests(
|
||||
states: OPEN
|
||||
orderBy: { field: CREATED_AT, direction: DESC }
|
||||
first: 30
|
||||
after: $cursor
|
||||
) {
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
endCursor
|
||||
}
|
||||
nodes {
|
||||
repository {
|
||||
owner {
|
||||
login
|
||||
}
|
||||
name
|
||||
}
|
||||
number
|
||||
title
|
||||
updatedAt
|
||||
author {
|
||||
login
|
||||
avatarUrl
|
||||
}
|
||||
labels(first: 10) {
|
||||
nodes {
|
||||
name
|
||||
color
|
||||
}
|
||||
}
|
||||
comments {
|
||||
totalCount
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -16,6 +16,7 @@ import 'package:git_touch/screens/gitlab_user.dart';
|
||||
import 'package:git_touch/screens/issue_form.dart';
|
||||
import 'package:git_touch/screens/issues.dart';
|
||||
import 'package:git_touch/screens/object.dart';
|
||||
import 'package:git_touch/screens/pulls.dart';
|
||||
import 'package:git_touch/screens/repository.dart';
|
||||
import 'package:git_touch/screens/settings.dart';
|
||||
import 'package:git_touch/screens/stargazers.dart';
|
||||
|
@ -19,7 +19,7 @@ final issueRouter = RouterScreen(
|
||||
params['name'].first, int.parse(params['number'].first)));
|
||||
|
||||
final pullRouter = RouterScreen(
|
||||
'/:owner/:name/pulls/:number',
|
||||
'/:owner/:name/pull/:number',
|
||||
(context, params) => IssueScreen(params['owner'].first,
|
||||
params['name'].first, int.parse(params['number'].first),
|
||||
isPullRequest: true));
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/graphql/gh.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||
@ -6,6 +7,7 @@ import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/action_entry.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/issue_item.dart';
|
||||
import 'package:git_touch/widgets/label.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
final issuesRouter = RouterScreen(
|
||||
@ -13,52 +15,33 @@ final issuesRouter = RouterScreen(
|
||||
(context, params) =>
|
||||
IssuesScreen(params['owner'].first, params['name'].first));
|
||||
|
||||
final pullsRouter = RouterScreen(
|
||||
'/:owner/:name/pulls',
|
||||
(context, params) => IssuesScreen(
|
||||
params['owner'].first, params['name'].first,
|
||||
isPullRequest: true));
|
||||
|
||||
class IssuesScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final bool isPullRequest;
|
||||
|
||||
IssuesScreen(this.owner, this.name, {this.isPullRequest = false});
|
||||
|
||||
Future<ListPayload> _query(BuildContext context, [String cursor]) async {
|
||||
var cursorChunk = cursor == null ? '' : ', after: "$cursor"';
|
||||
var resource = isPullRequest ? 'pullRequests' : 'issues';
|
||||
|
||||
var data = await Provider.of<AuthModel>(context).query('''
|
||||
{
|
||||
repository(owner: "$owner", name: "$name") {
|
||||
$resource(states: OPEN, orderBy: {field: CREATED_AT, direction: DESC}, first: $pageSize$cursorChunk) {
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
endCursor
|
||||
}
|
||||
nodes {
|
||||
$issueGqlChunk
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
''');
|
||||
|
||||
var repo = data["repository"][resource];
|
||||
IssuesScreen(this.owner, this.name);
|
||||
|
||||
Future<ListPayload<GhIssuesIssue, String>> _query(BuildContext context,
|
||||
[String cursor]) async {
|
||||
final res =
|
||||
await Provider.of<AuthModel>(context).gqlClient.execute(GhIssuesQuery(
|
||||
variables: GhIssuesArguments(
|
||||
owner: owner,
|
||||
name: name,
|
||||
cursor: cursor,
|
||||
)));
|
||||
final issues = res.data.repository.issues;
|
||||
return ListPayload(
|
||||
cursor: repo["pageInfo"]["endCursor"],
|
||||
hasMore: repo['pageInfo']['hasNextPage'],
|
||||
items: repo["nodes"],
|
||||
cursor: issues.pageInfo.endCursor,
|
||||
hasMore: issues.pageInfo.hasNextPage,
|
||||
items: issues.nodes,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold(
|
||||
title: AppBarTitle((isPullRequest ? 'Pull requests' : 'Issues')),
|
||||
return ListStatefulScaffold<GhIssuesIssue, String>(
|
||||
title: AppBarTitle('Issues'),
|
||||
actionBuilder: () => ActionEntry(
|
||||
iconData: Octicons.plus,
|
||||
onTap: () {
|
||||
@ -67,8 +50,22 @@ class IssuesScreen extends StatelessWidget {
|
||||
}),
|
||||
onRefresh: () => _query(context),
|
||||
onLoadMore: (cursor) => _query(context, cursor),
|
||||
itemBuilder: (payload) =>
|
||||
IssueItem(payload: payload, isPullRequest: isPullRequest),
|
||||
itemBuilder: (p) => IssueItem(
|
||||
author: p.author?.login,
|
||||
avatarUrl: p.author?.avatarUrl,
|
||||
commentCount: p.comments.totalCount,
|
||||
number: p.number,
|
||||
title: p.title,
|
||||
updatedAt: p.updatedAt,
|
||||
labels: p.labels.nodes.isEmpty
|
||||
? null
|
||||
: Wrap(spacing: 4, runSpacing: 4, children: [
|
||||
for (var label in p.labels.nodes)
|
||||
MyLabel(name: label.name, cssColor: label.color)
|
||||
]),
|
||||
url:
|
||||
'/${p.repository.owner.login}/${p.repository.name}/issues/${p.number}',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
64
lib/screens/pulls.dart
Normal file
64
lib/screens/pulls.dart
Normal file
@ -0,0 +1,64 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/graphql/gh.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/issue_item.dart';
|
||||
import 'package:git_touch/widgets/label.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
final pullsRouter = RouterScreen(
|
||||
'/:owner/:name/pulls',
|
||||
(context, params) =>
|
||||
PullsScreen(params['owner'].first, params['name'].first));
|
||||
|
||||
class PullsScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
|
||||
PullsScreen(this.owner, this.name);
|
||||
|
||||
Future<ListPayload<GhPullsPullRequest, String>> _query(BuildContext context,
|
||||
[String cursor]) async {
|
||||
final res =
|
||||
await Provider.of<AuthModel>(context).gqlClient.execute(GhPullsQuery(
|
||||
variables: GhPullsArguments(
|
||||
owner: owner,
|
||||
name: name,
|
||||
cursor: cursor,
|
||||
)));
|
||||
final pulls = res.data.repository.pullRequests;
|
||||
return ListPayload(
|
||||
cursor: pulls.pageInfo.endCursor,
|
||||
hasMore: pulls.pageInfo.hasNextPage,
|
||||
items: pulls.nodes,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold<GhPullsPullRequest, String>(
|
||||
title: AppBarTitle('Pull requests'),
|
||||
onRefresh: () => _query(context),
|
||||
onLoadMore: (cursor) => _query(context, cursor),
|
||||
itemBuilder: (p) => IssueItem(
|
||||
isPr: true,
|
||||
author: p.author?.login,
|
||||
avatarUrl: p.author?.avatarUrl,
|
||||
commentCount: p.comments.totalCount,
|
||||
number: p.number,
|
||||
title: p.title,
|
||||
updatedAt: p.updatedAt,
|
||||
labels: p.labels.nodes.isEmpty
|
||||
? null
|
||||
: Wrap(spacing: 4, runSpacing: 4, children: [
|
||||
for (var label in p.labels.nodes)
|
||||
MyLabel(name: label.name, cssColor: label.color)
|
||||
]),
|
||||
url:
|
||||
'/${p.repository.owner.login}/${p.repository.name}/pulls/${p.number}',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -188,7 +188,15 @@ class _SearchScreenState extends State<SearchScreen> {
|
||||
case 2:
|
||||
default:
|
||||
return IssueItem(
|
||||
payload: p, isPullRequest: p['__typename'] == 'PullRequest');
|
||||
author: p['author']['login'],
|
||||
avatarUrl: p['author']['avatarUrl'],
|
||||
commentCount: p['comments']['totalCount'],
|
||||
number: p['number'],
|
||||
title: p['title'],
|
||||
updatedAt: DateTime.parse(p['updatedAt']),
|
||||
url: Uri.parse(p['url']).path,
|
||||
isPr: p['__typename'] == 'PullRequest',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ import '../utils/utils.dart';
|
||||
import '../widgets/link.dart';
|
||||
|
||||
const issueGqlChunk = '''
|
||||
url
|
||||
number
|
||||
title
|
||||
updatedAt
|
||||
@ -33,18 +34,34 @@ comments {
|
||||
''';
|
||||
|
||||
class IssueItem extends StatelessWidget {
|
||||
final payload;
|
||||
final bool isPullRequest;
|
||||
final String url;
|
||||
final int number;
|
||||
final String title;
|
||||
final int commentCount;
|
||||
final DateTime updatedAt;
|
||||
final String avatarUrl;
|
||||
final String author;
|
||||
final Widget labels;
|
||||
final bool isPr;
|
||||
|
||||
IssueItem({this.payload, this.isPullRequest = false});
|
||||
IssueItem({
|
||||
@required this.url,
|
||||
@required this.number,
|
||||
@required this.title,
|
||||
@required this.commentCount,
|
||||
@required this.updatedAt,
|
||||
@required this.avatarUrl,
|
||||
@required this.author,
|
||||
this.labels,
|
||||
this.isPr = false,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Provider.of<ThemeModel>(context);
|
||||
|
||||
return Link(
|
||||
url:
|
||||
'/${payload['repository']['owner']['login']}/${payload['repository']['name']}/${isPullRequest ? 'pulls' : 'issues'}/${payload['number']}',
|
||||
url: url,
|
||||
child: Container(
|
||||
padding: CommonStyle.padding,
|
||||
// color: payload.unread ? Colors.white : Colors.black12,
|
||||
@ -54,12 +71,8 @@ class IssueItem extends StatelessWidget {
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
isPullRequest
|
||||
? Octicons.git_pull_request
|
||||
: Octicons.issue_opened,
|
||||
color: GithubPalette.open,
|
||||
size: 20),
|
||||
Icon(isPr ? Octicons.git_pull_request : Octicons.issue_opened,
|
||||
color: GithubPalette.open, size: 20),
|
||||
SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Container(
|
||||
@ -69,9 +82,9 @@ class IssueItem extends StatelessWidget {
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(text: payload['title'] + ' '),
|
||||
TextSpan(text: '$title '),
|
||||
TextSpan(
|
||||
text: '#${payload['number']}',
|
||||
text: '#$number',
|
||||
style: TextStyle(
|
||||
color: theme.palette.tertiaryText,
|
||||
fontWeight: FontWeight.normal,
|
||||
@ -85,18 +98,7 @@ class IssueItem extends StatelessWidget {
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
if ((payload['labels']['nodes'] as List).isNotEmpty)
|
||||
Wrap(
|
||||
spacing: 4,
|
||||
runSpacing: 4,
|
||||
children: (payload['labels']['nodes'] as List)
|
||||
.map((label) {
|
||||
return MyLabel(
|
||||
name: label['name'],
|
||||
cssColor: label['color'],
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
if (labels != null) labels,
|
||||
DefaultTextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
@ -106,29 +108,25 @@ class IssueItem extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
// FIXME: Deleted user
|
||||
if (payload['author'] != null) ...[
|
||||
if (avatarUrl != null) ...[
|
||||
Avatar(
|
||||
size: AvatarSize.extraSmall,
|
||||
url: payload['author']['avatarUrl'],
|
||||
linkUrl: '/' + payload['author']['login'],
|
||||
url: avatarUrl,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
Text(
|
||||
payload['author']['login'],
|
||||
author,
|
||||
style: TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
Text(' opened ' +
|
||||
timeago.format(
|
||||
DateTime.parse(payload['updatedAt']))),
|
||||
if (payload['comments']['totalCount'] > 0) ...[
|
||||
Text(' opened ' + timeago.format(updatedAt)),
|
||||
if (commentCount > 0) ...[
|
||||
Expanded(child: SizedBox()),
|
||||
Icon(Octicons.comment,
|
||||
size: 14,
|
||||
color: theme.palette.secondaryText),
|
||||
SizedBox(width: 3),
|
||||
Text(numberFormat
|
||||
.format(payload['comments']['totalCount']))
|
||||
Text(numberFormat.format(commentCount))
|
||||
],
|
||||
],
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user