1
0
mirror of https://github.com/git-touch/git-touch synced 2025-01-18 10:24:13 +01:00

feat: issues screen style

This commit is contained in:
Rongjian Zhang 2019-09-14 15:58:53 +08:00
parent eb9de95efc
commit 2c6a3d097c
2 changed files with 47 additions and 44 deletions

View File

@ -88,17 +88,13 @@ class IssuesScreen extends StatelessWidget {
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Avatar( Icon(_buildIconData(), color: Palette.green, size: 16),
login: payload['author']['login'], SizedBox(width: 6),
url: payload['author']['avatarUrl'],
size: 12,
),
SizedBox(width: 10),
Expanded( Expanded(
child: Container( child: Container(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: join(SizedBox(height: 6), [ children: join(SizedBox(height: 8), [
// Text( // Text(
// owner + // owner +
// '/' + // '/' +
@ -109,17 +105,19 @@ class IssuesScreen extends StatelessWidget {
// ), // ),
// Padding(padding: EdgeInsets.only(top: 4)), // Padding(padding: EdgeInsets.only(top: 4)),
Text( Text(
payload['title'], payload['title'] + ' (#${payload['number']})',
style: TextStyle( style: TextStyle(
fontSize: 16, color: PrimerColors.gray900), fontSize: 16,
maxLines: 3, color: PrimerColors.gray900,
overflow: TextOverflow.ellipsis, fontWeight: FontWeight.w600,
), ),
),
if ((payload['labels']['nodes'] as List).isNotEmpty)
Wrap( Wrap(
spacing: 2, spacing: 2,
runSpacing: 2, runSpacing: 2,
children: children: (payload['labels']['nodes'] as List)
(payload['labels']['nodes'] as List).map((label) { .map((label) {
final color = convertColor(label['color']); final color = convertColor(label['color']);
return Container( return Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
@ -146,10 +144,18 @@ class IssuesScreen extends StatelessWidget {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Icon(_buildIconData(), Avatar(
color: Palette.green, size: 13), login: payload['author']['login'],
url: payload['author']['avatarUrl'],
size: 8,
),
SizedBox(width: 4), SizedBox(width: 4),
Text(timeago.format( Text(
payload['author']['login'],
style: TextStyle(fontWeight: FontWeight.w500),
),
Text(' opened ' +
timeago.format(
DateTime.parse(payload['updatedAt']))), DateTime.parse(payload['updatedAt']))),
if (payload['comments']['totalCount'] > 0) ...[ if (payload['comments']['totalCount'] > 0) ...[
Expanded(child: SizedBox()), Expanded(child: SizedBox()),
@ -183,7 +189,8 @@ class IssuesScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListScaffold( return ListScaffold(
title: AppBarTitle('Issues of $owner/$name'), title: AppBarTitle(
(isPullRequest ? 'Pull requests' : 'Issues') + ' of $owner/$name'),
onRefresh: () => _query(context), onRefresh: () => _query(context),
onLoadMore: (cursor) => _query(cursor), onLoadMore: (cursor) => _query(cursor),
itemBuilder: _buildItem, itemBuilder: _buildItem,

View File

@ -130,10 +130,6 @@ List<T> joinAll<T>(T seperator, List<List<T>> xss) {
return result; return result;
} }
K ifNotNull<T, K>(T value, K Function(T v) builder) {
return value == null ? null : builder(value);
}
final numberFormat = NumberFormat(); final numberFormat = NumberFormat();
class BorderView extends StatelessWidget { class BorderView extends StatelessWidget {