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