fix: theme usage
This commit is contained in:
parent
d8f38d34aa
commit
073af6f492
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:antd_mobile/antd_mobile.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||||
import 'package:git_touch/models/auth.dart';
|
import 'package:git_touch/models/auth.dart';
|
||||||
|
@ -53,7 +54,10 @@ class MyApp extends StatelessWidget {
|
||||||
routeInformationProvider: router.routeInformationProvider,
|
routeInformationProvider: router.routeInformationProvider,
|
||||||
routeInformationParser: router.routeInformationParser,
|
routeInformationParser: router.routeInformationParser,
|
||||||
routerDelegate: router.routerDelegate,
|
routerDelegate: router.routerDelegate,
|
||||||
theme: CupertinoThemeData(brightness: theme.brightness),
|
theme: CupertinoThemeData(
|
||||||
|
brightness: theme.brightness,
|
||||||
|
primaryColor: AntTheme.of(context).colorPrimary,
|
||||||
|
),
|
||||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||||
supportedLocales: AppLocalizations.supportedLocales,
|
supportedLocales: AppLocalizations.supportedLocales,
|
||||||
localeListResolutionCallback: localeListResolutionCallback,
|
localeListResolutionCallback: localeListResolutionCallback,
|
||||||
|
|
|
@ -5,9 +5,13 @@ import 'package:ferry/ferry.dart';
|
||||||
import 'package:fimber/fimber.dart';
|
import 'package:fimber/fimber.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
import 'package:git_touch/models/account.dart';
|
||||||
import 'package:git_touch/models/bitbucket.dart';
|
import 'package:git_touch/models/bitbucket.dart';
|
||||||
import 'package:git_touch/models/gitea.dart';
|
import 'package:git_touch/models/gitea.dart';
|
||||||
import 'package:git_touch/models/gitee.dart';
|
import 'package:git_touch/models/gitee.dart';
|
||||||
|
import 'package:git_touch/models/gitlab.dart';
|
||||||
|
import 'package:git_touch/models/gogs.dart';
|
||||||
|
import 'package:git_touch/utils/utils.dart';
|
||||||
import 'package:github/github.dart';
|
import 'package:github/github.dart';
|
||||||
import 'package:gql_http_link/gql_http_link.dart';
|
import 'package:gql_http_link/gql_http_link.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
@ -18,11 +22,6 @@ import 'package:uni_links/uni_links.dart';
|
||||||
import 'package:universal_io/io.dart';
|
import 'package:universal_io/io.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
import 'package:git_touch/utils/utils.dart';
|
|
||||||
import 'package:git_touch/models/account.dart';
|
|
||||||
import 'package:git_touch/models/gitlab.dart';
|
|
||||||
import 'package:git_touch/models/gogs.dart';
|
|
||||||
|
|
||||||
const clientId = 'df930d7d2e219f26142a';
|
const clientId = 'df930d7d2e219f26142a';
|
||||||
|
|
||||||
class PlatformType {
|
class PlatformType {
|
||||||
|
|
|
@ -58,14 +58,10 @@ class SelectorItem<T> {
|
||||||
class StaticRoute extends PageRouteBuilder {
|
class StaticRoute extends PageRouteBuilder {
|
||||||
StaticRoute({this.builder})
|
StaticRoute({this.builder})
|
||||||
: super(
|
: super(
|
||||||
pageBuilder: (context, animation,
|
pageBuilder: (context, animation, secondaryAnimation) {
|
||||||
secondaryAnimation) {
|
|
||||||
return builder!(context);
|
return builder!(context);
|
||||||
},
|
},
|
||||||
transitionsBuilder: (context,
|
transitionsBuilder: (context, animation, secondaryAnimation, child) {
|
||||||
animation,
|
|
||||||
secondaryAnimation,
|
|
||||||
child) {
|
|
||||||
return child;
|
return child;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -335,7 +331,8 @@ class ThemeModel with ChangeNotifier {
|
||||||
AntActionSheetAction(
|
AntActionSheetAction(
|
||||||
text: Text(
|
text: Text(
|
||||||
item.text!,
|
item.text!,
|
||||||
style: TextStyle(color: item.danger ? AntTheme.danger : null),
|
style: TextStyle(
|
||||||
|
color: item.danger ? AntTheme.of(context).colorDanger : null),
|
||||||
),
|
),
|
||||||
onClick: () {
|
onClick: () {
|
||||||
item.onTap?.call(context);
|
item.onTap?.call(context);
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import 'package:antd_mobile/antd_mobile.dart';
|
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:git_touch/models/theme.dart';
|
import 'package:git_touch/models/theme.dart';
|
||||||
|
@ -47,13 +46,14 @@ class CommonStyle {
|
||||||
static final monospace = Platform.isIOS ? 'Menlo' : 'monospace'; // FIXME:
|
static final monospace = Platform.isIOS ? 'Menlo' : 'monospace'; // FIXME:
|
||||||
}
|
}
|
||||||
|
|
||||||
Color getFontColorByBrightness(Color color) {
|
// TODO:
|
||||||
final grayscale = color.red * 0.3 + color.green * 0.59 + color.blue * 0.11;
|
// Color getFontColorByBrightness(Color color) {
|
||||||
// Fimber.d('color: $color, $grayscale');
|
// var grayscale = color.red * 0.3 + color.green * 0.59 + color.blue * 0.11;
|
||||||
|
// // Fimber.d('color: $color, $grayscale');
|
||||||
|
|
||||||
final showWhite = grayscale < 128;
|
// var showWhite = grayscale < 128;
|
||||||
return showWhite ? AntTheme.white : AntTheme.text;
|
// return showWhite ? AntTheme.of(context).white : AntTheme.of(context).text;
|
||||||
}
|
// }
|
||||||
|
|
||||||
TextSpan createLinkSpan(
|
TextSpan createLinkSpan(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
|
@ -89,11 +89,6 @@ class GithubPalette {
|
||||||
// final pageSize = 5;
|
// final pageSize = 5;
|
||||||
const PAGE_SIZE = 30;
|
const PAGE_SIZE = 30;
|
||||||
|
|
||||||
var createWarning =
|
|
||||||
(text) => Text(text, style: const TextStyle(color: AntTheme.danger));
|
|
||||||
var warningSpan =
|
|
||||||
const TextSpan(text: 'xxx', style: TextStyle(color: AntTheme.danger));
|
|
||||||
|
|
||||||
List<T> join<T>(T seperator, List<T> xs) {
|
List<T> join<T>(T seperator, List<T> xs) {
|
||||||
final result = <T>[];
|
final result = <T>[];
|
||||||
xs.asMap().forEach((index, x) {
|
xs.asMap().forEach((index, x) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ class BranchName extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AntTag(
|
return AntTag(
|
||||||
fill: AntTagFill.outline,
|
fill: AntTagFill.outline,
|
||||||
color: AntTheme.primary,
|
color: AntTheme.of(context).colorPrimary,
|
||||||
round: true,
|
round: true,
|
||||||
child: Text(name),
|
child: Text(name),
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,7 +2,6 @@ import 'package:antd_mobile/antd_mobile.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
class MutationButton extends StatelessWidget {
|
class MutationButton extends StatelessWidget {
|
||||||
|
|
||||||
const MutationButton({
|
const MutationButton({
|
||||||
super.key,
|
super.key,
|
||||||
this.active = false,
|
this.active = false,
|
||||||
|
@ -16,7 +15,7 @@ class MutationButton extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AntButton(
|
return AntButton(
|
||||||
color: AntTheme.primary,
|
color: AntTheme.of(context).colorPrimary,
|
||||||
fill: active ? AntButtonFill.solid : AntButtonFill.outline,
|
fill: active ? AntButtonFill.solid : AntButtonFill.outline,
|
||||||
shape: AntButtonShape.rounded,
|
shape: AntButtonShape.rounded,
|
||||||
onClick: onTap,
|
onClick: onTap,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'dart:core';
|
import 'dart:core';
|
||||||
|
|
||||||
|
import 'package:antd_mobile/antd_mobile.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||||
import 'package:git_touch/graphql/__generated__/github.data.gql.dart';
|
import 'package:git_touch/graphql/__generated__/github.data.gql.dart';
|
||||||
|
@ -301,17 +302,24 @@ class TimelineItem extends StatelessWidget {
|
||||||
return Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
TimelineEventItem(
|
TimelineEventItem(
|
||||||
actor: p.author!.login,
|
actor: p.author!.login,
|
||||||
iconColor: GithubPalette.open,
|
iconColor: GithubPalette.open,
|
||||||
iconData: Octicons.check,
|
iconData: Octicons.check,
|
||||||
textSpan: p.state == GPullRequestReviewState.APPROVED
|
textSpan: p.state == GPullRequestReviewState.APPROVED
|
||||||
? TextSpan(
|
? TextSpan(
|
||||||
text:
|
text: ' ${AppLocalizations.of(context)!.approvedChanges}',
|
||||||
' ${AppLocalizations.of(context)!.approvedChanges}')
|
)
|
||||||
: p.state == GPullRequestReviewState.COMMENTED
|
: p.state == GPullRequestReviewState.COMMENTED
|
||||||
? TextSpan(
|
? TextSpan(
|
||||||
text: ' ${AppLocalizations.of(context)!.reviewed} ')
|
text: ' ${AppLocalizations.of(context)!.reviewed} ',
|
||||||
: warningSpan),
|
)
|
||||||
|
: TextSpan(
|
||||||
|
text: 'xxx', // TODO:
|
||||||
|
style: TextStyle(
|
||||||
|
color: AntTheme.of(context).colorDanger,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
Container(
|
Container(
|
||||||
padding: CommonStyle.padding.copyWith(left: 50),
|
padding: CommonStyle.padding.copyWith(left: 50),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|
Loading…
Reference in New Issue