chore: style tweaks

This commit is contained in:
Rongjian Zhang 2022-10-08 02:19:07 +08:00
parent ad44495236
commit 29242aa45d
4 changed files with 115 additions and 122 deletions

View File

@ -227,7 +227,7 @@ class GhRepoScreen extends StatelessWidget {
), ),
], ],
), ),
if (repo.languages!.edges!.isNotEmpty) ...[ if (repo.languages?.edges != null) ...[
CommonStyle.border, CommonStyle.border,
LanguageBar([ LanguageBar([
for (var edge in repo.languages!.edges!) for (var edge in repo.languages!.edges!)
@ -244,13 +244,18 @@ class GhRepoScreen extends StatelessWidget {
AntListItem( AntListItem(
prefix: const Icon(Octicons.code), prefix: const Icon(Octicons.code),
extra: Text( extra: Text(
(license == null ? '' : '$license') + [
filesize(repo.diskUsage! * 1000), repo.primaryLanguage?.name,
license,
repo.diskUsage == null
? null
: filesize(repo.diskUsage! * 1000)
].where((e) => e != null).join(''),
), ),
onClick: () { onClick: () {
context.push('/github/$owner/$name/blob/${ref.name}'); context.push('/github/$owner/$name/blob/${ref.name}');
}, },
child: Text(repo.primaryLanguage?.name ?? 'Code'), child: const Text('Code'),
), ),
if (repo.hasIssuesEnabled) if (repo.hasIssuesEnabled)
AntListItem( AntListItem(

View File

@ -149,8 +149,7 @@ class _User extends StatelessWidget {
child: TextWithAt( child: TextWithAt(
text: p.company!, text: p.company!,
linkFactory: (text) => '/github/${text.substring(1)}', linkFactory: (text) => '/github/${text.substring(1)}',
style: TextStyle( style: TextStyle(color: AntTheme.of(context).colorText),
fontSize: 17, color: AntTheme.of(context).colorText),
oneLine: true, oneLine: true,
), ),
), ),

View File

@ -26,50 +26,41 @@ class RepoHeader extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = AntTheme.of(context);
return Container( return Container(
padding: CommonStyle.padding, padding: CommonStyle.padding,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Avatar( Avatar(
url: avatarUrl, url: avatarUrl,
size: AvatarSize.small, size: AvatarSize.small,
linkUrl: avatarLink, linkUrl: avatarLink,
), ),
const SizedBox(width: 8),
Expanded( Expanded(
child: Text( child: Text(
'$owner / $name', '$owner / $name',
style: TextStyle( style: TextStyle(fontSize: 20, color: theme.colorPrimary),
fontSize: 20,
color: AntTheme.of(context).colorPrimary,
),
overflow: TextOverflow.visible, overflow: TextOverflow.visible,
), ),
), ),
], ].withSeparator(const SizedBox(width: 8)),
), ),
if (actions != null) ...actions!, if (actions != null) ...actions!,
if (description != null && description!.isNotEmpty) if (description != null && description!.isNotEmpty)
Text( Text(
description!, description!,
style: TextStyle( style: TextStyle(color: theme.colorTextSecondary, fontSize: 16),
color: AntTheme.of(context).colorTextSecondary,
fontSize: 17,
),
), ),
if (homepageUrl != null && homepageUrl!.isNotEmpty) if (homepageUrl != null && homepageUrl!.isNotEmpty)
LinkWidget( LinkWidget(
url: homepageUrl, url: homepageUrl,
child: Text( child: Text(
homepageUrl!, homepageUrl!,
style: TextStyle( style: TextStyle(color: theme.colorPrimary, fontSize: 16),
color: AntTheme.of(context).colorPrimary,
fontSize: 17,
),
), ),
), ),
if (trailings != null) ...trailings! if (trailings != null) ...trailings!

View File

@ -140,116 +140,114 @@ class RepoItem extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = AntTheme.of(context);
return AntListItem( return AntListItem(
arrow: null, arrow: null,
onClick: () { onClick: () {
context.pushUrl(url); context.pushUrl(url);
}, },
child: Column( child: DefaultTextStyle(
crossAxisAlignment: CrossAxisAlignment.start, style: const TextStyle(height: null),
children: <Widget>[ child: Column(
Row( crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Avatar( Row(
url: avatarUrl,
size: AvatarSize.small,
linkUrl: avatarLink,
),
const SizedBox(width: 8),
Expanded(
child: Text.rich(
TextSpan(children: [
TextSpan(
text: '$owner / ',
style: TextStyle(
fontSize: 18,
color: AntTheme.of(context).colorPrimary,
),
),
TextSpan(
text: name,
style: TextStyle(
fontSize: 18,
color: AntTheme.of(context).colorPrimary,
fontWeight: FontWeight.w600,
),
// overflow: TextOverflow.ellipsis,
),
]),
overflow: TextOverflow.ellipsis,
),
),
if (iconData != null) ...[
const SizedBox(width: 6),
DefaultTextStyle(
style:
TextStyle(color: AntTheme.of(context).colorTextSecondary),
child: Icon(iconData,
size: 18, color: AntTheme.of(context).colorTextSecondary),
),
]
],
),
const SizedBox(height: 8),
if (description != null && description!.isNotEmpty) ...[
Text(
description!,
style: TextStyle(
color: AntTheme.of(context).colorTextSecondary,
fontSize: 16,
),
),
const SizedBox(height: 10),
],
if (note != null) ...[
Text(
note!,
style: TextStyle(
fontSize: 14,
color: AntTheme.of(context).colorWeak,
),
),
const SizedBox(height: 10),
],
DefaultTextStyle(
style:
TextStyle(color: AntTheme.of(context).colorText, fontSize: 14),
child: Row(
children: <Widget>[ children: <Widget>[
if (primaryLanguageName != null) ...[ Avatar(
Container( url: avatarUrl,
width: 12, size: AvatarSize.small,
height: 12, linkUrl: avatarLink,
decoration: BoxDecoration( ),
color: fromCssColor(primaryLanguageColor ?? Expanded(
github.languageColors[primaryLanguageName!]!), child: Text.rich(
shape: BoxShape.circle, TextSpan(children: [
), TextSpan(
), text: '$owner / ',
const SizedBox(width: 4), style: TextStyle(
Text( height: 1, fontSize: 18, color: theme.colorPrimary),
primaryLanguageName!, ),
TextSpan(
text: name,
style: TextStyle(
height: 1,
fontSize: 18,
color: theme.colorPrimary,
fontWeight: FontWeight.w600,
// overflow: TextOverflow.ellipsis,
),
),
]),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
const SizedBox(width: 24), ),
], if (iconData != null)
if (starCount! > 0) ...[ DefaultTextStyle(
Icon(Octicons.star, style: TextStyle(color: theme.colorTextSecondary),
size: 16, color: AntTheme.of(context).colorText), child: Icon(iconData,
const SizedBox(width: 2), size: 18, color: theme.colorTextSecondary),
Text(numberFormat.format(starCount)), ),
const SizedBox(width: 24), ].withSeparator(const SizedBox(width: 8)),
],
if (forkCount! > 0) ...[
Icon(Octicons.repo_forked,
size: 16, color: AntTheme.of(context).colorText),
const SizedBox(width: 2),
Text(numberFormat.format(forkCount)),
],
],
), ),
), if (description != null && description!.isNotEmpty)
], Text(
description!,
style: TextStyle(
color: theme.colorTextSecondary,
fontSize: 16,
leadingDistribution: TextLeadingDistribution.even,
),
),
if (note != null)
Text(note!,
style: TextStyle(fontSize: 14, color: theme.colorWeak)),
DefaultTextStyle(
style: TextStyle(color: theme.colorText, fontSize: 14),
child: Row(
children: <Widget>[
if (primaryLanguageName != null) ...[
Row(
children: [
Container(
width: 12,
height: 12,
decoration: BoxDecoration(
color: fromCssColor(primaryLanguageColor ??
github.languageColors[primaryLanguageName!]!),
shape: BoxShape.circle,
),
),
const SizedBox(width: 4),
Text(
primaryLanguageName!,
overflow: TextOverflow.ellipsis,
),
],
),
],
if (starCount! > 0)
Row(
children: [
Icon(Octicons.star, size: 14, color: theme.colorText),
const SizedBox(width: 2),
Text(numberFormat.format(starCount)),
],
),
if (forkCount! > 0) ...[
Row(
children: [
Icon(Octicons.repo_forked,
size: 14, color: theme.colorText),
const SizedBox(width: 2),
Text(numberFormat.format(forkCount)),
],
),
],
].withSeparator(const SizedBox(width: 24)),
),
),
].withSeparator(const SizedBox(height: 10)),
),
), ),
); );
} }