refactor: add me screen
This commit is contained in:
parent
84ff5d7876
commit
1820929eb2
|
@ -54,6 +54,11 @@ targets:
|
|||
queries_glob: lib/graphql/github_commits.graphql
|
||||
resolve_type_field: __typename
|
||||
add_query_prefix: true
|
||||
- schema: lib/github.schema.json
|
||||
output: lib/graphql/github_me.dart
|
||||
queries_glob: lib/graphql/github_me.graphql
|
||||
resolve_type_field: __typename
|
||||
add_query_prefix: true
|
||||
scalar_mapping:
|
||||
- graphql_type: URI
|
||||
dart_type: String
|
||||
|
|
|
@ -0,0 +1,467 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
import 'package:artemis/artemis.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:gql/ast.dart';
|
||||
part 'github_me.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMe with EquatableMixin {
|
||||
GithubMe();
|
||||
|
||||
factory GithubMe.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubMeFromJson(json);
|
||||
|
||||
GithubMeUser viewer;
|
||||
|
||||
@override
|
||||
List<Object> get props => [viewer];
|
||||
Map<String, dynamic> toJson() => _$GithubMeToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeUser extends GithubMeAuditEntryActor
|
||||
with EquatableMixin
|
||||
implements
|
||||
GithubMeNode,
|
||||
GithubMeActor,
|
||||
GithubMeRegistryPackageOwner,
|
||||
GithubMeRegistryPackageSearch,
|
||||
GithubMeProjectOwner,
|
||||
GithubMeRepositoryOwner,
|
||||
GithubMeUniformResourceLocatable,
|
||||
GithubMeProfileOwner,
|
||||
GithubMeSponsorable {
|
||||
GithubMeUser();
|
||||
|
||||
factory GithubMeUser.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubMeUserFromJson(json);
|
||||
|
||||
@override
|
||||
String login;
|
||||
|
||||
@override
|
||||
String avatarUrl;
|
||||
|
||||
@override
|
||||
String url;
|
||||
|
||||
@override
|
||||
String name;
|
||||
|
||||
String bio;
|
||||
|
||||
String company;
|
||||
|
||||
@override
|
||||
String location;
|
||||
|
||||
@override
|
||||
String email;
|
||||
|
||||
@override
|
||||
String websiteUrl;
|
||||
|
||||
GithubMeStarredRepositoryConnection starredRepositories;
|
||||
|
||||
GithubMeFollowerConnection followers;
|
||||
|
||||
GithubMeFollowingConnection following;
|
||||
|
||||
@override
|
||||
GithubMeRepositoryConnection repositories;
|
||||
|
||||
@override
|
||||
@JsonKey(name: '__typename')
|
||||
String resolveType;
|
||||
|
||||
@override
|
||||
List<Object> get props => [
|
||||
login,
|
||||
avatarUrl,
|
||||
url,
|
||||
name,
|
||||
bio,
|
||||
company,
|
||||
location,
|
||||
email,
|
||||
websiteUrl,
|
||||
starredRepositories,
|
||||
followers,
|
||||
following,
|
||||
repositories,
|
||||
resolveType
|
||||
];
|
||||
Map<String, dynamic> toJson() => _$GithubMeUserToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeStarredRepositoryConnection with EquatableMixin {
|
||||
GithubMeStarredRepositoryConnection();
|
||||
|
||||
factory GithubMeStarredRepositoryConnection.fromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$GithubMeStarredRepositoryConnectionFromJson(json);
|
||||
|
||||
int totalCount;
|
||||
|
||||
@override
|
||||
List<Object> get props => [totalCount];
|
||||
Map<String, dynamic> toJson() =>
|
||||
_$GithubMeStarredRepositoryConnectionToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeFollowerConnection with EquatableMixin {
|
||||
GithubMeFollowerConnection();
|
||||
|
||||
factory GithubMeFollowerConnection.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubMeFollowerConnectionFromJson(json);
|
||||
|
||||
int totalCount;
|
||||
|
||||
@override
|
||||
List<Object> get props => [totalCount];
|
||||
Map<String, dynamic> toJson() => _$GithubMeFollowerConnectionToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeFollowingConnection with EquatableMixin {
|
||||
GithubMeFollowingConnection();
|
||||
|
||||
factory GithubMeFollowingConnection.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubMeFollowingConnectionFromJson(json);
|
||||
|
||||
int totalCount;
|
||||
|
||||
@override
|
||||
List<Object> get props => [totalCount];
|
||||
Map<String, dynamic> toJson() => _$GithubMeFollowingConnectionToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeRepositoryConnection with EquatableMixin {
|
||||
GithubMeRepositoryConnection();
|
||||
|
||||
factory GithubMeRepositoryConnection.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubMeRepositoryConnectionFromJson(json);
|
||||
|
||||
int totalCount;
|
||||
|
||||
@override
|
||||
List<Object> get props => [totalCount];
|
||||
Map<String, dynamic> toJson() => _$GithubMeRepositoryConnectionToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeAuditEntryActor with EquatableMixin {
|
||||
GithubMeAuditEntryActor();
|
||||
|
||||
factory GithubMeAuditEntryActor.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubMeAuditEntryActorFromJson(json);
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
Map<String, dynamic> toJson() => _$GithubMeAuditEntryActorToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeNode with EquatableMixin {
|
||||
GithubMeNode();
|
||||
|
||||
factory GithubMeNode.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubMeNodeFromJson(json);
|
||||
|
||||
@JsonKey(name: '__typename')
|
||||
String resolveType;
|
||||
|
||||
@override
|
||||
List<Object> get props => [resolveType];
|
||||
Map<String, dynamic> toJson() => _$GithubMeNodeToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeActor with EquatableMixin {
|
||||
GithubMeActor();
|
||||
|
||||
factory GithubMeActor.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubMeActorFromJson(json);
|
||||
|
||||
String login;
|
||||
|
||||
String avatarUrl;
|
||||
|
||||
String url;
|
||||
|
||||
@JsonKey(name: '__typename')
|
||||
String resolveType;
|
||||
|
||||
@override
|
||||
List<Object> get props => [login, avatarUrl, url, resolveType];
|
||||
Map<String, dynamic> toJson() => _$GithubMeActorToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeRegistryPackageOwner with EquatableMixin {
|
||||
GithubMeRegistryPackageOwner();
|
||||
|
||||
factory GithubMeRegistryPackageOwner.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubMeRegistryPackageOwnerFromJson(json);
|
||||
|
||||
@JsonKey(name: '__typename')
|
||||
String resolveType;
|
||||
|
||||
@override
|
||||
List<Object> get props => [resolveType];
|
||||
Map<String, dynamic> toJson() => _$GithubMeRegistryPackageOwnerToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeRegistryPackageSearch with EquatableMixin {
|
||||
GithubMeRegistryPackageSearch();
|
||||
|
||||
factory GithubMeRegistryPackageSearch.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubMeRegistryPackageSearchFromJson(json);
|
||||
|
||||
@JsonKey(name: '__typename')
|
||||
String resolveType;
|
||||
|
||||
@override
|
||||
List<Object> get props => [resolveType];
|
||||
Map<String, dynamic> toJson() => _$GithubMeRegistryPackageSearchToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeProjectOwner with EquatableMixin {
|
||||
GithubMeProjectOwner();
|
||||
|
||||
factory GithubMeProjectOwner.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubMeProjectOwnerFromJson(json);
|
||||
|
||||
@JsonKey(name: '__typename')
|
||||
String resolveType;
|
||||
|
||||
@override
|
||||
List<Object> get props => [resolveType];
|
||||
Map<String, dynamic> toJson() => _$GithubMeProjectOwnerToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeRepositoryOwner with EquatableMixin {
|
||||
GithubMeRepositoryOwner();
|
||||
|
||||
factory GithubMeRepositoryOwner.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubMeRepositoryOwnerFromJson(json);
|
||||
|
||||
String login;
|
||||
|
||||
String avatarUrl;
|
||||
|
||||
String url;
|
||||
|
||||
GithubMeRepositoryConnection repositories;
|
||||
|
||||
@JsonKey(name: '__typename')
|
||||
String resolveType;
|
||||
|
||||
@override
|
||||
List<Object> get props => [login, avatarUrl, url, repositories, resolveType];
|
||||
Map<String, dynamic> toJson() => _$GithubMeRepositoryOwnerToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeUniformResourceLocatable with EquatableMixin {
|
||||
GithubMeUniformResourceLocatable();
|
||||
|
||||
factory GithubMeUniformResourceLocatable.fromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$GithubMeUniformResourceLocatableFromJson(json);
|
||||
|
||||
String url;
|
||||
|
||||
@JsonKey(name: '__typename')
|
||||
String resolveType;
|
||||
|
||||
@override
|
||||
List<Object> get props => [url, resolveType];
|
||||
Map<String, dynamic> toJson() =>
|
||||
_$GithubMeUniformResourceLocatableToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeProfileOwner with EquatableMixin {
|
||||
GithubMeProfileOwner();
|
||||
|
||||
factory GithubMeProfileOwner.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubMeProfileOwnerFromJson(json);
|
||||
|
||||
String login;
|
||||
|
||||
String name;
|
||||
|
||||
String location;
|
||||
|
||||
String email;
|
||||
|
||||
String websiteUrl;
|
||||
|
||||
@JsonKey(name: '__typename')
|
||||
String resolveType;
|
||||
|
||||
@override
|
||||
List<Object> get props =>
|
||||
[login, name, location, email, websiteUrl, resolveType];
|
||||
Map<String, dynamic> toJson() => _$GithubMeProfileOwnerToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeSponsorable with EquatableMixin {
|
||||
GithubMeSponsorable();
|
||||
|
||||
factory GithubMeSponsorable.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubMeSponsorableFromJson(json);
|
||||
|
||||
@JsonKey(name: '__typename')
|
||||
String resolveType;
|
||||
|
||||
@override
|
||||
List<Object> get props => [resolveType];
|
||||
Map<String, dynamic> toJson() => _$GithubMeSponsorableToJson(this);
|
||||
}
|
||||
|
||||
class GithubMeQuery extends GraphQLQuery<GithubMe, JsonSerializable> {
|
||||
GithubMeQuery();
|
||||
|
||||
@override
|
||||
final DocumentNode document = DocumentNode(definitions: [
|
||||
OperationDefinitionNode(
|
||||
type: OperationType.query,
|
||||
name: null,
|
||||
variableDefinitions: [],
|
||||
directives: [],
|
||||
selectionSet: SelectionSetNode(selections: [
|
||||
FieldNode(
|
||||
name: NameNode(value: 'viewer'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: SelectionSetNode(selections: [
|
||||
FieldNode(
|
||||
name: NameNode(value: 'login'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: null),
|
||||
FieldNode(
|
||||
name: NameNode(value: 'avatarUrl'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: null),
|
||||
FieldNode(
|
||||
name: NameNode(value: 'url'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: null),
|
||||
FieldNode(
|
||||
name: NameNode(value: 'name'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: null),
|
||||
FieldNode(
|
||||
name: NameNode(value: 'bio'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: null),
|
||||
FieldNode(
|
||||
name: NameNode(value: 'company'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: null),
|
||||
FieldNode(
|
||||
name: NameNode(value: 'location'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: null),
|
||||
FieldNode(
|
||||
name: NameNode(value: 'email'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: null),
|
||||
FieldNode(
|
||||
name: NameNode(value: 'websiteUrl'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: null),
|
||||
FieldNode(
|
||||
name: NameNode(value: 'starredRepositories'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: SelectionSetNode(selections: [
|
||||
FieldNode(
|
||||
name: NameNode(value: 'totalCount'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: null)
|
||||
])),
|
||||
FieldNode(
|
||||
name: NameNode(value: 'followers'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: SelectionSetNode(selections: [
|
||||
FieldNode(
|
||||
name: NameNode(value: 'totalCount'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: null)
|
||||
])),
|
||||
FieldNode(
|
||||
name: NameNode(value: 'following'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: SelectionSetNode(selections: [
|
||||
FieldNode(
|
||||
name: NameNode(value: 'totalCount'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: null)
|
||||
])),
|
||||
FieldNode(
|
||||
name: NameNode(value: 'repositories'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: SelectionSetNode(selections: [
|
||||
FieldNode(
|
||||
name: NameNode(value: 'totalCount'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: null)
|
||||
]))
|
||||
]))
|
||||
]))
|
||||
]);
|
||||
|
||||
@override
|
||||
final String operationName = 'github_me';
|
||||
|
||||
@override
|
||||
List<Object> get props => [document, operationName];
|
||||
@override
|
||||
GithubMe parse(Map<String, dynamic> json) => GithubMe.fromJson(json);
|
||||
}
|
|
@ -0,0 +1,247 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'github_me.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
GithubMe _$GithubMeFromJson(Map<String, dynamic> json) {
|
||||
return GithubMe()
|
||||
..viewer = json['viewer'] == null
|
||||
? null
|
||||
: GithubMeUser.fromJson(json['viewer'] as Map<String, dynamic>);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeToJson(GithubMe instance) => <String, dynamic>{
|
||||
'viewer': instance.viewer?.toJson(),
|
||||
};
|
||||
|
||||
GithubMeUser _$GithubMeUserFromJson(Map<String, dynamic> json) {
|
||||
return GithubMeUser()
|
||||
..login = json['login'] as String
|
||||
..avatarUrl = json['avatarUrl'] as String
|
||||
..url = json['url'] as String
|
||||
..name = json['name'] as String
|
||||
..bio = json['bio'] as String
|
||||
..company = json['company'] as String
|
||||
..location = json['location'] as String
|
||||
..email = json['email'] as String
|
||||
..websiteUrl = json['websiteUrl'] as String
|
||||
..starredRepositories = json['starredRepositories'] == null
|
||||
? null
|
||||
: GithubMeStarredRepositoryConnection.fromJson(
|
||||
json['starredRepositories'] as Map<String, dynamic>)
|
||||
..followers = json['followers'] == null
|
||||
? null
|
||||
: GithubMeFollowerConnection.fromJson(
|
||||
json['followers'] as Map<String, dynamic>)
|
||||
..following = json['following'] == null
|
||||
? null
|
||||
: GithubMeFollowingConnection.fromJson(
|
||||
json['following'] as Map<String, dynamic>)
|
||||
..repositories = json['repositories'] == null
|
||||
? null
|
||||
: GithubMeRepositoryConnection.fromJson(
|
||||
json['repositories'] as Map<String, dynamic>)
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeUserToJson(GithubMeUser instance) =>
|
||||
<String, dynamic>{
|
||||
'login': instance.login,
|
||||
'avatarUrl': instance.avatarUrl,
|
||||
'url': instance.url,
|
||||
'name': instance.name,
|
||||
'bio': instance.bio,
|
||||
'company': instance.company,
|
||||
'location': instance.location,
|
||||
'email': instance.email,
|
||||
'websiteUrl': instance.websiteUrl,
|
||||
'starredRepositories': instance.starredRepositories?.toJson(),
|
||||
'followers': instance.followers?.toJson(),
|
||||
'following': instance.following?.toJson(),
|
||||
'repositories': instance.repositories?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubMeStarredRepositoryConnection
|
||||
_$GithubMeStarredRepositoryConnectionFromJson(Map<String, dynamic> json) {
|
||||
return GithubMeStarredRepositoryConnection()
|
||||
..totalCount = json['totalCount'] as int;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeStarredRepositoryConnectionToJson(
|
||||
GithubMeStarredRepositoryConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'totalCount': instance.totalCount,
|
||||
};
|
||||
|
||||
GithubMeFollowerConnection _$GithubMeFollowerConnectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubMeFollowerConnection()..totalCount = json['totalCount'] as int;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeFollowerConnectionToJson(
|
||||
GithubMeFollowerConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'totalCount': instance.totalCount,
|
||||
};
|
||||
|
||||
GithubMeFollowingConnection _$GithubMeFollowingConnectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubMeFollowingConnection()..totalCount = json['totalCount'] as int;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeFollowingConnectionToJson(
|
||||
GithubMeFollowingConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'totalCount': instance.totalCount,
|
||||
};
|
||||
|
||||
GithubMeRepositoryConnection _$GithubMeRepositoryConnectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubMeRepositoryConnection()..totalCount = json['totalCount'] as int;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeRepositoryConnectionToJson(
|
||||
GithubMeRepositoryConnection instance) =>
|
||||
<String, dynamic>{
|
||||
'totalCount': instance.totalCount,
|
||||
};
|
||||
|
||||
GithubMeAuditEntryActor _$GithubMeAuditEntryActorFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubMeAuditEntryActor();
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeAuditEntryActorToJson(
|
||||
GithubMeAuditEntryActor instance) =>
|
||||
<String, dynamic>{};
|
||||
|
||||
GithubMeNode _$GithubMeNodeFromJson(Map<String, dynamic> json) {
|
||||
return GithubMeNode()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeNodeToJson(GithubMeNode instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubMeActor _$GithubMeActorFromJson(Map<String, dynamic> json) {
|
||||
return GithubMeActor()
|
||||
..login = json['login'] as String
|
||||
..avatarUrl = json['avatarUrl'] as String
|
||||
..url = json['url'] as String
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeActorToJson(GithubMeActor instance) =>
|
||||
<String, dynamic>{
|
||||
'login': instance.login,
|
||||
'avatarUrl': instance.avatarUrl,
|
||||
'url': instance.url,
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubMeRegistryPackageOwner _$GithubMeRegistryPackageOwnerFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubMeRegistryPackageOwner()
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeRegistryPackageOwnerToJson(
|
||||
GithubMeRegistryPackageOwner instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubMeRegistryPackageSearch _$GithubMeRegistryPackageSearchFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubMeRegistryPackageSearch()
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeRegistryPackageSearchToJson(
|
||||
GithubMeRegistryPackageSearch instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubMeProjectOwner _$GithubMeProjectOwnerFromJson(Map<String, dynamic> json) {
|
||||
return GithubMeProjectOwner()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeProjectOwnerToJson(
|
||||
GithubMeProjectOwner instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubMeRepositoryOwner _$GithubMeRepositoryOwnerFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubMeRepositoryOwner()
|
||||
..login = json['login'] as String
|
||||
..avatarUrl = json['avatarUrl'] as String
|
||||
..url = json['url'] as String
|
||||
..repositories = json['repositories'] == null
|
||||
? null
|
||||
: GithubMeRepositoryConnection.fromJson(
|
||||
json['repositories'] as Map<String, dynamic>)
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeRepositoryOwnerToJson(
|
||||
GithubMeRepositoryOwner instance) =>
|
||||
<String, dynamic>{
|
||||
'login': instance.login,
|
||||
'avatarUrl': instance.avatarUrl,
|
||||
'url': instance.url,
|
||||
'repositories': instance.repositories?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubMeUniformResourceLocatable _$GithubMeUniformResourceLocatableFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubMeUniformResourceLocatable()
|
||||
..url = json['url'] as String
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeUniformResourceLocatableToJson(
|
||||
GithubMeUniformResourceLocatable instance) =>
|
||||
<String, dynamic>{
|
||||
'url': instance.url,
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubMeProfileOwner _$GithubMeProfileOwnerFromJson(Map<String, dynamic> json) {
|
||||
return GithubMeProfileOwner()
|
||||
..login = json['login'] as String
|
||||
..name = json['name'] as String
|
||||
..location = json['location'] as String
|
||||
..email = json['email'] as String
|
||||
..websiteUrl = json['websiteUrl'] as String
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeProfileOwnerToJson(
|
||||
GithubMeProfileOwner instance) =>
|
||||
<String, dynamic>{
|
||||
'login': instance.login,
|
||||
'name': instance.name,
|
||||
'location': instance.location,
|
||||
'email': instance.email,
|
||||
'websiteUrl': instance.websiteUrl,
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
GithubMeSponsorable _$GithubMeSponsorableFromJson(Map<String, dynamic> json) {
|
||||
return GithubMeSponsorable()..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeSponsorableToJson(
|
||||
GithubMeSponsorable instance) =>
|
||||
<String, dynamic>{
|
||||
'__typename': instance.resolveType,
|
||||
};
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
viewer {
|
||||
login
|
||||
avatarUrl
|
||||
url
|
||||
name
|
||||
bio
|
||||
company
|
||||
location
|
||||
email
|
||||
websiteUrl
|
||||
starredRepositories {
|
||||
totalCount
|
||||
}
|
||||
followers {
|
||||
totalCount
|
||||
}
|
||||
following {
|
||||
totalCount
|
||||
}
|
||||
repositories {
|
||||
totalCount
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ import 'package:git_touch/screens/gitlab_tree.dart';
|
|||
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/me.dart';
|
||||
import 'package:git_touch/screens/notification.dart';
|
||||
import 'package:git_touch/screens/object.dart';
|
||||
import 'package:git_touch/screens/repository.dart';
|
||||
|
@ -128,7 +129,7 @@ class _HomeState extends State<Home> {
|
|||
case 3:
|
||||
return SearchScreen();
|
||||
case 4:
|
||||
return UserScreen(auth.activeAccount.login);
|
||||
return MeScreen();
|
||||
}
|
||||
break;
|
||||
case PlatformType.gitlab:
|
||||
|
|
|
@ -0,0 +1,149 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:git_touch/graphql/github_me.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
import 'package:git_touch/scaffolds/refresh_stateful.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/entry_item.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:git_touch/widgets/text_contains_organization.dart';
|
||||
import 'package:git_touch/widgets/user_contributions.dart';
|
||||
import 'package:git_touch/widgets/user_item.dart';
|
||||
import 'package:github_contributions/github_contributions.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
class MeScreen extends StatelessWidget {
|
||||
MeScreen();
|
||||
|
||||
Future<GithubMeUser> _query(BuildContext context) async {
|
||||
final data = await Provider.of<AuthModel>(context)
|
||||
.gqlClient
|
||||
.execute(GithubMeQuery());
|
||||
return data.data.viewer;
|
||||
}
|
||||
|
||||
Future<List<ContributionsInfo>> _fetchContributions(
|
||||
BuildContext context) async {
|
||||
final login = Provider.of<AuthModel>(context).activeAccount.login;
|
||||
return getContributions(login);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RefreshStatefulScaffold<
|
||||
Tuple2<GithubMeUser, List<ContributionsInfo>>>(
|
||||
fetchData: () async {
|
||||
final vs = await Future.wait([
|
||||
_query(context),
|
||||
_fetchContributions(context),
|
||||
]);
|
||||
return Tuple2(vs[0] as GithubMeUser, vs[1] as List<ContributionsInfo>);
|
||||
},
|
||||
title: AppBarTitle('Me'),
|
||||
bodyBuilder: (data, _) {
|
||||
final user = data.item1;
|
||||
final contributions = data.item2;
|
||||
|
||||
final theme = Provider.of<ThemeModel>(context);
|
||||
final login = user.login;
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
UserItem(
|
||||
login: user.login,
|
||||
name: user.name,
|
||||
avatarUrl: user.avatarUrl,
|
||||
bio: user.bio,
|
||||
inUserScreen: true,
|
||||
),
|
||||
CommonStyle.border,
|
||||
Row(children: [
|
||||
EntryItem(
|
||||
count: user.repositories.totalCount,
|
||||
text: 'Repositories',
|
||||
url: '/$login?tab=repositories',
|
||||
),
|
||||
EntryItem(
|
||||
count: user.starredRepositories.totalCount,
|
||||
text: 'Stars',
|
||||
url: '/$login?tab=stars',
|
||||
),
|
||||
EntryItem(
|
||||
count: user.followers.totalCount,
|
||||
text: 'Followers',
|
||||
url: '/$login?tab=followers',
|
||||
),
|
||||
EntryItem(
|
||||
count: user.following.totalCount,
|
||||
text: 'Following',
|
||||
url: '/$login?tab=following',
|
||||
),
|
||||
]),
|
||||
CommonStyle.verticalGap,
|
||||
UserContributions(contributions),
|
||||
CommonStyle.verticalGap,
|
||||
TableView(
|
||||
hasIcon: true,
|
||||
items: [
|
||||
if (isNotNullOrEmpty(user.company))
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.organization,
|
||||
text: TextContainsOrganization(
|
||||
user.company,
|
||||
style: TextStyle(fontSize: 16, color: theme.palette.text),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
if (isNotNullOrEmpty(user.location))
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.location,
|
||||
text: Text(user.location),
|
||||
onTap: () {
|
||||
launchUrl('https://www.google.com/maps/place/' +
|
||||
user.location.replaceAll(RegExp(r'\s+'), ''));
|
||||
},
|
||||
),
|
||||
if (isNotNullOrEmpty(user.email))
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.mail,
|
||||
text: Text(user.email),
|
||||
onTap: () {
|
||||
launchUrl('mailto:' + user.email);
|
||||
},
|
||||
),
|
||||
if (isNotNullOrEmpty(user.websiteUrl))
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.link,
|
||||
text: Text(user.websiteUrl),
|
||||
onTap: () {
|
||||
var url = user.websiteUrl;
|
||||
if (!url.startsWith('http')) {
|
||||
url = 'http://$url';
|
||||
}
|
||||
launchUrl(url);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
CommonStyle.verticalGap,
|
||||
TableView(
|
||||
hasIcon: true,
|
||||
items: [
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.settings,
|
||||
text: Text('Settings'),
|
||||
url: '/settings',
|
||||
),
|
||||
],
|
||||
),
|
||||
CommonStyle.verticalGap,
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
|
@ -5,7 +5,6 @@ import 'package:git_touch/models/theme.dart';
|
|||
import 'package:git_touch/scaffolds/refresh_stateful.dart';
|
||||
import 'package:git_touch/screens/users.dart';
|
||||
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/screens/repositories.dart';
|
||||
import 'package:git_touch/widgets/entry_item.dart';
|
||||
|
@ -285,40 +284,30 @@ class UserScreen extends StatelessWidget {
|
|||
switch (payload.resolveType) {
|
||||
case 'User':
|
||||
final user = payload as GithubUserUser;
|
||||
if (login == null) {
|
||||
return ActionEntry(
|
||||
iconData: Icons.settings,
|
||||
onTap: () {
|
||||
Provider.of<ThemeModel>(context).push(context, '/settings');
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return ActionButton(
|
||||
title: 'User Actions',
|
||||
items: [
|
||||
if (user.viewerCanFollow)
|
||||
ActionItem(
|
||||
text: user.viewerIsFollowing ? 'Unfollow' : 'Follow',
|
||||
onPress: (_) async {
|
||||
if (user.viewerIsFollowing) {
|
||||
await Provider.of<AuthModel>(context)
|
||||
.deleteWithCredentials('/user/following/$login');
|
||||
user.viewerIsFollowing = false;
|
||||
} else {
|
||||
Provider.of<AuthModel>(context)
|
||||
.putWithCredentials('/user/following/$login');
|
||||
user.viewerIsFollowing = true;
|
||||
}
|
||||
},
|
||||
),
|
||||
if (data != null) ...[
|
||||
ActionItem.share(user.url),
|
||||
ActionItem.launch(user.url),
|
||||
],
|
||||
return ActionButton(
|
||||
title: 'User Actions',
|
||||
items: [
|
||||
if (user.viewerCanFollow)
|
||||
ActionItem(
|
||||
text: user.viewerIsFollowing ? 'Unfollow' : 'Follow',
|
||||
onPress: (_) async {
|
||||
if (user.viewerIsFollowing) {
|
||||
await Provider.of<AuthModel>(context)
|
||||
.deleteWithCredentials('/user/following/$login');
|
||||
user.viewerIsFollowing = false;
|
||||
} else {
|
||||
Provider.of<AuthModel>(context)
|
||||
.putWithCredentials('/user/following/$login');
|
||||
user.viewerIsFollowing = true;
|
||||
}
|
||||
},
|
||||
),
|
||||
if (data != null) ...[
|
||||
ActionItem.share(user.url),
|
||||
ActionItem.launch(user.url),
|
||||
],
|
||||
);
|
||||
}
|
||||
break;
|
||||
],
|
||||
);
|
||||
case 'Organization':
|
||||
final organization = payload as GithubUserOrganization;
|
||||
return ActionButton(
|
||||
|
|
Loading…
Reference in New Issue