From 6312da876a44b93afa037091c8ed366d5759dac7 Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Fri, 13 Sep 2019 15:55:58 +0800 Subject: [PATCH] feat: style tweaks --- lib/screens/user.dart | 39 ++++++++++++++---------- lib/screens/users.dart | 35 +++++++++++----------- lib/utils/utils.dart | 2 +- lib/widgets/entry_item.dart | 18 +++++++---- lib/widgets/event_item.dart | 59 +++++++++++++++++++++---------------- lib/widgets/repo_item.dart | 4 +-- 6 files changed, 90 insertions(+), 67 deletions(-) diff --git a/lib/screens/user.dart b/lib/screens/user.dart index 19a824d..506629b 100644 --- a/lib/screens/user.dart +++ b/lib/screens/user.dart @@ -164,7 +164,7 @@ class _UserScreenState extends State { [query(), getContributions(widget.login)], ); }, - title: AppBarTitle(widget.login), + title: AppBarTitle('User'), trailingBuilder: (data) { var payload = data[0]; if (widget.showSettings) { @@ -230,26 +230,35 @@ class _UserScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row(children: [ - Text( - payload['name'] ?? widget.login, - style: TextStyle( - color: PrimerColors.blue500, fontSize: 16), - ), - Text( - '(${widget.login})', - style: TextStyle( - color: PrimerColors.gray500, fontSize: 16), - ), - ]), - SizedBox(height: 4), + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + payload['name'] ?? widget.login, + style: TextStyle( + color: PrimerColors.blue500, + fontSize: 18, + fontWeight: FontWeight.w600, + ), + ), + SizedBox(width: 8), + Text( + widget.login, + style: TextStyle( + color: PrimerColors.gray700, fontSize: 16), + ), + ], + ), + SizedBox(height: 6), Text( payload['bio'] == null || (payload['bio'] as String).isEmpty ? 'No bio' : payload['bio'], style: TextStyle( - color: PrimerColors.gray500, fontSize: 15), + color: PrimerColors.gray700, + fontSize: 14, + ), ), ], ), diff --git a/lib/screens/users.dart b/lib/screens/users.dart index 4dbc604..f014672 100644 --- a/lib/screens/users.dart +++ b/lib/screens/users.dart @@ -73,27 +73,26 @@ class _UsersScreenState extends State { child: Container( padding: EdgeInsets.all(10), child: Row( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - Avatar(url: payload['avatarUrl'], size: 20), + Avatar(url: payload['avatarUrl'], size: 24), SizedBox(width: 10), - DefaultTextStyle( - style: TextStyle(color: PrimerColors.gray900, fontSize: 13), - child: Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: join(SizedBox(height: 6), [ - Text( - payload['name'] ?? payload['login'], - style: TextStyle( - fontSize: 16, - color: PrimerColors.blue500, - fontWeight: FontWeight.w500, - ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: join(SizedBox(height: 6), [ + Text( + payload['name'] ?? payload['login'], + style: TextStyle( + fontSize: 16, + color: PrimerColors.blue500, + fontWeight: FontWeight.w500, ), - Text(payload['url'], style: TextStyle(fontSize: 14)) - ]), - ), + ), + Text( + payload['login'], + style: TextStyle(fontSize: 14, color: PrimerColors.gray700), + ) + ]), ), ) ], diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index bdec2e1..6d99760 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -37,7 +37,7 @@ void nextTick(Function callback, [int milliseconds = 0]) { TextSpan createLinkSpan(BuildContext context, String text, Function handle) { return TextSpan( text: text, - style: TextStyle(color: PrimerColors.blue500, fontWeight: FontWeight.w500), + style: TextStyle(color: PrimerColors.blue500, fontWeight: FontWeight.w600), recognizer: TapGestureRecognizer() ..onTap = () { Navigator.of(context).push( diff --git a/lib/widgets/entry_item.dart b/lib/widgets/entry_item.dart index 84dbd29..13b6475 100644 --- a/lib/widgets/entry_item.dart +++ b/lib/widgets/entry_item.dart @@ -15,13 +15,21 @@ class EntryItem extends StatelessWidget { return Expanded( child: Link( child: Container( - padding: EdgeInsets.symmetric(vertical: 12), + padding: EdgeInsets.symmetric(vertical: 14), child: Column( children: [ - Text(count.toString(), - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500)), - Text(text, - style: TextStyle(fontSize: 12, color: PrimerColors.gray600)) + Text( + count.toString(), + style: TextStyle(fontSize: 17, fontWeight: FontWeight.w600), + ), + Text( + text, + style: TextStyle( + fontSize: 12, + color: PrimerColors.gray700, + fontWeight: FontWeight.w500, + ), + ) ], ), ), diff --git a/lib/widgets/event_item.dart b/lib/widgets/event_item.dart index 9bae941..8ea60d5 100644 --- a/lib/widgets/event_item.dart +++ b/lib/widgets/event_item.dart @@ -70,7 +70,7 @@ class EventItem extends StatelessWidget { screenBuilder: screenBuilder, url: url, child: Container( - padding: EdgeInsets.all(10), + padding: EdgeInsets.all(12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -80,7 +80,7 @@ class EventItem extends StatelessWidget { Avatar( url: event.actorAvatarUrl, login: event.actorLogin, - size: 18, + size: 20, ), SizedBox(width: 10), Expanded( @@ -90,7 +90,10 @@ class EventItem extends StatelessWidget { RichText( text: TextSpan( style: TextStyle( - fontSize: 15, color: PrimerColors.gray900), + fontSize: 16, + color: PrimerColors.gray900, + fontWeight: FontWeight.w500, + ), children: [ createLinkSpan( context, @@ -104,16 +107,19 @@ class EventItem extends StatelessWidget { if (detailWidget != null) DefaultTextStyle( style: TextStyle( - color: PrimerColors.gray500, fontSize: 14), + color: PrimerColors.gray900, fontSize: 14), child: detailWidget, ), Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Icon(iconData, color: PrimerColors.gray700, size: 13), + Icon(iconData, color: PrimerColors.gray500, size: 14), SizedBox(width: 4), Text(timeago.format(event.createdAt), style: TextStyle( - fontSize: 13, color: PrimerColors.gray700)) + fontSize: 13, + color: PrimerColors.gray500, + )) ], ), ]), @@ -134,7 +140,7 @@ class EventItem extends StatelessWidget { spans: [ TextSpan( text: ' ' + event.type, - style: TextStyle(color: Colors.blueAccent), + style: TextStyle(color: PrimerColors.blue500), ) ], iconData: Octicons.octoface, @@ -302,26 +308,27 @@ class EventItem extends StatelessWidget { iconData: Octicons.repo_push, detailWidget: Column( children: commits.map((commit) { - return Row(children: [ - Text( - (commit['sha'] as String).substring(0, 7), - style: TextStyle( - color: PrimerColors.blue500, - fontSize: 13, - fontFamily: 'Menlo', - fontFamilyFallback: ['Menlo', 'Roboto Mono'], + return Row( + children: [ + Text( + (commit['sha'] as String).substring(0, 7), + style: TextStyle( + color: PrimerColors.blue500, + fontSize: 13, + fontFamily: 'Menlo', + fontFamilyFallback: ['Menlo', 'Roboto Mono'], + ), ), - ), - SizedBox(width: 6), - Expanded( - child: Text( - commit['message'], - style: TextStyle(color: Colors.black54, fontSize: 14), - overflow: TextOverflow.ellipsis, - maxLines: 1, - ), - ) - ]); + SizedBox(width: 6), + Expanded( + child: Text( + commit['message'], + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ) + ], + ); }).toList(), ), url: 'https://github.com/' + diff --git a/lib/widgets/repo_item.dart b/lib/widgets/repo_item.dart index dcaf335..76b1164 100644 --- a/lib/widgets/repo_item.dart +++ b/lib/widgets/repo_item.dart @@ -91,7 +91,7 @@ class RepoItem extends StatelessWidget { Text( payload['owner']['login'] + ' / ', style: TextStyle( - fontSize: 16, + fontSize: inRepoScreen ? 18 : 16, color: PrimerColors.blue500, fontWeight: FontWeight.w500, ), @@ -99,7 +99,7 @@ class RepoItem extends StatelessWidget { Text( payload['name'], style: TextStyle( - fontSize: 16, + fontSize: inRepoScreen ? 18 : 16, color: PrimerColors.blue500, fontWeight: FontWeight.w600, ),