1
0
mirror of https://github.com/git-touch/git-touch synced 2024-12-17 02:38:39 +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,48 +105,58 @@ 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,
),
), ),
Wrap( if ((payload['labels']['nodes'] as List).isNotEmpty)
spacing: 2, Wrap(
runSpacing: 2, spacing: 2,
children: runSpacing: 2,
(payload['labels']['nodes'] as List).map((label) { children: (payload['labels']['nodes'] as List)
final color = convertColor(label['color']); .map((label) {
return Container( final color = convertColor(label['color']);
padding: EdgeInsets.symmetric( return Container(
vertical: 1, horizontal: 3), padding: EdgeInsets.symmetric(
decoration: BoxDecoration( vertical: 1, horizontal: 3),
color: color, decoration: BoxDecoration(
borderRadius: color: color,
BorderRadius.all(Radius.circular(2)), borderRadius:
), BorderRadius.all(Radius.circular(2)),
child: Text(
label['name'],
style: TextStyle(
fontSize: 12,
color: getFontColorByBrightness(color),
fontWeight: FontWeight.w600,
), ),
), child: Text(
); label['name'],
}).toList(), style: TextStyle(
), fontSize: 12,
color: getFontColorByBrightness(color),
fontWeight: FontWeight.w600,
),
),
);
}).toList(),
),
DefaultTextStyle( DefaultTextStyle(
style: TextStyle( style: TextStyle(
fontSize: 13, color: PrimerColors.gray700), fontSize: 13, color: PrimerColors.gray700),
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(
DateTime.parse(payload['updatedAt']))), payload['author']['login'],
style: TextStyle(fontWeight: FontWeight.w500),
),
Text(' opened ' +
timeago.format(
DateTime.parse(payload['updatedAt']))),
if (payload['comments']['totalCount'] > 0) ...[ if (payload['comments']['totalCount'] > 0) ...[
Expanded(child: SizedBox()), Expanded(child: SizedBox()),
Icon(Octicons.comment, Icon(Octicons.comment,
@ -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 {