mirror of
https://github.com/git-touch/git-touch
synced 2024-12-16 18:28:51 +01:00
feat: add commit build status
This commit is contained in:
parent
b2b6ef4795
commit
a48a35ec4f
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:git_touch/utils/utils.dart';
|
||||||
import 'package:git_touch/widgets/link.dart';
|
import 'package:git_touch/widgets/link.dart';
|
||||||
import 'package:timeago/timeago.dart' as timeago;
|
import 'package:timeago/timeago.dart' as timeago;
|
||||||
import 'package:git_touch/providers/settings.dart';
|
import 'package:git_touch/providers/settings.dart';
|
||||||
@ -30,6 +31,7 @@ class CommitsScreen extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
nodes {
|
nodes {
|
||||||
oid
|
oid
|
||||||
|
url
|
||||||
messageHeadline
|
messageHeadline
|
||||||
committedDate
|
committedDate
|
||||||
author {
|
author {
|
||||||
@ -40,6 +42,9 @@ class CommitsScreen extends StatelessWidget {
|
|||||||
login
|
login
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
status {
|
||||||
|
state
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -58,6 +63,18 @@ class CommitsScreen extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildStatus(String state) {
|
||||||
|
var size = 18.0;
|
||||||
|
switch (state) {
|
||||||
|
case 'SUCCESS':
|
||||||
|
return Icon(Octicons.check, color: PrimerColors.green500, size: size);
|
||||||
|
case 'FAILURE':
|
||||||
|
return Icon(Octicons.x, color: PrimerColors.red600, size: size);
|
||||||
|
default:
|
||||||
|
return Container();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ListScaffold(
|
return ListScaffold(
|
||||||
@ -66,12 +83,13 @@ class CommitsScreen extends StatelessWidget {
|
|||||||
onLoadMore: (cursor) => _query(context, cursor),
|
onLoadMore: (cursor) => _query(context, cursor),
|
||||||
itemBuilder: (payload) {
|
itemBuilder: (payload) {
|
||||||
return Link(
|
return Link(
|
||||||
url: 'https://github.com/$owner/$name/commit/' + payload['oid'],
|
url: payload['url'],
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.all(12),
|
padding: EdgeInsets.all(12),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Avatar(url: payload['author']['avatarUrl']),
|
Avatar(url: payload['author']['avatarUrl'], size: 16),
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -81,7 +99,7 @@ class CommitsScreen extends StatelessWidget {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w500, fontSize: 14)),
|
fontWeight: FontWeight.w500, fontSize: 14)),
|
||||||
SizedBox(height: 4),
|
SizedBox(height: 4),
|
||||||
Row(
|
Wrap(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
payload['author']['user'] == null
|
payload['author']['user'] == null
|
||||||
@ -95,6 +113,12 @@ class CommitsScreen extends StatelessWidget {
|
|||||||
DateTime.parse(payload['committedDate'])),
|
DateTime.parse(payload['committedDate'])),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: PrimerColors.gray600, fontSize: 14)),
|
color: PrimerColors.gray600, fontSize: 14)),
|
||||||
|
...(payload['status'] == null
|
||||||
|
? []
|
||||||
|
: [
|
||||||
|
SizedBox(width: 4),
|
||||||
|
_buildStatus(payload['status']['state'])
|
||||||
|
])
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user