mirror of
https://github.com/git-touch/git-touch
synced 2025-01-31 08:04:51 +01:00
fix: user type
This commit is contained in:
parent
ec4f22ab82
commit
755aba7727
@ -38,16 +38,8 @@ class RepositoryScreen extends StatelessWidget {
|
||||
var data = await Provider.of<AuthModel>(context).query('''
|
||||
{
|
||||
repository(owner: "$owner", name: "$name") {
|
||||
$repoChunk
|
||||
id
|
||||
owner {
|
||||
__typename
|
||||
login
|
||||
avatarUrl
|
||||
}
|
||||
name
|
||||
isPrivate
|
||||
isFork
|
||||
description
|
||||
diskUsage
|
||||
hasIssuesEnabled
|
||||
url
|
||||
@ -57,16 +49,6 @@ class RepositoryScreen extends StatelessWidget {
|
||||
watchers {
|
||||
totalCount
|
||||
}
|
||||
stargazers {
|
||||
totalCount
|
||||
}
|
||||
forks {
|
||||
totalCount
|
||||
}
|
||||
primaryLanguage {
|
||||
color
|
||||
name
|
||||
}
|
||||
issues(states: OPEN) {
|
||||
totalCount
|
||||
}
|
||||
|
@ -1,38 +1,27 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import '../screens/user.dart';
|
||||
import 'link.dart';
|
||||
|
||||
class Avatar extends StatelessWidget {
|
||||
final String url;
|
||||
final String login;
|
||||
final double size;
|
||||
|
||||
Avatar({
|
||||
@required this.url,
|
||||
this.login,
|
||||
@required this.size,
|
||||
});
|
||||
Avatar.extraSmall({
|
||||
@required this.url,
|
||||
this.login,
|
||||
}) : size = 16;
|
||||
Avatar.small({
|
||||
@required this.url,
|
||||
this.login,
|
||||
}) : size = 24;
|
||||
Avatar.small({@required this.url}) : size = 24;
|
||||
Avatar.medium({
|
||||
@required this.url,
|
||||
this.login,
|
||||
}) : size = 36;
|
||||
Avatar.large({
|
||||
@required this.url,
|
||||
this.login,
|
||||
}) : size = 48;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var avatar = ClipRRect(
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
child: FadeInImage.assetNetwork(
|
||||
placeholder: 'images/octoface.png',
|
||||
@ -43,14 +32,5 @@ class Avatar extends StatelessWidget {
|
||||
fadeOutDuration: Duration(milliseconds: 100),
|
||||
),
|
||||
);
|
||||
|
||||
if (login == null) {
|
||||
return avatar;
|
||||
} else {
|
||||
return Link(
|
||||
screenBuilder: (_) => UserScreen(login),
|
||||
child: avatar,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
import 'package:git_touch/screens/user.dart';
|
||||
import 'package:git_touch/widgets/markdown_view.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:timeago/timeago.dart' as timeago;
|
||||
@ -43,9 +44,9 @@ class CommentItem extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(children: <Widget>[
|
||||
Avatar.medium(
|
||||
url: payload['author']['avatarUrl'],
|
||||
login: payload['author']['login'],
|
||||
Link(
|
||||
child: Avatar.medium(url: payload['author']['avatarUrl']),
|
||||
screenBuilder: (_) => UserScreen(payload['author']['login']),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
|
@ -79,9 +79,9 @@ class EventItem extends StatelessWidget {
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Avatar.medium(
|
||||
url: event.actorAvatarUrl,
|
||||
login: event.actorLogin,
|
||||
Link(
|
||||
child: Avatar.medium(url: event.actorAvatarUrl),
|
||||
screenBuilder: (_) => UserScreen(event.actorLogin),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Expanded(
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/screens/user.dart';
|
||||
import 'package:git_touch/widgets/avatar.dart';
|
||||
import 'package:primer/primer.dart';
|
||||
import 'package:timeago/timeago.dart' as timeago;
|
||||
@ -120,9 +121,11 @@ class IssueItem extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
// FIXME: Deleted user
|
||||
if (payload['author'] != null) ...[
|
||||
Avatar.extraSmall(
|
||||
login: payload['author']['login'],
|
||||
url: payload['author']['avatarUrl'],
|
||||
Link(
|
||||
child: Avatar.extraSmall(
|
||||
url: payload['author']['avatarUrl']),
|
||||
screenBuilder: (_) =>
|
||||
UserScreen(payload['author']['login']),
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
Text(
|
||||
|
@ -1,6 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:git_touch/screens/organization.dart';
|
||||
import 'package:git_touch/screens/repository.dart';
|
||||
import 'package:git_touch/screens/user.dart';
|
||||
import 'package:git_touch/widgets/avatar.dart';
|
||||
import 'package:primer/primer.dart';
|
||||
import '../utils/utils.dart';
|
||||
@ -8,6 +10,7 @@ import 'link.dart';
|
||||
|
||||
const repoChunk = '''
|
||||
owner {
|
||||
__typename
|
||||
login
|
||||
avatarUrl
|
||||
}
|
||||
@ -130,9 +133,12 @@ class RepositoryItem extends StatelessWidget {
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Avatar.small(
|
||||
url: payload['owner']['avatarUrl'],
|
||||
login: payload['owner']['login'],
|
||||
Link(
|
||||
child: Avatar.small(url: payload['owner']['avatarUrl']),
|
||||
screenBuilder: (_) =>
|
||||
payload['owner']['__typename'] == 'Organization'
|
||||
? OrganizationScreen(payload['owner']['login'])
|
||||
: UserScreen(payload['owner']['login']),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
|
Loading…
x
Reference in New Issue
Block a user