chore: style tweaks

This commit is contained in:
Rongjian Zhang 2022-10-09 02:52:20 +08:00
parent e2de7feec2
commit 06a96a14be
3 changed files with 114 additions and 138 deletions

View File

@ -141,14 +141,13 @@ class RepoItem extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = AntTheme.of(context); final theme = AntTheme.of(context);
const bottomGap = SizedBox(width: 4);
return AntListItem( return AntListItem(
arrow: null, arrow: null,
onClick: () { onClick: () {
context.pushUrl(url); context.pushUrl(url);
}, },
child: DefaultTextStyle(
style: const TextStyle(height: null),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
@ -184,28 +183,26 @@ class RepoItem extends StatelessWidget {
if (iconData != null) if (iconData != null)
DefaultTextStyle( DefaultTextStyle(
style: TextStyle(color: theme.colorTextSecondary), style: TextStyle(color: theme.colorTextSecondary),
child: Icon(iconData, child:
size: 18, color: theme.colorTextSecondary), Icon(iconData, size: 18, color: theme.colorTextSecondary),
), ),
].withSeparator(const SizedBox(width: 8)), ].withSeparator(const SizedBox(width: 8)),
), ),
if (description != null && description!.isNotEmpty) if (description != null && description!.isNotEmpty)
Text( Text(
description!, description!,
style: TextStyle( style: TextStyle(color: theme.colorTextSecondary, fontSize: 16),
color: theme.colorTextSecondary,
fontSize: 16,
leadingDistribution: TextLeadingDistribution.even,
),
), ),
if (note != null) if (note != null)
Text(note!, Text(note!, style: TextStyle(fontSize: 14, color: theme.colorWeak)),
style: TextStyle(fontSize: 14, color: theme.colorWeak)), Builder(builder: (context) {
DefaultTextStyle( return DefaultTextStyle(
style: TextStyle(color: theme.colorText, fontSize: 14), style: DefaultTextStyle.of(context).style.copyWith(fontSize: 14),
child: IconTheme(
data: IconThemeData(size: 14, color: theme.colorText),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
if (primaryLanguageName != null) ...[ if (primaryLanguageName != null)
Row( Row(
children: [ children: [
Container( Container(
@ -217,37 +214,32 @@ class RepoItem extends StatelessWidget {
shape: BoxShape.circle, shape: BoxShape.circle,
), ),
), ),
const SizedBox(width: 4), bottomGap,
Text( Text(primaryLanguageName!),
primaryLanguageName!,
overflow: TextOverflow.ellipsis,
),
], ],
), ),
],
if (starCount! > 0) if (starCount! > 0)
Row( Row(
children: [ children: [
Icon(Octicons.star, size: 14, color: theme.colorText), const Icon(Octicons.star),
const SizedBox(width: 2), bottomGap,
Text(numberFormat.format(starCount)), Text(numberFormat.format(starCount)),
], ],
), ),
if (forkCount! > 0) ...[ if (forkCount! > 0)
Row( Row(
children: [ children: [
Icon(Octicons.repo_forked, const Icon(Octicons.repo_forked),
size: 14, color: theme.colorText), bottomGap,
const SizedBox(width: 2),
Text(numberFormat.format(forkCount)), Text(numberFormat.format(forkCount)),
], ],
), ),
],
].withSeparator(const SizedBox(width: 24)), ].withSeparator(const SizedBox(width: 24)),
), ),
), ),
].withSeparator(const SizedBox(height: 10)), );
), }),
].withSeparator(const SizedBox(height: 8)),
), ),
); );
} }

View File

@ -51,8 +51,7 @@ class UserHeader extends StatelessWidget {
] ]
], ],
), ),
const SizedBox(height: 8), if (name != null && name!.isNotEmpty)
if (name != null && name!.isNotEmpty) ...[
Text( Text(
name!, name!,
style: TextStyle( style: TextStyle(
@ -61,16 +60,11 @@ class UserHeader extends StatelessWidget {
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
const SizedBox(height: 4),
],
Text( Text(
login!, login!,
style: TextStyle( style: TextStyle(
color: AntTheme.of(context).colorPrimary, color: AntTheme.of(context).colorPrimary, fontSize: 18),
fontSize: 18,
), ),
),
const SizedBox(height: 8),
if (createdAt != null) if (createdAt != null)
Row( Row(
children: <Widget>[ children: <Widget>[
@ -83,14 +77,11 @@ class UserHeader extends StatelessWidget {
Text( Text(
'Joined on ${dateFormat.format(createdAt!)}', 'Joined on ${dateFormat.format(createdAt!)}',
style: TextStyle( style: TextStyle(
color: AntTheme.of(context).colorWeak, color: AntTheme.of(context).colorWeak, fontSize: 16),
fontSize: 16,
),
), ),
], ],
), ),
if (bio != null && bio!.isNotEmpty) ...[ if (bio != null && bio!.isNotEmpty)
const SizedBox(height: 10),
Text( Text(
bio!, bio!,
style: TextStyle( style: TextStyle(
@ -98,8 +89,7 @@ class UserHeader extends StatelessWidget {
fontSize: 17, fontSize: 17,
), ),
) )
] ].withSeparator(const SizedBox(height: 8)),
],
), ),
); );
} }

View File

@ -19,13 +19,15 @@ class GhBioWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = AntTheme.of(context);
if (location != null) { if (location != null) {
return Row( return Row(
children: <Widget>[ children: <Widget>[
Icon( Icon(
Octicons.location, Octicons.location,
size: 15, size: 15,
color: AntTheme.of(context).colorTextSecondary, color: theme.colorTextSecondary,
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
Expanded(child: Text(location!, overflow: TextOverflow.ellipsis)), Expanded(child: Text(location!, overflow: TextOverflow.ellipsis)),
@ -37,7 +39,7 @@ class GhBioWidget extends StatelessWidget {
Icon( Icon(
Octicons.clock, Octicons.clock,
size: 15, size: 15,
color: AntTheme.of(context).colorTextSecondary, color: theme.colorTextSecondary,
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
Expanded( Expanded(
@ -121,6 +123,8 @@ class UserItem extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = AntTheme.of(context);
return AntListItem( return AntListItem(
onClick: () { onClick: () {
context.pushUrl(url); context.pushUrl(url);
@ -128,48 +132,38 @@ class UserItem extends StatelessWidget {
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Avatar(url: avatarUrl, size: AvatarSize.large), Avatar(url: avatarUrl, size: AvatarSize.large),
const SizedBox(width: 10), const SizedBox(width: 12),
Expanded( Expanded(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Row( Row(
textBaseline: TextBaseline.alphabetic, children: [
crossAxisAlignment: CrossAxisAlignment.baseline, if (name != null)
children: <Widget>[
if (name != null && name!.isNotEmpty) ...[
Text( Text(
name!, name!,
style: TextStyle( style: const TextStyle(
color: AntTheme.of(context).colorText, fontSize: 18, fontWeight: FontWeight.w500),
fontSize: 18,
fontWeight: FontWeight.w500,
), ),
),
const SizedBox(width: 8),
],
Expanded( Expanded(
child: Text( child: Text(
login!, login!,
style: TextStyle( style:
color: AntTheme.of(context).colorText, TextStyle(fontSize: 16, color: theme.colorPrimary),
fontSize: 16,
),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
), ),
], ].withSeparator(const SizedBox(width: 8)),
), ),
const SizedBox(height: 6),
if (bio != null) if (bio != null)
DefaultTextStyle( Builder(builder: (context) {
style: TextStyle( return DefaultTextStyle(
color: AntTheme.of(context).colorTextSecondary, style: DefaultTextStyle.of(context).style.copyWith(
fontSize: 16, color: theme.colorTextSecondary, fontSize: 16),
),
child: bio!, child: bio!,
), );
}),
], ],
), ),
) )