refactor: replace legacy palette

This commit is contained in:
Rongjian Zhang 2022-09-25 02:46:37 +08:00
parent fee559ba9a
commit 15a57899fd
57 changed files with 265 additions and 255 deletions

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
@ -155,8 +156,8 @@ class _HomeState extends State<Home> {
Positioned(
right: -2,
top: -2,
child:
Icon(Octicons.dot_fill, color: theme.palette.primary, size: 14),
child: Icon(Octicons.dot_fill,
color: AntTheme.of(context).colorPrimary, size: 14),
)
],
);

View File

@ -7,7 +7,6 @@ import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/action_button.dart';
import 'package:primer/primer.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:universal_io/io.dart';
@ -68,25 +67,6 @@ class StaticRoute extends PageRouteBuilder {
final WidgetBuilder? builder;
}
class Palette {
const Palette({
required this.primary,
required this.text,
required this.secondaryText,
required this.tertiaryText,
required this.background,
required this.grayBackground,
required this.border,
});
final Color primary;
final Color text;
final Color secondaryText;
final Color tertiaryText;
final Color background;
final Color grayBackground;
final Color border;
}
class ThemeModel with ChangeNotifier {
String? markdownCss;
@ -161,35 +141,6 @@ class ThemeModel with ChangeNotifier {
notifyListeners();
}
final paletteLight = Palette(
primary: PrimerColors.blue500,
text: Colors.black,
secondaryText: Colors.grey.shade800,
tertiaryText: Colors.grey.shade600,
background: Colors.white,
grayBackground: Colors.grey.shade100,
border: Colors.grey.shade300,
);
final paletteDark = Palette(
primary: PrimerColors.blue500,
text: Colors.grey.shade300,
secondaryText: Colors.grey.shade400,
tertiaryText: Colors.grey.shade500,
background: Colors.black,
grayBackground: Colors.grey.shade900,
border: Colors.grey.shade700,
);
Palette get palette {
switch (brightness) {
case Brightness.dark:
return paletteDark;
case Brightness.light:
default:
return paletteLight;
}
}
Future<void> init() async {
markdownCss = await rootBundle.loadString('images/github-markdown.css');
@ -252,10 +203,10 @@ class ThemeModel with ChangeNotifier {
Container(
alignment: Alignment.bottomCenter,
decoration: BoxDecoration(
color: palette.background,
color: AntTheme.of(context).colorBackground,
border: Border(
bottom: BorderSide(
color: palette.grayBackground,
color: AntTheme.of(context).colorBox,
width: 0.0,
),
),
@ -291,7 +242,7 @@ class ThemeModel with ChangeNotifier {
SizedBox(
height: 216,
child: CupertinoPicker(
backgroundColor: palette.background,
backgroundColor: AntTheme.of(context).colorBackground,
itemExtent: 40,
scrollController: FixedExtentScrollController(
initialItem: groupItem.items
@ -312,7 +263,9 @@ class ThemeModel with ChangeNotifier {
},
children: <Widget>[
for (var v in groupItem.items)
Text(v.text!, style: TextStyle(color: palette.text)),
Text(v.text!,
style:
TextStyle(color: AntTheme.of(context).colorText)),
],
),
)

View File

@ -1,14 +1,13 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:provider/provider.dart';
import 'package:git_touch/widgets/error_reload.dart';
import 'package:git_touch/widgets/link.dart';
import 'package:git_touch/widgets/loading.dart';
import 'package:provider/provider.dart';
class LongListPayload<T, K> {
LongListPayload({
required this.header,
required this.totalCount,
@ -28,7 +27,6 @@ class LongListPayload<T, K> {
// We should load leading and trailing items at first fetching, and do load more in the middle
// e.g. https://github.com/reactjs/rfcs/pull/68
class LongListStatefulScaffold<T, K> extends StatefulWidget {
const LongListStatefulScaffold({
required this.title,
this.trailingBuilder,
@ -125,20 +123,21 @@ class _LongListStatefulScaffoldState<T, K>
child: Container(
padding: CommonStyle.padding,
decoration: BoxDecoration(
border: Border.all(color: theme.palette.text),
border: Border.all(color: AntTheme.of(context).colorText),
),
child: Column(
children: <Widget>[
Text('$count hidden items',
style:
TextStyle(color: theme.palette.text, fontSize: 15)),
style: TextStyle(
color: AntTheme.of(context).colorText, fontSize: 15)),
const Padding(padding: EdgeInsets.only(top: 4)),
loadingMore
? const CupertinoActivityIndicator()
: Text(
'Load more...',
style: TextStyle(
color: theme.palette.primary, fontSize: 16),
color: AntTheme.of(context).colorPrimary,
fontSize: 16),
),
],
),
@ -177,7 +176,9 @@ class _LongListStatefulScaffoldState<T, K>
@override
Widget build(BuildContext context) {
final slivers = <Widget>[CupertinoSliverRefreshControl(onRefresh: _refresh)];
final slivers = <Widget>[
CupertinoSliverRefreshControl(onRefresh: _refresh)
];
if (payload != null) {
slivers.add(
SliverToBoxAdapter(child: widget.headerBuilder(payload!.header)),

View File

@ -44,7 +44,7 @@
// SizedBox(height: 12),
// Text(
// 'GitTouch',
// style: TextStyle(fontSize: 20, color: theme.palette.text),
// style: TextStyle(fontSize: 20, color: AntTheme.of(context).text),
// ),
// SizedBox(height: 48),
// AntList(items: [

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/bitbucket.dart';
@ -13,7 +14,6 @@ import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';
class BbIssueScreen extends StatelessWidget {
const BbIssueScreen(this.owner, this.name, this.number, {this.isPr = false});
final String owner;
final String name;
@ -65,7 +65,7 @@ class BbIssueScreen extends StatelessWidget {
'$owner / $name',
style: TextStyle(
fontSize: 17,
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
),
),
const SizedBox(width: 4),
@ -73,7 +73,7 @@ class BbIssueScreen extends StatelessWidget {
'#$number',
style: TextStyle(
fontSize: 17,
color: theme.palette.tertiaryText,
color: AntTheme.of(context).colorWeak,
),
),
],

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
@ -30,7 +31,7 @@ class _BbIssueCommentScreenState extends State<BbIssueCommentScreen> {
Padding(
padding: CommonStyle.padding,
child: CupertinoTextField(
style: TextStyle(color: theme.palette.text),
style: TextStyle(color: AntTheme.of(context).colorText),
placeholder: AppLocalizations.of(context)!.body,
onChanged: (v) {
setState(() {

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
@ -31,7 +32,7 @@ class _BbIssueFormScreenState extends State<BbIssueFormScreen> {
Padding(
padding: CommonStyle.padding,
child: CupertinoTextField(
style: TextStyle(color: theme.palette.text),
style: TextStyle(color: AntTheme.of(context).colorText),
placeholder: AppLocalizations.of(context)!.title,
onChanged: (v) {
setState(() {
@ -43,7 +44,7 @@ class _BbIssueFormScreenState extends State<BbIssueFormScreen> {
Padding(
padding: CommonStyle.padding,
child: CupertinoTextField(
style: TextStyle(color: theme.palette.text),
style: TextStyle(color: AntTheme.of(context).colorText),
placeholder: AppLocalizations.of(context)!.body,
onChanged: (v) {
setState(() {

View File

@ -1,6 +1,5 @@
import 'dart:convert';
import 'package:antd_mobile/antd_mobile.dart';import 'dart:convert';
import 'package:antd_mobile/antd_mobile.dart';
import 'package:filesize/filesize.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/S.dart';

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/gitee.dart';
@ -48,7 +49,7 @@ class GeCommitScreen extends StatelessWidget {
'$owner / $name',
style: TextStyle(
fontSize: 17,
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
),
),
const SizedBox(width: 4),
@ -56,7 +57,7 @@ class GeCommitScreen extends StatelessWidget {
sha.substring(0, 7),
style: TextStyle(
fontSize: 17,
color: theme.palette.tertiaryText,
color: AntTheme.of(context).colorWeak,
),
),
],

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
@ -51,7 +52,7 @@ class GeContributorsScreen extends StatelessWidget {
Text(
v.name!,
style: TextStyle(
color: theme.palette.primary,
color: AntTheme.of(context).colorPrimary,
fontSize: 18,
fontWeight: FontWeight.w600,
),
@ -62,7 +63,7 @@ class GeContributorsScreen extends StatelessWidget {
if (v.contributions != null)
DefaultTextStyle(
style: TextStyle(
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
fontSize: 16,
),
child: Text('Contributions: ${v.contributions}'),

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/gitee.dart';
@ -91,7 +92,7 @@ class GeIssueScreen extends StatelessWidget {
'$owner / $name',
style: TextStyle(
fontSize: 17,
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
),
),
const SizedBox(width: 4),
@ -99,7 +100,7 @@ class GeIssueScreen extends StatelessWidget {
'#$number',
style: TextStyle(
fontSize: 17,
color: theme.palette.tertiaryText,
color: AntTheme.of(context).colorWeak,
),
),
],

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
@ -45,7 +46,7 @@ class _GeIssueCommentScreenState extends State<GeIssueCommentScreen> {
padding: CommonStyle.padding,
child: CupertinoTextField(
controller: _controller,
style: TextStyle(color: theme.palette.text),
style: TextStyle(color: AntTheme.of(context).colorText),
placeholder: AppLocalizations.of(context)!.body,
maxLines: 10,
),

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
@ -31,7 +32,7 @@ class _GeIssueFormScreenState extends State<GeIssueFormScreen> {
Padding(
padding: CommonStyle.padding,
child: CupertinoTextField(
style: TextStyle(color: theme.palette.text),
style: TextStyle(color: AntTheme.of(context).colorText),
placeholder: AppLocalizations.of(context)!.title,
onChanged: (v) {
setState(() {
@ -43,7 +44,7 @@ class _GeIssueFormScreenState extends State<GeIssueFormScreen> {
Padding(
padding: CommonStyle.padding,
child: CupertinoTextField(
style: TextStyle(color: theme.palette.text),
style: TextStyle(color: AntTheme.of(context).colorText),
placeholder: AppLocalizations.of(context)!.body,
onChanged: (v) {
setState(() {

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/material.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/gitee.dart';
@ -114,7 +115,8 @@ class GePullScreen extends StatelessWidget {
'$owner / $name',
style: TextStyle(
fontSize: 17,
color: theme.palette.secondaryText,
color: AntTheme.of(context)
.colorTextSecondary,
),
),
const SizedBox(width: 4),
@ -122,7 +124,7 @@ class GePullScreen extends StatelessWidget {
'#$number',
style: TextStyle(
fontSize: 17,
color: theme.palette.tertiaryText,
color: AntTheme.of(context).colorWeak,
),
),
],
@ -157,7 +159,8 @@ class GePullScreen extends StatelessWidget {
Text(
'${files.length} files changed',
style: TextStyle(
color: theme.palette.secondaryText,
color: AntTheme.of(context)
.colorTextSecondary,
fontSize: 17,
),
),
@ -180,7 +183,8 @@ class GePullScreen extends StatelessWidget {
),
Icon(
Ionicons.chevron_forward,
color: theme.palette.border,
color:
AntTheme.of(context).colorBorder,
),
],
)
@ -195,7 +199,7 @@ class GePullScreen extends StatelessWidget {
title: Text(
'Commits',
style: TextStyle(
color: theme.palette.primary,
color: AntTheme.of(context).colorPrimary,
fontSize: 18,
fontWeight: FontWeight.w600,
),
@ -215,7 +219,8 @@ class GePullScreen extends StatelessWidget {
Text(
commit.sha!.substring(0, 7),
style: TextStyle(
color: theme.palette.primary,
color: AntTheme.of(context)
.colorPrimary,
fontSize: 17,
fontFamily:
CommonStyle.monospace,

View File

@ -1,7 +1,6 @@
import 'dart:convert';
import 'package:antd_mobile/antd_mobile.dart';import 'dart:convert';
import 'dart:io';
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
@ -122,7 +123,7 @@ class _GeSearchScreenState extends State<GeSearchScreen> {
return CommonScaffold(
title: Container(
color: theme.palette.background,
color: AntTheme.of(context).colorBackground,
child: CupertinoTextField(
prefix: Row(
children: const <Widget>[

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:ferry/ferry.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/graphql/__generated__/github.data.gql.dart';
@ -5,18 +6,17 @@ import 'package:git_touch/graphql/__generated__/github.req.gql.dart';
import 'package:git_touch/graphql/__generated__/github.var.gql.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/scaffolds/long_list.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/action_button.dart';
import 'package:git_touch/widgets/avatar.dart';
import 'package:git_touch/widgets/comment_item.dart';
import 'package:git_touch/widgets/link.dart';
import 'package:git_touch/widgets/timeline_item.dart';
import 'package:github/github.dart' as github;
import 'package:primer/primer.dart';
import 'package:provider/provider.dart';
import 'package:git_touch/scaffolds/long_list.dart';
import 'package:git_touch/widgets/comment_item.dart';
class GhIssueScreen extends StatelessWidget {
const GhIssueScreen(this.owner, this.name, this.number);
final String owner;
@ -50,7 +50,7 @@ class GhIssueScreen extends StatelessWidget {
'$owner / $name',
style: TextStyle(
fontSize: 17,
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
),
),
const SizedBox(width: 4),
@ -58,7 +58,7 @@ class GhIssueScreen extends StatelessWidget {
'#$number',
style: TextStyle(
fontSize: 17,
color: theme.palette.tertiaryText,
color: AntTheme.of(context).colorWeak,
),
),
],
@ -226,7 +226,7 @@ class GhIssueScreen extends StatelessWidget {
children: <Widget>[
Text('${pr.changedFiles} files changed',
style: TextStyle(
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
fontSize: 17,
)),
Row(
@ -243,7 +243,7 @@ class GhIssueScreen extends StatelessWidget {
fontSize: 15,
)),
Icon(Ionicons.chevron_forward,
color: theme.palette.border),
color: AntTheme.of(context).colorBorder),
],
)
],

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
@ -31,7 +32,7 @@ class _GhIssueFormScreenState extends State<GhIssueFormScreen> {
Padding(
padding: CommonStyle.padding,
child: CupertinoTextField(
style: TextStyle(color: theme.palette.text),
style: TextStyle(color: AntTheme.of(context).colorText),
placeholder: AppLocalizations.of(context)!.title,
onChanged: (v) {
setState(() {
@ -43,7 +44,7 @@ class _GhIssueFormScreenState extends State<GhIssueFormScreen> {
Padding(
padding: CommonStyle.padding,
child: CupertinoTextField(
style: TextStyle(color: theme.palette.text),
style: TextStyle(color: AntTheme.of(context).colorText),
placeholder: AppLocalizations.of(context)!.body,
onChanged: (v) {
setState(() {

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
@ -6,14 +7,13 @@ import 'package:git_touch/models/github.dart';
import 'package:git_touch/models/notification.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/scaffolds/tab_stateful.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:github/github.dart';
import 'package:provider/provider.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/empty.dart';
import 'package:git_touch/widgets/list_group.dart';
import 'package:git_touch/widgets/notification_item.dart';
import 'package:github/github.dart';
import 'package:provider/provider.dart';
class GhNotificationScreen extends StatefulWidget {
@override
@ -117,7 +117,7 @@ ${item.key}: pullRequest(number: ${item.subject!.number}) {
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: theme.palette.text,
color: AntTheme.of(context).colorText,
),
),
GestureDetector(
@ -132,7 +132,7 @@ ${item.key}: pullRequest(number: ${item.subject!.number}) {
},
child: Icon(
Ionicons.checkmark_done,
color: theme.palette.tertiaryText,
color: AntTheme.of(context).colorWeak,
size: 24,
),
),

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
@ -182,7 +183,7 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
return CommonScaffold(
title: Container(
color: theme.palette.background,
color: AntTheme.of(context).colorBackground,
child: CupertinoTextField(
prefix: Row(
children: const <Widget>[

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/theme.dart';
@ -66,7 +67,8 @@ class GhTrendingScreen extends StatelessWidget {
Icon(
Octicons.repo,
size: 17,
color: theme.palette.secondaryText,
color: AntTheme.of(context)
.colorTextSecondary,
),
const SizedBox(width: 4),
Expanded(
@ -74,7 +76,8 @@ class GhTrendingScreen extends StatelessWidget {
'${v.username} / ${v.repo!.name}',
style: TextStyle(
fontSize: 17,
color: theme.palette.secondaryText,
color: AntTheme.of(context)
.colorTextSecondary,
),
overflow: TextOverflow.ellipsis,
))

View File

@ -139,7 +139,8 @@ class _User extends StatelessWidget {
child: TextWithAt(
text: p.company!,
linkFactory: (text) => '/github/${text.substring(1)}',
style: TextStyle(fontSize: 17, color: theme.palette.text),
style: TextStyle(
fontSize: 17, color: AntTheme.of(context).colorText),
oneLine: true,
),
),

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
@ -30,7 +31,7 @@ class _GlIssueFormScreenState extends State<GlIssueFormScreen> {
Padding(
padding: CommonStyle.padding,
child: CupertinoTextField(
style: TextStyle(color: theme.palette.text),
style: TextStyle(color: AntTheme.of(context).colorText),
placeholder: AppLocalizations.of(context)!.title,
onChanged: (v) {
setState(() {
@ -42,7 +43,7 @@ class _GlIssueFormScreenState extends State<GlIssueFormScreen> {
Padding(
padding: CommonStyle.padding,
child: CupertinoTextField(
style: TextStyle(color: theme.palette.text),
style: TextStyle(color: AntTheme.of(context).colorText),
placeholder: AppLocalizations.of(context)!.body,
onChanged: (v) {
setState(() {

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
@ -44,7 +45,7 @@ class GlProjectActivityScreen extends StatelessWidget {
TextSpan(
text: data.author!.name,
style: TextStyle(
color: theme.palette.primary,
color: AntTheme.of(context).colorPrimary,
fontWeight: FontWeight.w500,
),
),

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
@ -98,7 +99,7 @@ class _GlSearchScreenState extends State<GlSearchScreen> {
return CommonScaffold(
title: Container(
color: theme.palette.background,
color: AntTheme.of(context).colorBackground,
child: CupertinoTextField(
prefix: Row(
children: const <Widget>[

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/gitlab.dart';
@ -13,7 +14,7 @@ class GlTodosScreen extends StatelessWidget {
final theme = Provider.of<ThemeModel>(context);
return TextSpan(
text: p.author!.name,
style: TextStyle(color: theme.palette.primary),
style: TextStyle(color: AntTheme.of(context).colorPrimary),
);
}
@ -21,7 +22,7 @@ class GlTodosScreen extends StatelessWidget {
final theme = Provider.of<ThemeModel>(context);
return TextSpan(
text: '${p.project!.pathWithNamespace}!${p.target!.iid}',
style: TextStyle(color: theme.palette.primary),
style: TextStyle(color: AntTheme.of(context).colorPrimary),
);
}
@ -86,7 +87,8 @@ class GlTodosScreen extends StatelessWidget {
child: Text.rich(
TextSpan(
style: TextStyle(
color: theme.palette.text, fontSize: 17),
color: AntTheme.of(context).colorText,
fontSize: 17),
children: [
..._buildItem(context, item),
],

View File

@ -1,6 +1,5 @@
import 'dart:convert';
import 'package:antd_mobile/antd_mobile.dart';import 'dart:convert';
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/gitea.dart';
@ -91,7 +92,7 @@ class GtIssueScreen extends StatelessWidget {
'$owner / $name',
style: TextStyle(
fontSize: 17,
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
),
),
const SizedBox(width: 4),
@ -99,7 +100,7 @@ class GtIssueScreen extends StatelessWidget {
'#$number',
style: TextStyle(
fontSize: 17,
color: theme.palette.tertiaryText,
color: AntTheme.of(context).colorWeak,
),
),
],

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
@ -45,7 +46,7 @@ class _GtIssueCommentScreenState extends State<GtIssueCommentScreen> {
padding: CommonStyle.padding,
child: CupertinoTextField(
controller: _controller,
style: TextStyle(color: theme.palette.text),
style: TextStyle(color: AntTheme.of(context).colorText),
placeholder: AppLocalizations.of(context)!.body,
maxLines: 10,
),

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
@ -31,7 +32,7 @@ class _GtIssueFormScreenState extends State<GtIssueFormScreen> {
Padding(
padding: CommonStyle.padding,
child: CupertinoTextField(
style: TextStyle(color: theme.palette.text),
style: TextStyle(color: AntTheme.of(context).colorText),
placeholder: AppLocalizations.of(context)!.title,
onChanged: (v) {
setState(() {
@ -43,7 +44,7 @@ class _GtIssueFormScreenState extends State<GtIssueFormScreen> {
Padding(
padding: CommonStyle.padding,
child: CupertinoTextField(
style: TextStyle(color: theme.palette.text),
style: TextStyle(color: AntTheme.of(context).colorText),
placeholder: AppLocalizations.of(context)!.body,
onChanged: (v) {
setState(() {

View File

@ -1,6 +1,5 @@
import 'dart:convert';
import 'package:antd_mobile/antd_mobile.dart';import 'dart:convert';
import 'package:antd_mobile/antd_mobile.dart';
import 'package:filesize/filesize.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/S.dart';

View File

@ -18,7 +18,7 @@
// title: title,
// body: PhotoView(
// imageProvider: NetworkImage(url),
// backgroundDecoration: BoxDecoration(color: theme.palette.background),
// backgroundDecoration: BoxDecoration(color: AntTheme.of(context).background),
// ),
// );
// }

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/widgets.dart';
@ -49,7 +50,8 @@ class _LoginScreenState extends State<LoginScreen> {
child: Container(
padding: CommonStyle.padding,
decoration: BoxDecoration(
border: Border(bottom: BorderSide(color: theme.palette.border)),
border: Border(
bottom: BorderSide(color: AntTheme.of(context).colorBorder)),
),
child: Row(
children: <Widget>[
@ -61,12 +63,14 @@ class _LoginScreenState extends State<LoginScreen> {
children: <Widget>[
Text(
account.login,
style: TextStyle(fontSize: 20, color: theme.palette.text),
style: TextStyle(
fontSize: 20, color: AntTheme.of(context).colorText),
),
const Padding(padding: EdgeInsets.only(top: 6)),
Text(
account.domain,
style: TextStyle(color: theme.palette.secondaryText),
style: TextStyle(
color: AntTheme.of(context).colorTextSecondary),
)
],
),
@ -88,7 +92,8 @@ class _LoginScreenState extends State<LoginScreen> {
child: Container(
padding: const EdgeInsets.symmetric(vertical: 20),
decoration: BoxDecoration(
border: Border(bottom: BorderSide(color: theme.palette.border)),
border: Border(
bottom: BorderSide(color: AntTheme.of(context).colorBorder)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
@ -173,7 +178,7 @@ class _LoginScreenState extends State<LoginScreen> {
'user, repo, read:org, notifications',
style: TextStyle(
fontSize: 16,
color: theme.palette.primary),
color: AntTheme.of(context).colorPrimary),
)
]),
);
@ -212,7 +217,8 @@ class _LoginScreenState extends State<LoginScreen> {
Text(
'api, read_user, read_repository',
style: TextStyle(
fontSize: 16, color: theme.palette.primary),
fontSize: 16,
color: AntTheme.of(context).colorPrimary),
)
],
),
@ -257,8 +263,8 @@ class _LoginScreenState extends State<LoginScreen> {
),
TextSpan(
text: 'this guide',
style:
TextStyle(color: theme.palette.primary),
style: TextStyle(
color: AntTheme.of(context).colorPrimary),
recognizer: TapGestureRecognizer()
..onTap = () {
context.pushUrl(
@ -279,7 +285,8 @@ class _LoginScreenState extends State<LoginScreen> {
Text(
'Account: read\nTeam membership: read\nProjects: read\nRepositories: read\nPull requests: read\nIssues: read\nSnippets: read',
style: TextStyle(
fontSize: 16, color: theme.palette.primary),
fontSize: 16,
color: AntTheme.of(context).colorPrimary),
)
],
),
@ -316,7 +323,8 @@ class _LoginScreenState extends State<LoginScreen> {
Text(
'https://codeberg.org',
style: TextStyle(
fontSize: 16, color: theme.palette.primary),
fontSize: 16,
color: AntTheme.of(context).colorPrimary),
),
],
));
@ -375,7 +383,7 @@ class _LoginScreenState extends State<LoginScreen> {
AppLocalizations.of(context)!.longPressToRemoveAccount,
style: TextStyle(
fontSize: 16,
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
),
),
)

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/models/theme.dart';
@ -64,7 +65,7 @@ TextSpan createLinkSpan(
return TextSpan(
text: text,
style: TextStyle(
color: theme.palette.primary,
color: AntTheme.of(context).colorPrimary,
fontWeight: FontWeight.w600,
),
recognizer: TapGestureRecognizer()

View File

@ -37,7 +37,7 @@ class BlobView extends StatelessWidget {
case 'webp':
// return PhotoView(
// imageProvider: MemoryImage(Uint8List.fromList(bits)),
// backgroundDecoration: BoxDecoration(color: theme.palette.background),
// backgroundDecoration: BoxDecoration(color: AntTheme.of(context).background),
// );
return base64Text == null
? Image.network(

View File

@ -1,9 +1,9 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/models/theme.dart';
import 'package:provider/provider.dart';
class BorderView extends StatelessWidget {
const BorderView({
this.height,
this.leftPadding = 0,
@ -21,7 +21,7 @@ class BorderView extends StatelessWidget {
margin: EdgeInsets.only(left: leftPadding),
decoration: BoxDecoration(
border: Border(
top: BorderSide(color: theme.palette.border, width: 0),
top: BorderSide(color: AntTheme.of(context).colorBorder, width: 0),
),
),
);
@ -33,14 +33,16 @@ class BorderView extends StatelessWidget {
width: leftPadding,
height: height,
child: DecoratedBox(
decoration: BoxDecoration(color: theme.palette.background),
decoration:
BoxDecoration(color: AntTheme.of(context).colorBackground),
),
),
Expanded(
child: SizedBox(
height: height,
child: DecoratedBox(
decoration: BoxDecoration(color: theme.palette.border),
decoration:
BoxDecoration(color: AntTheme.of(context).colorBorder),
),
),
),

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/graphql/__generated__/github.data.gql.dart';
import 'package:git_touch/graphql/__generated__/schema.schema.gql.dart';
@ -138,7 +139,8 @@ mutation {
const SizedBox(width: 4),
Text(numberFormat.format(item.count),
style: TextStyle(
color: theme.palette.primary, fontSize: 14))
color: AntTheme.of(context).colorPrimary,
fontSize: 14))
],
),
),
@ -160,8 +162,10 @@ mutation {
child: Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: <Widget>[
Text('+', style: TextStyle(color: theme.palette.primary)),
Icon(Octicons.smiley, color: theme.palette.primary, size: 18),
Text('+',
style: TextStyle(color: AntTheme.of(context).colorPrimary)),
Icon(Octicons.smiley,
color: AntTheme.of(context).colorPrimary, size: 18),
],
),
),
@ -224,7 +228,7 @@ class CommentItem extends StatelessWidget {
Text(
timeago.format(createdAt!),
style: TextStyle(
color: theme.palette.tertiaryText, fontSize: 13),
color: AntTheme.of(context).colorWeak, fontSize: 13),
),
],
),

View File

@ -44,7 +44,7 @@ class CommitItem extends StatelessWidget {
message!,
style: TextStyle(
fontSize: 17,
color: theme.palette.text,
color: AntTheme.of(context).colorText,
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
@ -54,11 +54,12 @@ class CommitItem extends StatelessWidget {
children: <Widget>[
Text(author!,
style: TextStyle(
fontSize: 15, color: theme.palette.primary)),
fontSize: 15,
color: AntTheme.of(context).colorPrimary)),
Text(
' committed ${timeago.format(createdAt!)}',
style: TextStyle(
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
fontSize: 15,
),
),

View File

@ -38,7 +38,7 @@ class ContributorItem extends StatelessWidget {
Text(
login!,
style: TextStyle(
color: theme.palette.primary,
color: AntTheme.of(context).colorPrimary,
fontSize: 18,
fontWeight: FontWeight.w600,
),
@ -49,7 +49,7 @@ class ContributorItem extends StatelessWidget {
if (commits != null)
DefaultTextStyle(
style: TextStyle(
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
fontSize: 16,
),
child: Text('Commits: $commits'),

View File

@ -57,7 +57,7 @@
// Text(
// c.heading,
// style: TextStyle(
// color: theme.palette.tertiaryText,
// color: AntTheme.of(context).tertiaryText,
// backgroundColor: Color(0xfffafafa),
// ),
// ),
@ -79,7 +79,7 @@
// style: TextStyle(
// fontFamily: code.fontFamilyUsed,
// fontSize: 14,
// color: theme.palette.text,
// color: AntTheme.of(context).text,
// ),
// );
// }

View File

@ -1,11 +1,11 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:provider/provider.dart';
import 'package:git_touch/widgets/link.dart';
import 'package:provider/provider.dart';
class EntryItem extends StatelessWidget {
const EntryItem({
required this.text,
this.count,
@ -31,14 +31,14 @@ class EntryItem extends StatelessWidget {
style: TextStyle(
fontSize: 17,
fontWeight: FontWeight.w600,
color: theme.palette.text,
color: AntTheme.of(context).colorText,
),
),
Text(
text,
style: TextStyle(
fontSize: 14,
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
fontWeight: FontWeight.w500,
),
)

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/widgets.dart';
@ -20,7 +21,7 @@ class EventItem extends StatelessWidget {
final theme = Provider.of<ThemeModel>(context);
return TextSpan(
text: text,
style: TextStyle(color: theme.palette.primary),
style: TextStyle(color: AntTheme.of(context).colorPrimary),
recognizer: TapGestureRecognizer()
..onTap = () {
context.pushUrl(url!);
@ -65,7 +66,7 @@ class EventItem extends StatelessWidget {
TextSpan(
style: TextStyle(
fontSize: 17,
color: theme.palette.text,
color: AntTheme.of(context).colorText,
),
children: [
_buildLinkSpan(context, e.actor!.login,
@ -80,7 +81,7 @@ class EventItem extends StatelessWidget {
Text(timeago.format(e.createdAt!),
style: TextStyle(
fontSize: 14,
color: theme.palette.tertiaryText,
color: AntTheme.of(context).colorWeak,
)),
],
),
@ -102,7 +103,7 @@ class EventItem extends StatelessWidget {
spans: [
TextSpan(
text: ' ${e.type!}',
style: TextStyle(color: theme.palette.primary),
style: TextStyle(color: AntTheme.of(context).colorPrimary),
)
],
card: Text(
@ -117,15 +118,16 @@ class EventItem extends StatelessWidget {
'/github/${e.repoOwner}/${e.repoName}/compare/${e.payload!.before}/${e.payload!.head}',
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: theme.palette.grayBackground,
borderRadius: const BorderRadius.all(Radius.circular(4))),
decoration: const BoxDecoration(
color: Color(0xffcccccc),
borderRadius: BorderRadius.all(Radius.circular(4))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text.rich(
TextSpan(
style: TextStyle(color: theme.palette.text, fontSize: 15),
style: TextStyle(
color: AntTheme.of(context).colorText, fontSize: 15),
children: [
TextSpan(
text:
@ -144,7 +146,7 @@ class EventItem extends StatelessWidget {
Text(
commit.sha!.substring(0, 7),
style: TextStyle(
color: theme.palette.primary,
color: AntTheme.of(context).colorPrimary,
fontSize: 15,
fontFamily: CommonStyle.monospace,
),
@ -155,7 +157,8 @@ class EventItem extends StatelessWidget {
commit.message!,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(color: theme.palette.text, fontSize: 15),
style: TextStyle(
color: AntTheme.of(context).colorText, fontSize: 15),
),
)
],
@ -175,7 +178,7 @@ class EventItem extends StatelessWidget {
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: theme.palette.grayBackground,
color: AntTheme.of(context).colorBox,
borderRadius: const BorderRadius.all(Radius.circular(4))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -185,7 +188,7 @@ class EventItem extends StatelessWidget {
Text(
e.payload!.comment!.commitId!.substring(0, 7),
style: TextStyle(
color: theme.palette.primary,
color: AntTheme.of(context).colorPrimary,
fontSize: 15,
fontFamily: CommonStyle.monospace,
),
@ -196,7 +199,8 @@ class EventItem extends StatelessWidget {
e.payload!.comment!.body!,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(color: theme.palette.text, fontSize: 15),
style: TextStyle(
color: AntTheme.of(context).colorText, fontSize: 15),
),
)
],
@ -234,7 +238,7 @@ class EventItem extends StatelessWidget {
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: theme.palette.grayBackground,
color: AntTheme.of(context).colorBox,
borderRadius: const BorderRadius.all(Radius.circular(4))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -249,7 +253,7 @@ class EventItem extends StatelessWidget {
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 17,
color: theme.palette.text,
color: AntTheme.of(context).colorText,
),
overflow: TextOverflow.ellipsis,
),
@ -261,8 +265,9 @@ class EventItem extends StatelessWidget {
body,
overflow: TextOverflow.ellipsis,
maxLines: 3,
style:
TextStyle(color: theme.palette.secondaryText, fontSize: 15),
style: TextStyle(
color: AntTheme.of(context).colorTextSecondary,
fontSize: 15),
),
Row(
children: <Widget>[
@ -271,20 +276,20 @@ class EventItem extends StatelessWidget {
Text(issue.user!.login!,
style: TextStyle(
fontSize: 14,
color: theme.palette.tertiaryText,
color: AntTheme.of(context).colorWeak,
)),
Expanded(child: Container()),
if (issue.comments != null) ...[
Icon(
Octicons.comment,
size: 14,
color: theme.palette.tertiaryText,
color: AntTheme.of(context).colorWeak,
),
const SizedBox(width: 4),
Text(issue.comments.toString(),
style: TextStyle(
fontSize: 14,
color: theme.palette.tertiaryText,
color: AntTheme.of(context).colorWeak,
)),
]
],
@ -422,8 +427,7 @@ class EventItem extends StatelessWidget {
],
);
case 'InstallationRepositoriesEvent':
final repositoriesAdded =
e.payload!.installation!.repositoriesAdded!;
final repositoriesAdded = e.payload!.installation!.repositoriesAdded!;
final repositoriesRemoved =
e.payload!.installation!.repositoriesRemoved!;
var addedRepos = '';

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_highlight/flutter_highlight.dart';
import 'package:flutter_highlight/theme_map.dart';
@ -7,7 +8,6 @@ import 'package:git_touch/utils/utils.dart';
import 'package:provider/provider.dart';
class FilesItem extends StatelessWidget {
const FilesItem({
required this.filename,
required this.status,
@ -26,13 +26,13 @@ class FilesItem extends StatelessWidget {
final theme = Provider.of<ThemeModel>(context);
final codeProvider = Provider.of<CodeModel>(context);
return Card(
color: theme.palette.background,
color: AntTheme.of(context).colorBackground,
margin: const EdgeInsets.all(0),
child: ExpansionTile(
title: Text(
filename!,
style: TextStyle(
color: theme.palette.primary,
color: AntTheme.of(context).colorPrimary,
fontSize: 18,
fontWeight: FontWeight.w600,
),

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:from_css_color/from_css_color.dart';
import 'package:git_touch/models/theme.dart';
@ -9,7 +10,6 @@ import 'package:provider/provider.dart';
import 'package:timeago/timeago.dart' as timeago;
class GistsItem extends StatelessWidget {
const GistsItem({
required this.description,
required this.login,
@ -56,14 +56,14 @@ class GistsItem extends StatelessWidget {
text: '$login / ',
style: TextStyle(
fontSize: 18,
color: theme.palette.primary,
color: AntTheme.of(context).colorPrimary,
),
),
TextSpan(
text: filenames[0],
style: TextStyle(
fontSize: 18,
color: theme.palette.primary,
color: AntTheme.of(context).colorPrimary,
fontWeight: FontWeight.w600,
),
),
@ -78,7 +78,7 @@ class GistsItem extends StatelessWidget {
Text(
description!,
style: TextStyle(
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
fontSize: 16,
),
),
@ -89,13 +89,14 @@ class GistsItem extends StatelessWidget {
'Updated ${timeago.format(updatedAt!)}',
style: TextStyle(
fontSize: 14,
color: theme.palette.tertiaryText,
color: AntTheme.of(context).colorWeak,
),
),
const SizedBox(height: 10),
],
DefaultTextStyle(
style: TextStyle(color: theme.palette.text, fontSize: 14),
style: TextStyle(
color: AntTheme.of(context).colorText, fontSize: 14),
child: Row(
children: <Widget>[
if (language != null)

View File

@ -80,7 +80,7 @@ class IssueItem extends StatelessWidget {
TextSpan(
text: subtitle,
style: TextStyle(
color: theme.palette.tertiaryText,
color: AntTheme.of(context).colorWeak,
fontWeight: FontWeight.normal,
),
),
@ -88,7 +88,7 @@ class IssueItem extends StatelessWidget {
),
style: TextStyle(
fontSize: 17,
color: theme.palette.text,
color: AntTheme.of(context).colorText,
fontWeight: FontWeight.w600,
),
),
@ -96,7 +96,7 @@ class IssueItem extends StatelessWidget {
DefaultTextStyle(
style: TextStyle(
fontSize: 14,
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
@ -118,14 +118,15 @@ class IssueItem extends StatelessWidget {
' opened ${timeago.format(updatedAt!)}',
style: TextStyle(
fontSize: 17,
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
),
overflow: TextOverflow.ellipsis,
)),
if (commentCount! > 0) ...[
const Expanded(child: SizedBox()),
Icon(Octicons.comment,
size: 14, color: theme.palette.secondaryText),
size: 14,
color: AntTheme.of(context).colorTextSecondary),
const SizedBox(width: 3),
Text(numberFormat.format(commentCount))
],

View File

@ -40,7 +40,7 @@ class LanguageBar extends StatelessWidget {
);
},
child: Container(
// color: theme.palette.background,
// color: AntTheme.of(context).background,
padding: CommonStyle.padding.copyWith(top: 8, bottom: 8),
child: ClipRRect(
borderRadius: BorderRadius.circular(5),
@ -65,7 +65,7 @@ class LanguageBar extends StatelessWidget {
Widget _buildPopup(BuildContext context) {
final theme = Provider.of<ThemeModel>(context);
return Container(
color: theme.palette.background,
color: AntTheme.of(context).colorBackground,
padding: CommonStyle.padding,
height: 300,
child: SingleChildScrollView(
@ -87,10 +87,10 @@ class LanguageBar extends StatelessWidget {
Text(
edge.name!,
style: TextStyle(
color: theme.palette.text,
color: AntTheme.of(context).colorText,
fontSize: 18,
decoration: TextDecoration.underline,
decorationColor: theme.palette.background,
decorationColor: AntTheme.of(context).colorBackground,
),
),
]),
@ -100,10 +100,10 @@ class LanguageBar extends StatelessWidget {
child: Text(
'${(edge.ratio! * 100).toStringAsFixed(1)}%',
style: TextStyle(
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
fontSize: 18,
decoration: TextDecoration.underline,
decorationColor: theme.palette.background,
decorationColor: AntTheme.of(context).colorBackground,
),
),
),

View File

@ -1,11 +1,10 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/widgets/empty.dart';
import 'package:provider/provider.dart';
class ListGroup<T> extends StatelessWidget {
const ListGroup({
required this.title,
required this.items,
@ -21,7 +20,8 @@ class ListGroup<T> extends StatelessWidget {
final theme = Provider.of<ThemeModel>(context);
return Container(
decoration: BoxDecoration(
border: Border(top: BorderSide(color: theme.palette.border)),
border:
Border(top: BorderSide(color: AntTheme.of(context).colorBorder)),
),
child: itemBuilder(entry.value, entry.key),
);
@ -34,7 +34,7 @@ class ListGroup<T> extends StatelessWidget {
padding: padding,
child: Container(
decoration: BoxDecoration(
border: Border.all(color: theme.palette.border),
border: Border.all(color: AntTheme.of(context).colorBorder),
borderRadius: const BorderRadius.all(Radius.circular(3)),
),
child: Column(

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:git_touch/models/code.dart';
@ -100,8 +101,8 @@ class MarkdownFlutterView extends StatelessWidget {
Widget build(BuildContext context) {
final theme = Provider.of<ThemeModel>(context);
final code = Provider.of<CodeModel>(context);
final basicStyle =
TextStyle(fontSize: 16, color: theme.palette.text, height: 1.5);
final basicStyle = TextStyle(
fontSize: 16, color: AntTheme.of(context).colorText, height: 1.5);
final hStyle =
basicStyle.copyWith(fontWeight: FontWeight.w600, height: 1.25);
@ -157,10 +158,10 @@ class MarkdownFlutterView extends StatelessWidget {
launchStringUrl(url);
},
styleSheet: MarkdownStyleSheet(
a: basicStyle.copyWith(color: theme.palette.primary),
a: basicStyle.copyWith(color: AntTheme.of(context).colorPrimary),
p: basicStyle,
code: basicStyle.copyWith(
backgroundColor: theme.palette.grayBackground,
backgroundColor: AntTheme.of(context).colorBox,
fontSize: 16 * 0.85,
height: 1.45,
fontFamily: code.fontStyle.fontFamily,
@ -171,11 +172,12 @@ class MarkdownFlutterView extends StatelessWidget {
h4: hStyle,
h5: hStyle.copyWith(fontSize: 14),
h6: hStyle.copyWith(
fontSize: 16 * 0.85, color: theme.palette.tertiaryText),
fontSize: 16 * 0.85, color: AntTheme.of(context).colorWeak),
em: basicStyle.copyWith(fontStyle: FontStyle.italic),
strong: basicStyle.copyWith(fontWeight: FontWeight.w600),
del: const TextStyle(decoration: TextDecoration.lineThrough),
blockquote: basicStyle.copyWith(color: theme.palette.tertiaryText),
blockquote:
basicStyle.copyWith(color: AntTheme.of(context).colorWeak),
img: basicStyle,
checkbox: basicStyle,
blockSpacing: 16,
@ -194,14 +196,14 @@ class MarkdownFlutterView extends StatelessWidget {
),
codeblockPadding: const EdgeInsets.all(16),
codeblockDecoration: BoxDecoration(
color: theme.palette.grayBackground,
color: AntTheme.of(context).colorBox,
borderRadius: BorderRadius.circular(3),
),
horizontalRuleDecoration: BoxDecoration(
border: Border(
top: BorderSide(
width: 4,
color: theme.palette.grayBackground,
color: AntTheme.of(context).colorBox,
),
),
),

View File

@ -1,15 +1,14 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/github.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/issue_icon.dart';
import 'package:git_touch/widgets/link.dart';
import 'package:provider/provider.dart';
import 'package:git_touch/models/theme.dart';
class NotificationItem extends StatefulWidget {
const NotificationItem({
Key? key,
required this.payload,
@ -68,8 +67,9 @@ class _NotificationItemState extends State<NotificationItem> {
final theme = Provider.of<ThemeModel>(context);
return Icon(
payload.unread! ? Ionicons.checkmark : Octicons.dot_fill,
color:
loading ? theme.palette.grayBackground : theme.palette.tertiaryText,
color: loading
? AntTheme.of(context).colorBox
: AntTheme.of(context).colorWeak,
size: 24,
);
}
@ -133,7 +133,8 @@ class _NotificationItemState extends State<NotificationItem> {
child: Text(
payload.subject!.title!,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 15, color: theme.palette.text),
style: TextStyle(
fontSize: 15, color: AntTheme.of(context).colorText),
),
),
LinkWidget(onTap: _markAsRead, child: _buildCheckIcon()),

View File

@ -47,7 +47,7 @@ class ReleaseItem extends StatelessWidget {
Text(
tagName!,
style: TextStyle(
color: theme.palette.primary,
color: AntTheme.of(context).colorPrimary,
fontSize: 18,
fontWeight: FontWeight.w600,
),
@ -57,7 +57,7 @@ class ReleaseItem extends StatelessWidget {
const SizedBox(height: 6),
DefaultTextStyle(
style: TextStyle(
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
fontSize: 16,
),
child: Text(
@ -74,13 +74,13 @@ class ReleaseItem extends StatelessWidget {
const SizedBox(height: 10),
],
Card(
color: theme.palette.grayBackground,
color: AntTheme.of(context).colorBox,
margin: const EdgeInsets.all(0),
child: ExpansionTile(
title: Text(
'Assets (${releaseAssets?.nodes?.length ?? 0})',
style: TextStyle(
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
fontSize: 18,
fontWeight: FontWeight.w600,
),
@ -101,7 +101,7 @@ class ReleaseItem extends StatelessWidget {
child: Text(
asset.name,
style: TextStyle(
color: theme.palette.primary,
color: AntTheme.of(context).colorPrimary,
fontSize: 14,
fontWeight: FontWeight.w400,
),

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/utils/utils.dart';
@ -47,7 +48,7 @@ class RepoHeader extends StatelessWidget {
'$owner / $name',
style: TextStyle(
fontSize: 20,
color: theme.palette.primary,
color: AntTheme.of(context).colorPrimary,
),
overflow: TextOverflow.visible,
),
@ -59,7 +60,7 @@ class RepoHeader extends StatelessWidget {
Text(
description!,
style: TextStyle(
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
fontSize: 17,
),
),
@ -69,7 +70,7 @@ class RepoHeader extends StatelessWidget {
child: Text(
homepageUrl!,
style: TextStyle(
color: theme.palette.primary,
color: AntTheme.of(context).colorPrimary,
fontSize: 17,
),
),

View File

@ -165,14 +165,14 @@ class RepositoryItem extends StatelessWidget {
text: '$owner / ',
style: TextStyle(
fontSize: 18,
color: theme.palette.primary,
color: AntTheme.of(context).colorPrimary,
),
),
TextSpan(
text: name,
style: TextStyle(
fontSize: 18,
color: theme.palette.primary,
color: AntTheme.of(context).colorPrimary,
fontWeight: FontWeight.w600,
),
// overflow: TextOverflow.ellipsis,
@ -184,9 +184,10 @@ class RepositoryItem extends StatelessWidget {
if (iconData != null) ...[
const SizedBox(width: 6),
DefaultTextStyle(
style: TextStyle(color: theme.palette.secondaryText),
style:
TextStyle(color: AntTheme.of(context).colorTextSecondary),
child: Icon(iconData,
size: 18, color: theme.palette.secondaryText),
size: 18, color: AntTheme.of(context).colorTextSecondary),
),
]
],
@ -196,7 +197,7 @@ class RepositoryItem extends StatelessWidget {
Text(
description!,
style: TextStyle(
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
fontSize: 16,
),
),
@ -207,13 +208,14 @@ class RepositoryItem extends StatelessWidget {
note!,
style: TextStyle(
fontSize: 14,
color: theme.palette.tertiaryText,
color: AntTheme.of(context).colorWeak,
),
),
const SizedBox(height: 10),
],
DefaultTextStyle(
style: TextStyle(color: theme.palette.text, fontSize: 14),
style:
TextStyle(color: AntTheme.of(context).colorText, fontSize: 14),
child: Row(
children: <Widget>[
if (primaryLanguageName != null) ...[
@ -234,14 +236,15 @@ class RepositoryItem extends StatelessWidget {
const SizedBox(width: 24),
],
if (starCount! > 0) ...[
Icon(Octicons.star, size: 16, color: theme.palette.text),
Icon(Octicons.star,
size: 16, color: AntTheme.of(context).colorText),
const SizedBox(width: 2),
Text(numberFormat.format(starCount)),
const SizedBox(width: 24),
],
if (forkCount! > 0) ...[
Icon(Octicons.repo_forked,
size: 16, color: theme.palette.text),
size: 16, color: AntTheme.of(context).colorText),
const SizedBox(width: 2),
Text(numberFormat.format(forkCount)),
],

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart';
import 'package:git_touch/models/theme.dart';
import 'package:provider/provider.dart';
@ -14,7 +15,7 @@ class MyTextField extends StatelessWidget {
return CupertinoTextField(
controller: controller,
placeholder: placeholder,
style: TextStyle(color: theme.palette.text),
style: TextStyle(color: AntTheme.of(context).colorText),
);
}
}

View File

@ -40,7 +40,8 @@ class TimelineEventItem extends StatelessWidget {
Expanded(
child: Text.rich(
TextSpan(
style: TextStyle(color: theme.palette.text, fontSize: 16),
style: TextStyle(
color: AntTheme.of(context).colorText, fontSize: 16),
children: [
// TODO: actor is null
createUserSpan(context, actor),
@ -415,12 +416,12 @@ class TimelineItem extends StatelessWidget {
' ${AppLocalizations.of(context)!.headRefForcedPushedEventSecondMessage} '),
TextSpan(
text: p.beforeCommit!.oid.substring(0, 7),
style: TextStyle(color: theme.palette.primary),
style: TextStyle(color: AntTheme.of(context).colorPrimary),
),
TextSpan(text: ' ${AppLocalizations.of(context)!.to} '),
TextSpan(
text: p.afterCommit!.oid.substring(0, 7),
style: TextStyle(color: theme.palette.primary),
style: TextStyle(color: AntTheme.of(context).colorPrimary),
),
],
),
@ -441,12 +442,12 @@ class TimelineItem extends StatelessWidget {
' ${AppLocalizations.of(context)!.headRefForcedPushedEventSecondMessage} '),
TextSpan(
text: p.beforeCommit!.oid.substring(0, 7),
style: TextStyle(color: theme.palette.primary),
style: TextStyle(color: AntTheme.of(context).colorPrimary),
),
TextSpan(text: ' ${AppLocalizations.of(context)!.to} '),
TextSpan(
text: p.afterCommit!.oid.substring(0, 7),
style: TextStyle(color: theme.palette.primary),
style: TextStyle(color: AntTheme.of(context).colorPrimary),
),
],
),

View File

@ -1,3 +1,4 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/utils/utils.dart';
@ -57,7 +58,7 @@ class UserHeader extends StatelessWidget {
Text(
name!,
style: TextStyle(
color: theme.palette.text,
color: AntTheme.of(context).colorText,
fontSize: 20,
fontWeight: FontWeight.w600,
),
@ -67,7 +68,7 @@ class UserHeader extends StatelessWidget {
Text(
login!,
style: TextStyle(
color: theme.palette.primary,
color: AntTheme.of(context).colorPrimary,
fontSize: 18,
),
),
@ -78,13 +79,13 @@ class UserHeader extends StatelessWidget {
Icon(
Octicons.clock,
size: 16,
color: theme.palette.tertiaryText,
color: AntTheme.of(context).colorWeak,
),
const SizedBox(width: 4),
Text(
'Joined on ${dateFormat.format(createdAt!)}',
style: TextStyle(
color: theme.palette.tertiaryText,
color: AntTheme.of(context).colorWeak,
fontSize: 16,
),
),
@ -95,7 +96,7 @@ class UserHeader extends StatelessWidget {
Text(
bio!,
style: TextStyle(
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
fontSize: 17,
),
)

View File

@ -28,7 +28,7 @@ class GhBioWidget extends StatelessWidget {
Icon(
Octicons.location,
size: 15,
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
),
const SizedBox(width: 4),
Expanded(child: Text(location!, overflow: TextOverflow.ellipsis)),
@ -40,7 +40,7 @@ class GhBioWidget extends StatelessWidget {
Icon(
Octicons.clock,
size: 15,
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
),
const SizedBox(width: 4),
Expanded(
@ -146,7 +146,7 @@ class UserItem extends StatelessWidget {
Text(
name!,
style: TextStyle(
color: theme.palette.text,
color: AntTheme.of(context).colorText,
fontSize: 18,
fontWeight: FontWeight.w500,
),
@ -157,7 +157,7 @@ class UserItem extends StatelessWidget {
child: Text(
login!,
style: TextStyle(
color: theme.palette.text,
color: AntTheme.of(context).colorText,
fontSize: 16,
),
overflow: TextOverflow.ellipsis,
@ -169,7 +169,7 @@ class UserItem extends StatelessWidget {
if (bio != null)
DefaultTextStyle(
style: TextStyle(
color: theme.palette.secondaryText,
color: AntTheme.of(context).colorTextSecondary,
fontSize: 16,
),
child: bio!,

View File

@ -1,10 +1,10 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/widgets/link.dart';
import 'package:provider/provider.dart';
class UserName extends StatelessWidget {
const UserName(this.login, this.prefix);
final String? login;
final String prefix;
@ -23,7 +23,7 @@ class UserName extends StatelessWidget {
login!,
style: TextStyle(
fontWeight: FontWeight.w600,
color: theme.palette.primary,
color: AntTheme.of(context).colorPrimary,
),
),
),