From ca75048f513de9dd67aaefdd2c3116c4ecf293e8 Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Fri, 8 Nov 2019 20:23:09 +0800 Subject: [PATCH] refactor: github palette --- lib/screens/commits.dart | 4 ++-- lib/utils/utils.dart | 4 +++- lib/widgets/issue_item.dart | 2 +- lib/widgets/notification_item.dart | 10 +++++----- lib/widgets/timeline_item.dart | 10 +++++----- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/screens/commits.dart b/lib/screens/commits.dart index d2005da..7e962c5 100644 --- a/lib/screens/commits.dart +++ b/lib/screens/commits.dart @@ -72,9 +72,9 @@ class CommitsScreen extends StatelessWidget { var size = 18.0; switch (state) { case 'SUCCESS': - return Icon(Octicons.check, color: PrimerColors.green500, size: size); + return Icon(Octicons.check, color: GithubPalette.open, size: size); case 'FAILURE': - return Icon(Octicons.x, color: PrimerColors.red600, size: size); + return Icon(Octicons.x, color: GithubPalette.closed, size: size); default: return Container(); } diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index b211195..3c8c322 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -87,7 +87,9 @@ Tuple2 parseRepositoryFullName(String fullName) { } class GithubPalette { - static const green = Color(0xff2cbe4e); + static const open = Color(0xff2cbe4e); + static const closed = PrimerColors.red600; + static const merged = PrimerColors.purple500; } // final pageSize = 5; diff --git a/lib/widgets/issue_item.dart b/lib/widgets/issue_item.dart index 527826e..a00524d 100644 --- a/lib/widgets/issue_item.dart +++ b/lib/widgets/issue_item.dart @@ -65,7 +65,7 @@ class IssueItem extends StatelessWidget { isPullRequest ? Octicons.git_pull_request : Octicons.issue_opened, - color: GithubPalette.green, + color: GithubPalette.open, size: 18), SizedBox(width: 6), Expanded( diff --git a/lib/widgets/notification_item.dart b/lib/widgets/notification_item.dart index a0990f9..dd96739 100644 --- a/lib/widgets/notification_item.dart +++ b/lib/widgets/notification_item.dart @@ -37,9 +37,9 @@ class _NotificationItemState extends State { case 'Issue': switch (payload.state) { case 'OPEN': - return _buildIcon(Octicons.issue_opened, GithubPalette.green); + return _buildIcon(Octicons.issue_opened, GithubPalette.open); case 'CLOSED': - return _buildIcon(Octicons.issue_closed, PrimerColors.red600); + return _buildIcon(Octicons.issue_closed, GithubPalette.closed); default: return _buildIcon(Octicons.person); } @@ -47,11 +47,11 @@ class _NotificationItemState extends State { case 'PullRequest': switch (payload.state) { case 'OPEN': - return _buildIcon(Octicons.git_pull_request, GithubPalette.green); + return _buildIcon(Octicons.git_pull_request, GithubPalette.open); case 'CLOSED': - return _buildIcon(Octicons.git_pull_request, PrimerColors.red600); + return _buildIcon(Octicons.git_pull_request, GithubPalette.closed); case 'MERGED': - return _buildIcon(Octicons.git_merge, PrimerColors.purple500); + return _buildIcon(Octicons.git_merge, GithubPalette.merged); default: return _buildIcon(Octicons.person); } diff --git a/lib/widgets/timeline_item.dart b/lib/widgets/timeline_item.dart index 486b5d9..90b579f 100644 --- a/lib/widgets/timeline_item.dart +++ b/lib/widgets/timeline_item.dart @@ -113,7 +113,7 @@ class TimelineItem extends StatelessWidget { return TimelineEventItem( actor: payload['actor']['login'], iconData: Octicons.primitive_dot, - iconColor: GithubPalette.green, + iconColor: GithubPalette.open, textSpan: TextSpan( text: ' referenced this on #' + payload['source']['number'].toString()), @@ -123,7 +123,7 @@ class TimelineItem extends StatelessWidget { return TimelineEventItem( actor: payload['actor']['login'], iconData: Octicons.circle_slash, - iconColor: PrimerColors.red600, + iconColor: GithubPalette.closed, textSpan: TextSpan(text: ' closed this '), item: payload, ); @@ -132,7 +132,7 @@ class TimelineItem extends StatelessWidget { return TimelineEventItem( actor: payload['actor']['login'], iconData: Octicons.primitive_dot, - iconColor: GithubPalette.green, + iconColor: GithubPalette.open, textSpan: TextSpan(text: ' reopened this '), item: payload, ); @@ -246,7 +246,7 @@ class TimelineItem extends StatelessWidget { case 'PullRequestReview': return TimelineEventItem( actor: payload['author']['login'], - iconColor: PrimerColors.green500, + iconColor: GithubPalette.open, iconData: Octicons.check, textSpan: _buildReviewText(context, payload), item: payload, @@ -258,7 +258,7 @@ class TimelineItem extends StatelessWidget { return TimelineEventItem( actor: payload['actor']['login'], iconData: Octicons.git_merge, - iconColor: PrimerColors.purple500, + iconColor: GithubPalette.merged, textSpan: TextSpan(children: [ TextSpan(text: ' merged commit '), TextSpan(text: payload['commit']['oid'].substring(0, 8)),