From a1bf2555b73bf489302f2b2dc6c7eecdd2f5c1c2 Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Tue, 14 Jan 2020 13:33:02 +0800 Subject: [PATCH] improvement: style tweaks --- lib/models/theme.dart | 2 +- lib/screens/repository.dart | 8 +++++--- lib/screens/trending.dart | 4 ++-- lib/screens/user.dart | 4 ++-- lib/widgets/issue_item.dart | 14 ++++++-------- lib/widgets/label.dart | 15 ++++++++++----- lib/widgets/mutation_button.dart | 9 ++++++--- lib/widgets/user_item.dart | 24 +++++++++++------------- 8 files changed, 43 insertions(+), 37 deletions(-) diff --git a/lib/models/theme.dart b/lib/models/theme.dart index aab2fc7..4b4084f 100644 --- a/lib/models/theme.dart +++ b/lib/models/theme.dart @@ -141,7 +141,7 @@ class ThemeModel with ChangeNotifier { ); case Brightness.dark: return Palette( - primary: Colors.blueAccent.shade400, + primary: Colors.blueAccent.shade200, text: Colors.grey.shade300, secondaryText: Colors.grey.shade400, tertiaryText: Colors.grey.shade500, diff --git a/lib/screens/repository.dart b/lib/screens/repository.dart index 338e5bf..e3b5dfd 100644 --- a/lib/screens/repository.dart +++ b/lib/screens/repository.dart @@ -280,7 +280,7 @@ class RepositoryScreen extends StatelessWidget { // color: theme.palette.background, padding: CommonStyle.padding.copyWith(top: 8, bottom: 8), child: ClipRRect( - borderRadius: BorderRadius.circular(2), + borderRadius: BorderRadius.circular(5), child: SizedBox( height: 10, child: Row( @@ -307,8 +307,10 @@ class RepositoryScreen extends StatelessWidget { TableViewItem( leftIconData: Octicons.code, text: Text('Code'), - rightWidget: Text((license == null ? '' : license + ' / ') + - filesize(repo.diskUsage * 1000)), + rightWidget: Text( + (license == null ? '' : '$license • ') + + filesize(repo.diskUsage * 1000), + ), url: '/$owner/$name/blob/${ref.name}', ), if (repo.hasIssuesEnabled) diff --git a/lib/screens/trending.dart b/lib/screens/trending.dart index db284b1..dbb72cc 100644 --- a/lib/screens/trending.dart +++ b/lib/screens/trending.dart @@ -52,11 +52,11 @@ class TrendingScreen extends StatelessWidget { children: [ Icon( Octicons.repo, - size: 17, + size: 15, color: theme.palette.secondaryText, ), SizedBox(width: 2), - Text(item.repo.name, style: TextStyle(fontSize: 17)) + Text(item.repo.name) ], ), ); diff --git a/lib/screens/user.dart b/lib/screens/user.dart index 8e147a1..e6b1650 100644 --- a/lib/screens/user.dart +++ b/lib/screens/user.dart @@ -107,7 +107,7 @@ class UserScreen extends StatelessWidget { Text( name, style: TextStyle( - color: theme.palette.primary, + color: theme.palette.text, fontSize: 20, fontWeight: FontWeight.w600, ), @@ -117,7 +117,7 @@ class UserScreen extends StatelessWidget { Text( login, style: TextStyle( - color: theme.palette.secondaryText, + color: theme.palette.primary, fontSize: 18, ), ), diff --git a/lib/widgets/issue_item.dart b/lib/widgets/issue_item.dart index 802bc5b..7a96a25 100644 --- a/lib/widgets/issue_item.dart +++ b/lib/widgets/issue_item.dart @@ -74,14 +74,14 @@ class IssueItem extends StatelessWidget { text: '#${payload['number']}', style: TextStyle( color: theme.palette.tertiaryText, - fontSize: 15, + fontWeight: FontWeight.normal, ), ), ], ), style: TextStyle( fontSize: 17, - color: theme.palette.primary, + color: theme.palette.text, fontWeight: FontWeight.w600, ), ), @@ -107,12 +107,10 @@ class IssueItem extends StatelessWidget { children: [ // FIXME: Deleted user if (payload['author'] != null) ...[ - Link( - url: '/' + payload['author']['login'], - child: Avatar( - size: AvatarSize.extraSmall, - url: payload['author']['avatarUrl'], - ), + Avatar( + size: AvatarSize.extraSmall, + url: payload['author']['avatarUrl'], + linkUrl: '/' + payload['author']['login'], ), SizedBox(width: 4), Text( diff --git a/lib/widgets/label.dart b/lib/widgets/label.dart index 91e3ae3..fc387e3 100644 --- a/lib/widgets/label.dart +++ b/lib/widgets/label.dart @@ -3,24 +3,29 @@ import 'package:git_touch/utils/utils.dart'; class Label extends StatelessWidget { final String name; + final Color color; final String cssColor; - Label({this.name, this.cssColor}); + Label({ + @required this.name, + this.color, + this.cssColor, + }); @override Widget build(BuildContext context) { - final color = convertColor(cssColor); + final _color = color ?? convertColor(cssColor); return Container( padding: EdgeInsets.symmetric(vertical: 2, horizontal: 6), decoration: BoxDecoration( - color: color, + color: _color, borderRadius: BorderRadius.all(Radius.circular(4)), ), child: Text( name, style: TextStyle( - fontSize: 12, - color: getFontColorByBrightness(color), + fontSize: 13, + color: getFontColorByBrightness(_color), fontWeight: FontWeight.w600, ), ), diff --git a/lib/widgets/mutation_button.dart b/lib/widgets/mutation_button.dart index 3090684..0fddabd 100644 --- a/lib/widgets/mutation_button.dart +++ b/lib/widgets/mutation_button.dart @@ -19,13 +19,16 @@ class MutationButton extends StatelessWidget { minSize: 0, color: theme.palette.primary, padding: EdgeInsets.symmetric( - horizontal: 12, - vertical: 4, + horizontal: 14, + vertical: 5, ), borderRadius: BorderRadius.all(Radius.circular(20)), child: Text( text, - style: TextStyle(fontSize: 16, color: theme.palette.background), + style: TextStyle( + fontSize: 18, + color: theme.palette.background, + ), ), ); } diff --git a/lib/widgets/user_item.dart b/lib/widgets/user_item.dart index 3643c67..41f0c8e 100644 --- a/lib/widgets/user_item.dart +++ b/lib/widgets/user_item.dart @@ -43,22 +43,20 @@ class UserItem extends StatelessWidget { children: [ Row( children: [ - if (name != null) ...[ - Text( - name, - style: TextStyle( - color: theme.palette.primary, - fontSize: 18, - fontWeight: FontWeight.w500, - ), - ), - SizedBox(width: 8), - ], + // Text( + // name ?? login, + // style: TextStyle( + // color: theme.palette.text, + // fontSize: 18, + // ), + // ), + // SizedBox(width: 8), Text( login, style: TextStyle( - color: theme.palette.secondaryText, - fontSize: 16, + color: theme.palette.primary, + fontSize: 18, + // fontWeight: FontWeight.w600, ), ), ],