diff --git a/lib/main.dart b/lib/main.dart index 9a1116e..2b2834b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; +import 'package:git_touch/screens/repo.dart'; import 'package:primer/primer.dart'; import 'providers/notification.dart'; import 'providers/settings.dart'; @@ -75,6 +76,7 @@ class _HomeState extends State { // return ReposScreen('pd4d10'); // return OrganizationScreen('flutter'); // return TrendingScreen(); + // return RepoScreen('flutter', 'flutter'); // return Image.asset('images/spinner.webp', width: 32, height: 32); switch (index) { case 0: diff --git a/lib/screens/issue.dart b/lib/screens/issue.dart index c2c9aae..3eb3cf0 100644 --- a/lib/screens/issue.dart +++ b/lib/screens/issue.dart @@ -294,57 +294,26 @@ __typename return data['repository'][resource]; } - Widget _buildBadge(payload) { - Color bgColor; - IconData iconData; - String text; + StateLabelStatus _getLabelStatus(payload) { + StateLabelStatus status; if (isPullRequest) { if (payload['merged']) { - bgColor = PrimerColors.purple500; - iconData = Octicons.git_merge; - text = 'Merged'; + status = StateLabelStatus.pullMerged; } else if (payload['closed']) { - bgColor = PrimerColors.red600; - iconData = Octicons.git_pull_request; - text = 'Closed'; + status = StateLabelStatus.pullClosed; } else { - bgColor = Palette.green; - iconData = Octicons.git_pull_request; - text = 'Open'; + status = StateLabelStatus.pullOpened; } } else { if (payload['closed']) { - bgColor = PrimerColors.red600; - iconData = Octicons.issue_closed; - text = 'Closed'; + status = StateLabelStatus.issueClosed; } else { - bgColor = Palette.green; - iconData = Octicons.issue_opened; - text = 'Open'; + status = StateLabelStatus.issueOpened; } } - return Container( - decoration: BoxDecoration( - color: bgColor, - borderRadius: BorderRadius.all(Radius.circular(4)), - ), - padding: EdgeInsets.all(6), - child: Row( - children: [ - Icon(iconData, color: Colors.white, size: 15), - Padding(padding: EdgeInsets.only(left: 2)), - Text( - text, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w600, - fontSize: 14, - ), - ), - ], - ), - ); + + return status; } _handleReaction(payload) { @@ -413,7 +382,7 @@ mutation { ), ), Padding(padding: EdgeInsets.only(right: 8)), - _buildBadge(payload), + StateLabel(_getLabelStatus(payload)) ], ), Padding(padding: EdgeInsets.only(bottom: 16)),