mirror of
https://github.com/git-touch/git-touch
synced 2025-03-07 12:47:42 +01:00
refactor: using palette
This commit is contained in:
parent
23983fb556
commit
891ca417cd
@ -21,7 +21,6 @@ import 'package:git_touch/screens/settings.dart';
|
|||||||
import 'package:git_touch/screens/stargazers.dart';
|
import 'package:git_touch/screens/stargazers.dart';
|
||||||
import 'package:git_touch/screens/user.dart';
|
import 'package:git_touch/screens/user.dart';
|
||||||
import 'package:git_touch/screens/watchers.dart';
|
import 'package:git_touch/screens/watchers.dart';
|
||||||
import 'package:primer/primer.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:git_touch/models/notification.dart';
|
import 'package:git_touch/models/notification.dart';
|
||||||
import 'package:fluro/fluro.dart';
|
import 'package:fluro/fluro.dart';
|
||||||
@ -43,6 +42,7 @@ class _HomeState extends State<Home> {
|
|||||||
// String login;
|
// String login;
|
||||||
|
|
||||||
Widget _buildNotificationIcon(BuildContext context, bool isActive) {
|
Widget _buildNotificationIcon(BuildContext context, bool isActive) {
|
||||||
|
final theme = Provider.of<ThemeModel>(context);
|
||||||
final iconData = isActive ? Icons.notifications : Icons.notifications_none;
|
final iconData = isActive ? Icons.notifications : Icons.notifications_none;
|
||||||
int count = Provider.of<NotificationModel>(context).count;
|
int count = Provider.of<NotificationModel>(context).count;
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
@ -57,7 +57,7 @@ class _HomeState extends State<Home> {
|
|||||||
right: -2,
|
right: -2,
|
||||||
top: -2,
|
top: -2,
|
||||||
child: Icon(Octicons.primitive_dot,
|
child: Icon(Octicons.primitive_dot,
|
||||||
color: PrimerColors.red500, size: 14))
|
color: theme.palette.primary, size: 14))
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -150,8 +150,7 @@ class _HomeState extends State<Home> {
|
|||||||
|
|
||||||
final themData = ThemeData(
|
final themData = ThemeData(
|
||||||
brightness: theme.brightness,
|
brightness: theme.brightness,
|
||||||
primaryColor: PrimerColors.white,
|
primaryColor: Colors.white,
|
||||||
accentColor: PrimerColors.blue500,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
@ -169,7 +168,7 @@ class _HomeState extends State<Home> {
|
|||||||
return CupertinoApp(
|
return CupertinoApp(
|
||||||
theme: CupertinoThemeData(
|
theme: CupertinoThemeData(
|
||||||
brightness: theme.brightness,
|
brightness: theme.brightness,
|
||||||
primaryColor: PrimerColors.blue500,
|
primaryColor: theme.palette.primary,
|
||||||
),
|
),
|
||||||
home: CupertinoTabScaffold(
|
home: CupertinoTabScaffold(
|
||||||
tabBar: CupertinoTabBar(items: _navigationItems),
|
tabBar: CupertinoTabBar(items: _navigationItems),
|
||||||
@ -189,7 +188,7 @@ class _HomeState extends State<Home> {
|
|||||||
body: _buildScreen(active),
|
body: _buildScreen(active),
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
selectedItemColor: PrimerColors.blue500,
|
selectedItemColor: theme.palette.primary,
|
||||||
items: _navigationItems,
|
items: _navigationItems,
|
||||||
currentIndex: active,
|
currentIndex: active,
|
||||||
type: BottomNavigationBarType.fixed,
|
type: BottomNavigationBarType.fixed,
|
||||||
|
@ -117,7 +117,7 @@ class ThemeModel with ChangeNotifier {
|
|||||||
);
|
);
|
||||||
case Brightness.dark:
|
case Brightness.dark:
|
||||||
return Palette(
|
return Palette(
|
||||||
primary: PrimerColors.blue400,
|
primary: PrimerColors.blue500,
|
||||||
text: PrimerColors.gray300,
|
text: PrimerColors.gray300,
|
||||||
secondaryText: PrimerColors.gray400,
|
secondaryText: PrimerColors.gray400,
|
||||||
tertiaryText: PrimerColors.gray500,
|
tertiaryText: PrimerColors.gray500,
|
||||||
|
@ -63,15 +63,16 @@ TextSpan createLinkSpan(
|
|||||||
String text,
|
String text,
|
||||||
String url,
|
String url,
|
||||||
) {
|
) {
|
||||||
|
final theme = Provider.of<ThemeModel>(context);
|
||||||
return TextSpan(
|
return TextSpan(
|
||||||
text: text,
|
text: text,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: PrimerColors.blue500,
|
color: theme.palette.primary,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
recognizer: TapGestureRecognizer()
|
recognizer: TapGestureRecognizer()
|
||||||
..onTap = () {
|
..onTap = () {
|
||||||
Provider.of<ThemeModel>(context).push(context, url);
|
theme.push(context, url);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -149,6 +150,7 @@ class PrimerBranchName extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final theme = Provider.of<ThemeModel>(context);
|
||||||
return Container(
|
return Container(
|
||||||
padding: EdgeInsets.symmetric(vertical: 2, horizontal: 4),
|
padding: EdgeInsets.symmetric(vertical: 2, horizontal: 4),
|
||||||
height: 16,
|
height: 16,
|
||||||
@ -159,7 +161,7 @@ class PrimerBranchName extends StatelessWidget {
|
|||||||
child: Text(
|
child: Text(
|
||||||
name,
|
name,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: PrimerColors.blue500,
|
color: theme.palette.primary,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
height: 1,
|
height: 1,
|
||||||
fontFamily: CommonStyle.monospace,
|
fontFamily: CommonStyle.monospace,
|
||||||
|
@ -3,7 +3,6 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:git_touch/models/theme.dart';
|
import 'package:git_touch/models/theme.dart';
|
||||||
import 'package:git_touch/utils/utils.dart';
|
import 'package:git_touch/utils/utils.dart';
|
||||||
import 'package:git_touch/widgets/border_view.dart';
|
import 'package:git_touch/widgets/border_view.dart';
|
||||||
import 'package:primer/primer.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'link.dart';
|
import 'link.dart';
|
||||||
|
|
||||||
@ -14,11 +13,12 @@ class TableViewHeader extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final theme = Provider.of<ThemeModel>(context);
|
||||||
return Container(
|
return Container(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||||
child: Text(
|
child: Text(
|
||||||
title.toUpperCase(),
|
title.toUpperCase(),
|
||||||
style: TextStyle(color: PrimerColors.gray600, fontSize: 13),
|
style: TextStyle(color: theme.palette.secondaryText, fontSize: 13),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ class TableView extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final themeModel = Provider.of<ThemeModel>(context);
|
final theme = Provider.of<ThemeModel>(context);
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
@ -74,18 +74,18 @@ class TableView extends StatelessWidget {
|
|||||||
height: 24,
|
height: 24,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
color: PrimerColors.blue500,
|
color: theme.palette.primary,
|
||||||
),
|
),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
item.leftIconData,
|
item.leftIconData,
|
||||||
color: themeModel.palette.background,
|
color: theme.palette.background,
|
||||||
size: 14,
|
size: 14,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final widget = DefaultTextStyle(
|
final widget = DefaultTextStyle(
|
||||||
style: TextStyle(fontSize: 17, color: themeModel.palette.text),
|
style: TextStyle(fontSize: 17, color: theme.palette.text),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 44,
|
height: 44,
|
||||||
@ -100,7 +100,7 @@ class TableView extends StatelessWidget {
|
|||||||
DefaultTextStyle(
|
DefaultTextStyle(
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: themeModel.palette.tertiaryText,
|
color: theme.palette.tertiaryText,
|
||||||
),
|
),
|
||||||
child: item.rightWidget,
|
child: item.rightWidget,
|
||||||
),
|
),
|
||||||
@ -109,7 +109,7 @@ class TableView extends StatelessWidget {
|
|||||||
if ((item.onTap != null || item.url != null) &&
|
if ((item.onTap != null || item.url != null) &&
|
||||||
!item.hideRightChevron)
|
!item.hideRightChevron)
|
||||||
Icon(CupertinoIcons.right_chevron,
|
Icon(CupertinoIcons.right_chevron,
|
||||||
size: 20, color: themeModel.palette.tertiaryText)
|
size: 20, color: theme.palette.tertiaryText)
|
||||||
else
|
else
|
||||||
SizedBox(width: 2),
|
SizedBox(width: 2),
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user