mirror of
https://github.com/git-touch/git-touch
synced 2025-01-31 08:04:51 +01:00
refactor: use primer color palette
This commit is contained in:
parent
fdc0872789
commit
1a2afb2775
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:primer/primer.dart';
|
||||
import 'providers/notification.dart';
|
||||
import 'providers/settings.dart';
|
||||
import 'screens/news.dart';
|
||||
@ -69,9 +70,12 @@ class _HomeState extends State<Home> {
|
||||
|
||||
_buildScreen(int index) {
|
||||
// return IssueScreen(number: 29, owner: 'reactjs', name: 'rfcs');
|
||||
// return IssueScreen(
|
||||
// number: 68, owner: 'reactjs', name: 'rfcs', isPullRequest: true);
|
||||
// return ReposScreen('pd4d10');
|
||||
// return OrganizationScreen('flutter');
|
||||
// return TrendingScreen();
|
||||
// return Image.asset('images/spinner.webp', width: 32, height: 32);
|
||||
switch (index) {
|
||||
case 0:
|
||||
return NewsScreen();
|
||||
@ -94,8 +98,8 @@ class _HomeState extends State<Home> {
|
||||
// .withLightness(0.3)
|
||||
// .toColor(),
|
||||
// primaryColor: Color(0xff333333),
|
||||
primaryColor: Palette.primary,
|
||||
accentColor: Palette.primary,
|
||||
primaryColor: PrimerColors.gray900,
|
||||
accentColor: PrimerColors.gray900,
|
||||
);
|
||||
|
||||
// TODO:
|
||||
@ -115,7 +119,7 @@ class _HomeState extends State<Home> {
|
||||
data: CupertinoThemeData(
|
||||
textTheme: CupertinoTextThemeData(
|
||||
// primaryColor: Palette.primary,
|
||||
textStyle: TextStyle(color: Palette.primary),
|
||||
textStyle: TextStyle(color: PrimerColors.gray900),
|
||||
),
|
||||
),
|
||||
child: CupertinoTabScaffold(
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:primer/primer.dart';
|
||||
import 'package:share/share.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../utils/utils.dart';
|
||||
@ -300,11 +301,11 @@ __typename
|
||||
|
||||
if (isPullRequest) {
|
||||
if (payload['merged']) {
|
||||
bgColor = Palette.purple;
|
||||
bgColor = PrimerColors.purple500;
|
||||
iconData = Octicons.git_merge;
|
||||
text = 'Merged';
|
||||
} else if (payload['closed']) {
|
||||
bgColor = Palette.red;
|
||||
bgColor = PrimerColors.red600;
|
||||
iconData = Octicons.git_pull_request;
|
||||
text = 'Closed';
|
||||
} else {
|
||||
@ -314,7 +315,7 @@ __typename
|
||||
}
|
||||
} else {
|
||||
if (payload['closed']) {
|
||||
bgColor = Palette.red;
|
||||
bgColor = PrimerColors.red600;
|
||||
iconData = Octicons.issue_closed;
|
||||
text = 'Closed';
|
||||
} else {
|
||||
|
@ -175,15 +175,7 @@ TextSpan createRepoLinkSpan(BuildContext context, String owner, String name) {
|
||||
}
|
||||
|
||||
class Palette {
|
||||
static const primary = Color(0xff24292e);
|
||||
static const green = Color(0xff2cbe4e);
|
||||
static const purple = Color(0xff6f42c1);
|
||||
static const red = Color(0xffcb2431);
|
||||
static const gray = Color(0xff959da5);
|
||||
static const link = Color(0xff0366d6);
|
||||
static const branchName = Palette.link;
|
||||
static const branchBackground = Color(0xffeaf5ff);
|
||||
static const emojiBackground = Color(0xfff1f8ff);
|
||||
}
|
||||
|
||||
// final pageSize = 5;
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:primer/primer.dart';
|
||||
import '../utils/utils.dart';
|
||||
import 'avatar.dart';
|
||||
import 'link.dart';
|
||||
@ -29,9 +30,8 @@ class CommentItem extends StatelessWidget {
|
||||
|
||||
Decoration _getDecorationByKey(String emojiKey) {
|
||||
return BoxDecoration(
|
||||
color: _hasReacted(emojiKey)
|
||||
? Palette.emojiBackground
|
||||
: Colors.transparent);
|
||||
color:
|
||||
_hasReacted(emojiKey) ? PrimerColors.blue000 : Colors.transparent);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -90,7 +90,7 @@ class CommentItem extends StatelessWidget {
|
||||
TextSpan(text: ' '),
|
||||
TextSpan(
|
||||
text: count.toString(),
|
||||
style: TextStyle(color: Palette.link),
|
||||
style: TextStyle(color: PrimerColors.blue500),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -120,7 +120,7 @@ class CommentItem extends StatelessWidget {
|
||||
padding: EdgeInsets.all(12),
|
||||
child: Icon(
|
||||
Octicons.smiley,
|
||||
color: Palette.link,
|
||||
color: PrimerColors.blue500,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:primer/primer.dart';
|
||||
import '../screens/issue.dart';
|
||||
import '../screens/user.dart';
|
||||
import 'avatar.dart';
|
||||
@ -57,7 +58,7 @@ class EventItem extends StatelessWidget {
|
||||
WidgetBuilder screenBuilder,
|
||||
}) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
padding: EdgeInsets.all(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
@ -68,8 +69,7 @@ class EventItem extends StatelessWidget {
|
||||
Expanded(
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
color: Colors.black, height: 1.3, fontSize: 15),
|
||||
style: TextStyle(color: Colors.black, height: 1.3),
|
||||
children: [
|
||||
createLinkSpan(
|
||||
context,
|
||||
@ -266,11 +266,13 @@ class EventItem extends StatelessWidget {
|
||||
context: context,
|
||||
spans: [
|
||||
TextSpan(text: ' pushed $commitText to '),
|
||||
// TODO: Use primer widgets
|
||||
TextSpan(
|
||||
text: ref.replaceFirst('refs/heads/', ''),
|
||||
style: TextStyle(
|
||||
color: Palette.branchName,
|
||||
backgroundColor: Palette.branchBackground),
|
||||
color: PrimerColors.blue500,
|
||||
backgroundColor: Color(0xffeaf5ff),
|
||||
),
|
||||
),
|
||||
TextSpan(text: ' at '),
|
||||
_buildRepo(context),
|
||||
@ -294,7 +296,7 @@ class EventItem extends StatelessWidget {
|
||||
Text(
|
||||
(commit['sha'] as String).substring(0, 7),
|
||||
style: TextStyle(
|
||||
color: Palette.link,
|
||||
color: PrimerColors.blue500,
|
||||
fontSize: 13,
|
||||
fontFamily: 'Menlo',
|
||||
fontFamilyFallback: ['Menlo', 'Roboto Mono'],
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:primer/primer.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../utils/utils.dart';
|
||||
import '../screens/issue.dart';
|
||||
@ -69,7 +70,7 @@ class _NotificationItemState extends State<NotificationItem> {
|
||||
case 'OPEN':
|
||||
return _buildIcon(Octicons.issue_opened, Palette.green);
|
||||
case 'CLOSED':
|
||||
return _buildIcon(Octicons.issue_closed, Palette.red);
|
||||
return _buildIcon(Octicons.issue_closed, PrimerColors.red600);
|
||||
default:
|
||||
return _buildIcon(Octicons.person);
|
||||
}
|
||||
@ -79,9 +80,9 @@ class _NotificationItemState extends State<NotificationItem> {
|
||||
case 'OPEN':
|
||||
return _buildIcon(Octicons.git_pull_request, Palette.green);
|
||||
case 'CLOSED':
|
||||
return _buildIcon(Octicons.git_pull_request, Palette.red);
|
||||
return _buildIcon(Octicons.git_pull_request, PrimerColors.red600);
|
||||
case 'MERGED':
|
||||
return _buildIcon(Octicons.git_merge, Palette.purple);
|
||||
return _buildIcon(Octicons.git_merge, PrimerColors.purple500);
|
||||
default:
|
||||
return _buildIcon(Octicons.person);
|
||||
}
|
||||
|
@ -37,12 +37,11 @@ class RepoItem extends StatelessWidget {
|
||||
payload['name'],
|
||||
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 15),
|
||||
),
|
||||
Padding(padding: EdgeInsets.only(top: 6)),
|
||||
Text(payload['description'] ?? 'No description provided yet',
|
||||
style: TextStyle(fontSize: 15)),
|
||||
Padding(padding: EdgeInsets.only(top: 6)),
|
||||
SizedBox(height: 6),
|
||||
Text(payload['description'] ?? 'No description provided yet'),
|
||||
SizedBox(height: 6),
|
||||
DefaultTextStyle(
|
||||
style: TextStyle(color: Colors.black54, fontSize: 13),
|
||||
style: TextStyle(color: Color(0xff586069), fontSize: 12),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Icon(Octicons.star, size: 14, color: Colors.black54),
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'dart:core';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:primer/primer.dart';
|
||||
import '../utils/utils.dart';
|
||||
import 'comment_item.dart';
|
||||
import 'user_name.dart';
|
||||
@ -25,7 +26,7 @@ class TimelineItem extends StatelessWidget {
|
||||
Widget _buildItem({
|
||||
String actor,
|
||||
IconData iconData = Octicons.octoface,
|
||||
Color iconColor = Palette.gray,
|
||||
Color iconColor = PrimerColors.gray400,
|
||||
TextSpan textSpan,
|
||||
item,
|
||||
}) {
|
||||
@ -111,7 +112,7 @@ class TimelineItem extends StatelessWidget {
|
||||
return _buildItem(
|
||||
actor: payload['actor']['login'],
|
||||
iconData: Octicons.circle_slash,
|
||||
iconColor: Palette.red,
|
||||
iconColor: PrimerColors.red600,
|
||||
textSpan: TextSpan(text: ' closed this '),
|
||||
item: payload,
|
||||
);
|
||||
|
@ -30,6 +30,9 @@ dependencies:
|
||||
github_contributions: ^0.1.1
|
||||
flutter_svg: ^0.12.0
|
||||
launch_review: ^2.0.0
|
||||
primer:
|
||||
git:
|
||||
url: git://github.com/pd4d10/primer-flutter
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
|
Loading…
x
Reference in New Issue
Block a user