1
0
mirror of https://github.com/git-touch/git-touch synced 2025-01-31 08:04:51 +01:00

improvement: style tweaks

This commit is contained in:
Rongjian Zhang 2020-01-11 17:57:22 +08:00
parent 61a5b3f786
commit c6822c4830
3 changed files with 46 additions and 50 deletions

View File

@ -23,7 +23,7 @@ class StorageKeys {
} }
class CommonStyle { class CommonStyle {
static const padding = EdgeInsets.all(12); static const padding = EdgeInsets.symmetric(horizontal: 16, vertical: 12);
static final border = BorderView(); static final border = BorderView();
static const verticalGap = SizedBox(height: 18); static const verticalGap = SizedBox(height: 18);
static final monospace = Platform.isIOS ? 'Menlo' : 'monospace'; // FIXME: static final monospace = Platform.isIOS ? 'Menlo' : 'monospace'; // FIXME:

View File

@ -26,7 +26,7 @@ class Avatar extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(
child: ClipRRect( child: ClipRRect(
borderRadius: borderRadius ?? BorderRadius.circular(4), borderRadius: borderRadius ?? BorderRadius.circular(size / 2),
child: FadeInImage.assetNetwork( child: FadeInImage.assetNetwork(
placeholder: 'images/avatar.png', placeholder: 'images/avatar.png',
image: url ?? 'images/avatar.png', image: url ?? 'images/avatar.png',

View File

@ -39,22 +39,26 @@ class RepositoryItem extends StatelessWidget {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Avatar(url: avatarUrl, size: AvatarSize.small, linkUrl: '/$owner'),
SizedBox(width: 8),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: join(SizedBox(height: 8), <Widget>[ children: <Widget>[
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Avatar(
url: avatarUrl,
size: AvatarSize.small,
linkUrl: '/$owner',
),
SizedBox(width: 8),
Expanded( Expanded(
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Text( Text(
owner + ' / ', owner + ' / ',
style: TextStyle( style: TextStyle(
fontSize: 17, fontSize: 18,
color: theme.palette.primary, color: theme.palette.primary,
), ),
), ),
@ -62,7 +66,7 @@ class RepositoryItem extends StatelessWidget {
child: Text( child: Text(
name, name,
style: TextStyle( style: TextStyle(
fontSize: 17, fontSize: 18,
color: theme.palette.primary, color: theme.palette.primary,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
@ -72,66 +76,58 @@ class RepositoryItem extends StatelessWidget {
], ],
), ),
), ),
Icon(iconData, // Icon(iconData,
size: 17, color: theme.palette.tertiaryText), // size: 17, color: theme.palette.tertiaryText),
], ],
), ),
if (description != null && description.isNotEmpty) SizedBox(height: 6),
if (description != null && description.isNotEmpty) ...[
Text( Text(
description, description,
overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: theme.palette.secondaryText, color: theme.palette.secondaryText,
fontSize: 15, fontSize: 16,
), ),
), ),
SizedBox(height: 10),
],
DefaultTextStyle( DefaultTextStyle(
style: TextStyle(color: theme.palette.text, fontSize: 13), style: TextStyle(color: theme.palette.text, fontSize: 14),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded( if (primaryLanguageName != null) ...[
child: Row(children: <Widget>[ Container(
Container( width: 12,
width: 10, height: 12,
height: 10, decoration: BoxDecoration(
decoration: BoxDecoration( color: convertColor(primaryLanguageColor),
color: convertColor(primaryLanguageColor), shape: BoxShape.circle,
shape: BoxShape.circle,
),
), ),
SizedBox(width: 4),
Expanded(
child: Text(
primaryLanguageName ?? 'Unknown',
overflow: TextOverflow.ellipsis,
),
),
]),
),
Expanded(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Icon(Octicons.star,
size: 14, color: theme.palette.text),
Text(numberFormat.format(starCount)),
],
), ),
), SizedBox(width: 4),
Expanded( Text(
child: Row( primaryLanguageName,
crossAxisAlignment: CrossAxisAlignment.start, overflow: TextOverflow.ellipsis,
children: <Widget>[
Icon(Octicons.repo_forked,
size: 14, color: theme.palette.text),
Text(numberFormat.format(forkCount)),
],
), ),
), SizedBox(width: 24),
],
if (starCount > 0) ...[
Icon(Octicons.star,
size: 16, color: theme.palette.text),
SizedBox(width: 2),
Text(numberFormat.format(starCount)),
SizedBox(width: 24),
],
if (forkCount > 0) ...[
Icon(Octicons.repo_forked,
size: 16, color: theme.palette.text),
SizedBox(width: 2),
Text(numberFormat.format(forkCount)),
],
], ],
), ),
), ),
]), ],
), ),
), ),
], ],