fix (theme color): replaced all 'AppConfig.primaryColor' parts and added casts where needed
This commit is contained in:
parent
e1b817a14d
commit
91000fd24b
25 changed files with 66 additions and 55 deletions
|
|
@ -65,7 +65,9 @@ abstract class FluffyThemes {
|
|||
]) {
|
||||
final colorScheme = ColorScheme.fromSeed(
|
||||
brightness: brightness,
|
||||
seedColor: seed ?? AppConfig.colorSchemeSeed ?? AppConfig.primaryColor,
|
||||
seedColor: seed ??
|
||||
AppConfig.colorSchemeSeed ??
|
||||
Theme.of(context).colorScheme.primary,
|
||||
);
|
||||
final isColumnMode = FluffyThemes.isColumnMode(context);
|
||||
return ThemeData(
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ class HtmlMessage extends StatelessWidget {
|
|||
|
||||
Color backgroundColor = Colors.transparent;
|
||||
if (selected) {
|
||||
backgroundColor = AppConfig.primaryColor.withAlpha(80);
|
||||
backgroundColor = Theme.of(context).colorScheme.primary.withAlpha(80);
|
||||
} else if (isSelected != null && shouldDo) {
|
||||
backgroundColor = !didMeaningActivity
|
||||
? AppConfig.success.withAlpha(60)
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ class AnalyticsDetailsViewContent extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Color textColor = Theme.of(context).brightness != Brightness.light
|
||||
final Color textColor = (Theme.of(context).brightness != Brightness.light
|
||||
? construct.lemmaCategory.color
|
||||
: construct.lemmaCategory.darkColor;
|
||||
: construct.lemmaCategory.darkColor) as Color;
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ class LemmaUsageDots extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
|
||||
final Color textColor = Theme.of(context).brightness != Brightness.light
|
||||
final Color textColor = (Theme.of(context).brightness != Brightness.light
|
||||
? construct.lemmaCategory.color
|
||||
: construct.lemmaCategory.darkColor;
|
||||
: construct.lemmaCategory.darkColor) as Color;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 20),
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class LemmaUseExampleMessages extends StatelessWidget {
|
|||
children: snapshot.data!.map((example) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: construct.lemmaCategory.color,
|
||||
color: construct.lemmaCategory.color(context),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class MorphFeatureBox extends StatelessWidget {
|
|||
border: Border.all(
|
||||
color: Theme.of(context).brightness == Brightness.dark
|
||||
? AppConfig.primaryColorLight
|
||||
: AppConfig.primaryColor,
|
||||
: Theme.of(context).colorScheme.primary,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
|
|
@ -211,7 +211,7 @@ class MorphTagChip extends StatelessWidget {
|
|||
end: Alignment.centerRight,
|
||||
colors: <Color>[
|
||||
Colors.transparent,
|
||||
constructAnalytics.lemmaCategory.color,
|
||||
constructAnalytics.lemmaCategory.color(context),
|
||||
],
|
||||
)
|
||||
: null,
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ class MorphDetailsView extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Color textColor = Theme.of(context).brightness != Brightness.light
|
||||
? _construct.lemmaCategory.color
|
||||
: _construct.lemmaCategory.darkColor;
|
||||
? _construct.lemmaCategory.color(context)
|
||||
: _construct.lemmaCategory.darkColor(context);
|
||||
|
||||
return AnalyticsDetailsViewContent(
|
||||
title:
|
||||
|
|
|
|||
|
|
@ -68,9 +68,9 @@ class VocabDetailsView extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Color textColor = Theme.of(context).brightness != Brightness.light
|
||||
final Color textColor = (Theme.of(context).brightness != Brightness.light
|
||||
? _construct.lemmaCategory.color
|
||||
: _construct.lemmaCategory.darkColor;
|
||||
: _construct.lemmaCategory.darkColor) as Color;
|
||||
|
||||
return AnalyticsDetailsViewContent(
|
||||
title: Row(
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class VocabAnalyticsListTileState extends State<VocabAnalyticsListTile> {
|
|||
padding: EdgeInsets.all(padding),
|
||||
decoration: BoxDecoration(
|
||||
color: _isHovered
|
||||
? widget.constructUse.constructLevel.color.withAlpha(30)
|
||||
? widget.constructUse.constructLevel.color(context)
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||
),
|
||||
|
|
@ -71,7 +71,7 @@ class VocabAnalyticsListTileState extends State<VocabAnalyticsListTile> {
|
|||
maxWidth: maxWidth - padding * 2,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: widget.constructUse.constructLevel.color,
|
||||
color: widget.constructUse.constructLevel.color(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -16,11 +16,13 @@ class TextLoadingShimmer extends StatelessWidget {
|
|||
return Shimmer.fromColors(
|
||||
baseColor: Colors.transparent, // Base color of the shimmer effect
|
||||
// for higlight, use white with 50 opacity
|
||||
highlightColor: AppConfig.primaryColor.withAlpha(70),
|
||||
highlightColor: Theme.of(context).colorScheme.primary.withAlpha(70),
|
||||
child: Container(
|
||||
height: AppConfig.messageFontSize * AppConfig.fontSizeFactor,
|
||||
width: width, // Width of the rectangle
|
||||
color: AppConfig.primaryColor, // Background color of the rectangle
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary, // Background color of the rectangle
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class CardHeader extends StatelessWidget {
|
|||
},
|
||||
color: Theme.of(context).brightness == Brightness.dark
|
||||
? AppConfig.primaryColorLight
|
||||
: AppConfig.primaryColor,
|
||||
: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pages/chat/chat.dart';
|
||||
import 'package:fluffychat/pangea/bot/utils/bot_style.dart';
|
||||
import 'package:fluffychat/pangea/bot/widgets/bot_face_svg.dart';
|
||||
|
|
@ -62,7 +61,7 @@ class PaywallCard extends StatelessWidget {
|
|||
},
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all<Color>(
|
||||
(AppConfig.primaryColor).withAlpha(25),
|
||||
(Theme.of(context).colorScheme.primary).withAlpha(25),
|
||||
),
|
||||
),
|
||||
child: Text(L10n.of(context).activateTrial),
|
||||
|
|
@ -80,7 +79,7 @@ class PaywallCard extends StatelessWidget {
|
|||
},
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all<Color>(
|
||||
(AppConfig.primaryColor).withAlpha(25),
|
||||
(Theme.of(context).colorScheme.primary).withAlpha(25),
|
||||
),
|
||||
),
|
||||
child: Text(L10n.of(context).getAccess),
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ class WordMatchContent extends StatelessWidget {
|
|||
child: TextButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all<Color>(
|
||||
AppConfig.primaryColor.withAlpha(25),
|
||||
Theme.of(context).colorScheme.primary.withAlpha(25),
|
||||
),
|
||||
),
|
||||
onPressed: controller.onIgnoreMatch,
|
||||
|
|
@ -359,7 +359,7 @@ class WordMatchContent extends StatelessWidget {
|
|||
backgroundColor: WidgetStateProperty.all<Color>(
|
||||
(controller.selectedChoice != null
|
||||
? controller.selectedChoice!.color
|
||||
: AppConfig.primaryColor)
|
||||
: Theme.of(context).colorScheme.primary)
|
||||
.withAlpha(50),
|
||||
),
|
||||
// Outline if Replace button enabled
|
||||
|
|
@ -390,7 +390,8 @@ class WordMatchContent extends StatelessWidget {
|
|||
},
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all<Color>(
|
||||
(AppConfig.primaryColor).withAlpha(25),
|
||||
(Theme.of(context).colorScheme.primary)
|
||||
.withAlpha(25),
|
||||
),
|
||||
),
|
||||
child: Text(L10n.of(context).helpMeTranslate),
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ import 'package:flutter/material.dart';
|
|||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
import '../../../../config/app_config.dart';
|
||||
|
||||
class WhyButton extends StatelessWidget {
|
||||
const WhyButton({
|
||||
super.key,
|
||||
|
|
@ -20,13 +18,15 @@ class WhyButton extends StatelessWidget {
|
|||
onPressed: loading ? null : onPress,
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all<Color>(
|
||||
AppConfig.primaryColor.withAlpha(25),
|
||||
Theme.of(context).colorScheme.primary.withAlpha(25),
|
||||
),
|
||||
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10), // Border radius
|
||||
side: const BorderSide(
|
||||
color: AppConfig.primaryColor, // Replace with your color
|
||||
side: BorderSide(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary, // Replace with your color
|
||||
style: BorderStyle.solid,
|
||||
width: 2.0,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ import 'dart:ui';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
|
||||
class ItShimmer extends StatelessWidget {
|
||||
const ItShimmer({
|
||||
super.key,
|
||||
|
|
@ -77,7 +75,7 @@ class ITShimmerElement extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
backgroundColor: WidgetStateProperty.all<Color>(
|
||||
AppConfig.primaryColor.withAlpha(50),
|
||||
Theme.of(context).colorScheme.primary.withAlpha(50),
|
||||
),
|
||||
),
|
||||
onPressed: () {},
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import 'package:flutter/material.dart';
|
|||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pangea/choreographer/controllers/choreographer.dart';
|
||||
import 'package:fluffychat/pangea/common/utils/error_handler.dart';
|
||||
import 'package:fluffychat/pangea/learning_settings/pages/settings_learning.dart';
|
||||
|
|
@ -48,7 +47,7 @@ class LanguagePermissionsButtons extends StatelessWidget {
|
|||
if (copy.description != null)
|
||||
TextSpan(
|
||||
text: copy.description,
|
||||
style: const TextStyle(color: AppConfig.primaryColor),
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.primary),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
showDialog(
|
||||
|
|
|
|||
|
|
@ -11,11 +11,15 @@ enum ConstructLevelEnum {
|
|||
}
|
||||
|
||||
extension ConstructLevelEnumExt on ConstructLevelEnum {
|
||||
Color get color {
|
||||
Color color(BuildContext context) {
|
||||
switch (this) {
|
||||
case ConstructLevelEnum.flowers:
|
||||
return Color.lerp(AppConfig.primaryColor, Colors.white, 0.6) ??
|
||||
AppConfig.primaryColor;
|
||||
return Color.lerp(
|
||||
Theme.of(context).colorScheme.primary,
|
||||
Colors.white,
|
||||
0.6,
|
||||
) ??
|
||||
Theme.of(context).colorScheme.primary;
|
||||
case ConstructLevelEnum.greens:
|
||||
return Color.lerp(AppConfig.success, Colors.white, 0.6) ??
|
||||
AppConfig.success;
|
||||
|
|
@ -24,11 +28,15 @@ extension ConstructLevelEnumExt on ConstructLevelEnum {
|
|||
}
|
||||
}
|
||||
|
||||
Color get darkColor {
|
||||
Color darkColor(BuildContext context) {
|
||||
switch (this) {
|
||||
case ConstructLevelEnum.flowers:
|
||||
return Color.lerp(AppConfig.primaryColor, Colors.white, 0.3) ??
|
||||
AppConfig.primaryColor;
|
||||
return Color.lerp(
|
||||
Theme.of(context).colorScheme.primary,
|
||||
Colors.white,
|
||||
0.3,
|
||||
) ??
|
||||
Theme.of(context).colorScheme.primary;
|
||||
case ConstructLevelEnum.greens:
|
||||
return Color.lerp(AppConfig.success, Colors.black, 0.3) ??
|
||||
AppConfig.success;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class SubscriptionCard extends StatelessWidget {
|
|||
final ButtonStyle buttonStyle = OutlinedButton.styleFrom(
|
||||
side: enabled ? null : BorderSide(color: Colors.grey[600]!),
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: AppConfig.primaryColor,
|
||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||
disabledForegroundColor: const Color.fromARGB(255, 200, 200, 200),
|
||||
disabledBackgroundColor: Colors.grey[600],
|
||||
);
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
|
||||
void showSubscribedSnackbar(BuildContext context) {
|
||||
final Widget text = RichText(
|
||||
text: TextSpan(
|
||||
|
|
@ -21,7 +19,7 @@ void showSubscribedSnackbar(BuildContext context) {
|
|||
const TextSpan(text: " "),
|
||||
TextSpan(
|
||||
text: L10n.of(context).clickToManageSubscription,
|
||||
style: const TextStyle(color: AppConfig.primaryColor),
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.primary),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () => context.go('/rooms/settings/subscription'),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -49,9 +49,15 @@ class MessageEmojiChoiceItemState extends State<MessageEmojiChoiceItem> {
|
|||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: widget.isSelected
|
||||
? AppConfig.primaryColor.withAlpha((0.2 * 255).toInt())
|
||||
? Theme.of(context)
|
||||
.colorScheme
|
||||
.primary
|
||||
.withAlpha((0.2 * 255).toInt())
|
||||
: _isHovered
|
||||
? AppConfig.primaryColor.withAlpha((0.1 * 255).toInt())
|
||||
? Theme.of(context)
|
||||
.colorScheme
|
||||
.primary
|
||||
.withAlpha((0.1 * 255).toInt())
|
||||
: widget.greenHighlight
|
||||
? AppConfig.success.withAlpha((0.1 * 255).toInt())
|
||||
: Colors.transparent,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pangea/analytics_misc/construct_type_enum.dart';
|
||||
import 'package:fluffychat/pangea/analytics_misc/construct_use_type_enum.dart';
|
||||
import 'package:fluffychat/pangea/analytics_misc/constructs_model.dart';
|
||||
|
|
@ -104,7 +103,7 @@ class WordEmojiChoiceState extends State<WordEmojiChoice> {
|
|||
.map(
|
||||
(emoji) => Choice(
|
||||
color: localSelected == emoji
|
||||
? AppConfig.primaryColor
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Colors.transparent,
|
||||
text: emoji,
|
||||
isGold: localSelected == emoji,
|
||||
|
|
|
|||
|
|
@ -226,7 +226,8 @@ class MessageTextWidget extends StatelessWidget {
|
|||
Color backgroundColor = Colors.transparent;
|
||||
if (!hideTokenHighlights) {
|
||||
if (tokenPosition.selected) {
|
||||
backgroundColor = AppConfig.primaryColor.withAlpha(80);
|
||||
backgroundColor =
|
||||
Theme.of(context).colorScheme.primary.withAlpha(80);
|
||||
} else if (isSelected != null && shouldDo) {
|
||||
backgroundColor = !didMeaningActivity
|
||||
? AppConfig.success.withAlpha(60)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pangea/bot/utils/bot_style.dart';
|
||||
import 'package:fluffychat/pangea/toolbar/widgets/message_selection_overlay.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
|
|
@ -41,7 +40,7 @@ class MessageUnsubscribedCard extends StatelessWidget {
|
|||
},
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all<Color>(
|
||||
(AppConfig.primaryColor).withAlpha(25),
|
||||
(Theme.of(context).colorScheme.primary).withAlpha(25),
|
||||
),
|
||||
),
|
||||
child: Text(L10n.of(context).activateTrial),
|
||||
|
|
@ -59,7 +58,7 @@ class MessageUnsubscribedCard extends StatelessWidget {
|
|||
},
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all<Color>(
|
||||
(AppConfig.primaryColor).withAlpha(25),
|
||||
(Theme.of(context).colorScheme.primary).withAlpha(25),
|
||||
),
|
||||
),
|
||||
child: Text(L10n.of(context).getAccess),
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import 'package:flutter/material.dart';
|
|||
import 'package:android_intent_plus/android_intent.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
|
||||
|
|
@ -36,7 +35,7 @@ class MissingVoiceButton extends StatelessWidget {
|
|||
return TextButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all<Color>(
|
||||
AppConfig.primaryColor.withAlpha(25),
|
||||
Theme.of(context).colorScheme.primary.withAlpha(25),
|
||||
),
|
||||
),
|
||||
onPressed: () async {
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ class MorphFocusWidgetState extends State<MorphFocusWidget> {
|
|||
onDoubleTap: enterEditMode,
|
||||
child: MorphTagDisplay(
|
||||
morphFeature: widget.morphFeature,
|
||||
textColor: id.constructUses.lemmaCategory.color,
|
||||
textColor: id.constructUses.lemmaCategory.color(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue