diff --git a/lib/widgets/repo_item.dart b/lib/widgets/repo_item.dart index 96ce7f2..f1962e5 100644 --- a/lib/widgets/repo_item.dart +++ b/lib/widgets/repo_item.dart @@ -141,113 +141,105 @@ class RepoItem extends StatelessWidget { @override Widget build(BuildContext context) { final theme = AntTheme.of(context); + const bottomGap = SizedBox(width: 4); return AntListItem( arrow: null, onClick: () { context.pushUrl(url); }, - child: DefaultTextStyle( - style: const TextStyle(height: null), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - 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), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + 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, ), - TextSpan( - text: name, - style: TextStyle( - height: 1, - fontSize: 18, - color: theme.colorPrimary, - fontWeight: FontWeight.w600, - // overflow: TextOverflow.ellipsis, - ), - ), - ]), - overflow: TextOverflow.ellipsis, - ), - ), - 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, + ), + ]), + overflow: TextOverflow.ellipsis, ), ), - 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, + 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), + ), + if (note != null) + Text(note!, style: TextStyle(fontSize: 14, color: theme.colorWeak)), + Builder(builder: (context) { + return DefaultTextStyle( + style: DefaultTextStyle.of(context).style.copyWith(fontSize: 14), + child: IconTheme( + data: IconThemeData(size: 14, color: theme.colorText), + 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)), + bottomGap, + Text(primaryLanguageName!), + ], + ), + if (starCount! > 0) + Row( + children: [ + const Icon(Octicons.star), + bottomGap, + Text(numberFormat.format(starCount)), + ], + ), + if (forkCount! > 0) + Row( + children: [ + const Icon(Octicons.repo_forked), + bottomGap, + Text(numberFormat.format(forkCount)), + ], + ), + ].withSeparator(const SizedBox(width: 24)), + ), ), - ), - ].withSeparator(const SizedBox(height: 10)), - ), + ); + }), + ].withSeparator(const SizedBox(height: 8)), ), ); } diff --git a/lib/widgets/user_header.dart b/lib/widgets/user_header.dart index d2a9a7b..f3b7dd6 100644 --- a/lib/widgets/user_header.dart +++ b/lib/widgets/user_header.dart @@ -51,8 +51,7 @@ class UserHeader extends StatelessWidget { ] ], ), - const SizedBox(height: 8), - if (name != null && name!.isNotEmpty) ...[ + if (name != null && name!.isNotEmpty) Text( name!, style: TextStyle( @@ -61,16 +60,11 @@ class UserHeader extends StatelessWidget { fontWeight: FontWeight.w600, ), ), - const SizedBox(height: 4), - ], Text( login!, style: TextStyle( - color: AntTheme.of(context).colorPrimary, - fontSize: 18, - ), + color: AntTheme.of(context).colorPrimary, fontSize: 18), ), - const SizedBox(height: 8), if (createdAt != null) Row( children: [ @@ -83,14 +77,11 @@ class UserHeader extends StatelessWidget { Text( 'Joined on ${dateFormat.format(createdAt!)}', style: TextStyle( - color: AntTheme.of(context).colorWeak, - fontSize: 16, - ), + color: AntTheme.of(context).colorWeak, fontSize: 16), ), ], ), - if (bio != null && bio!.isNotEmpty) ...[ - const SizedBox(height: 10), + if (bio != null && bio!.isNotEmpty) Text( bio!, style: TextStyle( @@ -98,8 +89,7 @@ class UserHeader extends StatelessWidget { fontSize: 17, ), ) - ] - ], + ].withSeparator(const SizedBox(height: 8)), ), ); } diff --git a/lib/widgets/user_item.dart b/lib/widgets/user_item.dart index 82dec5b..fc2095b 100644 --- a/lib/widgets/user_item.dart +++ b/lib/widgets/user_item.dart @@ -19,13 +19,15 @@ class GhBioWidget extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = AntTheme.of(context); + if (location != null) { return Row( children: [ Icon( Octicons.location, size: 15, - color: AntTheme.of(context).colorTextSecondary, + color: theme.colorTextSecondary, ), const SizedBox(width: 4), Expanded(child: Text(location!, overflow: TextOverflow.ellipsis)), @@ -37,7 +39,7 @@ class GhBioWidget extends StatelessWidget { Icon( Octicons.clock, size: 15, - color: AntTheme.of(context).colorTextSecondary, + color: theme.colorTextSecondary, ), const SizedBox(width: 4), Expanded( @@ -121,6 +123,8 @@ class UserItem extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = AntTheme.of(context); + return AntListItem( onClick: () { context.pushUrl(url); @@ -128,48 +132,38 @@ class UserItem extends StatelessWidget { child: Row( children: [ Avatar(url: avatarUrl, size: AvatarSize.large), - const SizedBox(width: 10), + const SizedBox(width: 12), Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - textBaseline: TextBaseline.alphabetic, - crossAxisAlignment: CrossAxisAlignment.baseline, - children: [ - if (name != null && name!.isNotEmpty) ...[ + children: [ + if (name != null) Text( name!, - style: TextStyle( - color: AntTheme.of(context).colorText, - fontSize: 18, - fontWeight: FontWeight.w500, - ), + style: const TextStyle( + fontSize: 18, fontWeight: FontWeight.w500), ), - const SizedBox(width: 8), - ], Expanded( child: Text( login!, - style: TextStyle( - color: AntTheme.of(context).colorText, - fontSize: 16, - ), + style: + TextStyle(fontSize: 16, color: theme.colorPrimary), overflow: TextOverflow.ellipsis, ), ), - ], + ].withSeparator(const SizedBox(width: 8)), ), - const SizedBox(height: 6), if (bio != null) - DefaultTextStyle( - style: TextStyle( - color: AntTheme.of(context).colorTextSecondary, - fontSize: 16, - ), - child: bio!, - ), + Builder(builder: (context) { + return DefaultTextStyle( + style: DefaultTextStyle.of(context).style.copyWith( + color: theme.colorTextSecondary, fontSize: 16), + child: bio!, + ); + }), ], ), )