2019-01-27 17:37:44 +01:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
2019-01-30 08:09:27 +01:00
|
|
|
import 'package:git_touch/utils/utils.dart';
|
|
|
|
import 'package:git_touch/widgets/widgets.dart';
|
2019-01-27 17:37:44 +01:00
|
|
|
|
|
|
|
Future queryPullRequest(int id, String owner, String name) async {
|
|
|
|
var data = await query('''
|
|
|
|
{
|
|
|
|
repository(owner: "$owner", name: "$name") {
|
|
|
|
pullRequest(number: $id) {
|
2019-01-28 14:32:01 +01:00
|
|
|
$graphqlChunk1
|
2019-01-27 17:37:44 +01:00
|
|
|
merged
|
|
|
|
permalink
|
|
|
|
additions
|
|
|
|
deletions
|
|
|
|
commits {
|
|
|
|
totalCount
|
|
|
|
}
|
2019-01-28 14:32:01 +01:00
|
|
|
timeline(first: $pageSize) {
|
2019-01-27 17:37:44 +01:00
|
|
|
pageInfo {
|
|
|
|
hasNextPage
|
|
|
|
endCursor
|
|
|
|
}
|
|
|
|
nodes {
|
2019-01-28 14:32:01 +01:00
|
|
|
$graghqlChunk
|
2019-01-27 17:37:44 +01:00
|
|
|
... on ReviewRequestedEvent {
|
|
|
|
createdAt
|
|
|
|
actor {
|
|
|
|
login
|
|
|
|
}
|
|
|
|
requestedReviewer {
|
|
|
|
... on User {
|
|
|
|
login
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
... on PullRequestReview {
|
|
|
|
createdAt
|
|
|
|
state
|
|
|
|
author {
|
|
|
|
login
|
|
|
|
}
|
|
|
|
}
|
|
|
|
... on MergedEvent {
|
|
|
|
createdAt
|
|
|
|
mergeRefName
|
|
|
|
actor {
|
|
|
|
login
|
|
|
|
}
|
|
|
|
commit {
|
|
|
|
oid
|
|
|
|
url
|
|
|
|
}
|
|
|
|
}
|
|
|
|
... on HeadRefDeletedEvent {
|
|
|
|
createdAt
|
|
|
|
actor {
|
|
|
|
login
|
|
|
|
}
|
|
|
|
headRefName
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
''');
|
|
|
|
return data['repository']['pullRequest'];
|
|
|
|
}
|
|
|
|
|
2019-01-28 14:32:01 +01:00
|
|
|
class PullRequestScreen extends StatelessWidget {
|
2019-01-27 17:37:44 +01:00
|
|
|
final int id;
|
|
|
|
final String owner;
|
|
|
|
final String name;
|
|
|
|
|
2019-01-28 14:32:01 +01:00
|
|
|
PullRequestScreen(this.id, this.owner, this.name);
|
2019-01-27 17:37:44 +01:00
|
|
|
|
|
|
|
Widget _buildBadge() {
|
2019-01-28 14:32:01 +01:00
|
|
|
// bool merged = payload['merged'];
|
|
|
|
// int bgColor = merged ? Palette.purple : Palette.green;
|
|
|
|
// IconData iconData = merged ? Octicons.git_merge : Octicons.git_pull_request;
|
|
|
|
// String text = merged ? 'Merged' : 'Open';
|
|
|
|
// return Container(
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
// color: Color(bgColor),
|
|
|
|
// borderRadius: BorderRadius.all(Radius.circular(4)),
|
|
|
|
// ),
|
|
|
|
// padding: EdgeInsets.all(6),
|
|
|
|
// child: Row(
|
|
|
|
// children: <Widget>[
|
|
|
|
// Icon(iconData, color: Colors.white, size: 15),
|
|
|
|
// Text(text,
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: Colors.white,
|
|
|
|
// fontWeight: FontWeight.w600,
|
|
|
|
// )),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
return Text('test');
|
2019-01-27 17:37:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2019-01-28 14:32:01 +01:00
|
|
|
return IssuePullRequestScreen(
|
|
|
|
id: id,
|
|
|
|
owner: owner,
|
|
|
|
name: name,
|
|
|
|
init: () => queryPullRequest(id, owner, name),
|
|
|
|
extra: Row(
|
|
|
|
children: <Widget>[_buildBadge()],
|
2019-01-27 17:37:44 +01:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|