diff --git a/lib/screens/gh_repo.dart b/lib/screens/gh_repo.dart index 4078c55..c0fcebb 100644 --- a/lib/screens/gh_repo.dart +++ b/lib/screens/gh_repo.dart @@ -227,7 +227,7 @@ class GhRepoScreen extends StatelessWidget { ), ], ), - if (repo.languages!.edges!.isNotEmpty) ...[ + if (repo.languages?.edges != null) ...[ CommonStyle.border, LanguageBar([ for (var edge in repo.languages!.edges!) @@ -244,13 +244,18 @@ class GhRepoScreen extends StatelessWidget { AntListItem( prefix: const Icon(Octicons.code), 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: () { context.push('/github/$owner/$name/blob/${ref.name}'); }, - child: Text(repo.primaryLanguage?.name ?? 'Code'), + child: const Text('Code'), ), if (repo.hasIssuesEnabled) AntListItem( diff --git a/lib/screens/gh_user.dart b/lib/screens/gh_user.dart index 020ba43..2356dd4 100644 --- a/lib/screens/gh_user.dart +++ b/lib/screens/gh_user.dart @@ -149,8 +149,7 @@ class _User extends StatelessWidget { child: TextWithAt( text: p.company!, linkFactory: (text) => '/github/${text.substring(1)}', - style: TextStyle( - fontSize: 17, color: AntTheme.of(context).colorText), + style: TextStyle(color: AntTheme.of(context).colorText), oneLine: true, ), ), diff --git a/lib/widgets/repo_header.dart b/lib/widgets/repo_header.dart index 250c813..f189fda 100644 --- a/lib/widgets/repo_header.dart +++ b/lib/widgets/repo_header.dart @@ -26,50 +26,41 @@ class RepoHeader extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = AntTheme.of(context); + return Container( padding: CommonStyle.padding, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - crossAxisAlignment: CrossAxisAlignment.start, children: [ Avatar( url: avatarUrl, size: AvatarSize.small, linkUrl: avatarLink, ), - const SizedBox(width: 8), Expanded( child: Text( '$owner / $name', - style: TextStyle( - fontSize: 20, - color: AntTheme.of(context).colorPrimary, - ), + style: TextStyle(fontSize: 20, color: theme.colorPrimary), overflow: TextOverflow.visible, ), ), - ], + ].withSeparator(const SizedBox(width: 8)), ), if (actions != null) ...actions!, if (description != null && description!.isNotEmpty) Text( description!, - style: TextStyle( - color: AntTheme.of(context).colorTextSecondary, - fontSize: 17, - ), + style: TextStyle(color: theme.colorTextSecondary, fontSize: 16), ), if (homepageUrl != null && homepageUrl!.isNotEmpty) LinkWidget( url: homepageUrl, child: Text( homepageUrl!, - style: TextStyle( - color: AntTheme.of(context).colorPrimary, - fontSize: 17, - ), + style: TextStyle(color: theme.colorPrimary, fontSize: 16), ), ), if (trailings != null) ...trailings! diff --git a/lib/widgets/repo_item.dart b/lib/widgets/repo_item.dart index f867759..96ce7f2 100644 --- a/lib/widgets/repo_item.dart +++ b/lib/widgets/repo_item.dart @@ -140,116 +140,114 @@ class RepoItem extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = AntTheme.of(context); + return AntListItem( arrow: null, onClick: () { context.pushUrl(url); }, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Avatar( - 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( + child: DefaultTextStyle( + style: const TextStyle(height: null), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( children: [ - if (primaryLanguageName != null) ...[ - Container( - width: 12, - height: 12, - decoration: BoxDecoration( - color: fromCssColor(primaryLanguageColor ?? - github.languageColors[primaryLanguageName!]!), - shape: BoxShape.circle, - ), - ), - const SizedBox(width: 4), - Text( - primaryLanguageName!, + Avatar( + url: avatarUrl, + size: AvatarSize.small, + linkUrl: avatarLink, + ), + Expanded( + child: Text.rich( + TextSpan(children: [ + TextSpan( + text: '$owner / ', + style: TextStyle( + height: 1, fontSize: 18, color: theme.colorPrimary), + ), + TextSpan( + text: name, + style: TextStyle( + height: 1, + fontSize: 18, + color: theme.colorPrimary, + fontWeight: FontWeight.w600, + // overflow: TextOverflow.ellipsis, + ), + ), + ]), overflow: TextOverflow.ellipsis, ), - const SizedBox(width: 24), - ], - if (starCount! > 0) ...[ - Icon(Octicons.star, - size: 16, color: AntTheme.of(context).colorText), - const SizedBox(width: 2), - Text(numberFormat.format(starCount)), - const SizedBox(width: 24), - ], - if (forkCount! > 0) ...[ - Icon(Octicons.repo_forked, - size: 16, color: AntTheme.of(context).colorText), - const SizedBox(width: 2), - Text(numberFormat.format(forkCount)), - ], - ], + ), + if (iconData != null) + DefaultTextStyle( + style: TextStyle(color: theme.colorTextSecondary), + child: Icon(iconData, + size: 18, color: theme.colorTextSecondary), + ), + ].withSeparator(const SizedBox(width: 8)), ), - ), - ], + 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: [ + 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)), + ), ), ); }