From 7e9dc022eb48b3e466a2f2dc6851299fe9d21960 Mon Sep 17 00:00:00 2001 From: ggurdin <46800240+ggurdin@users.noreply.github.com> Date: Fri, 27 Dec 2024 14:44:54 -0500 Subject: [PATCH] make pressable button more visbile in dark mode, make main menu indicators into pressable buttons (#1315) --- .../chat/message_speech_to_text_card.dart | 5 +- .../learning_settings_button.dart | 19 ++--- .../analytics_summary/level_badge.dart | 75 ++++++++++--------- .../analytics_summary/progress_indicator.dart | 19 ++--- lib/pangea/widgets/pressable_button.dart | 4 +- 5 files changed, 56 insertions(+), 66 deletions(-) diff --git a/lib/pangea/widgets/chat/message_speech_to_text_card.dart b/lib/pangea/widgets/chat/message_speech_to_text_card.dart index f74eb5974..5ce94c152 100644 --- a/lib/pangea/widgets/chat/message_speech_to_text_card.dart +++ b/lib/pangea/widgets/chat/message_speech_to_text_card.dart @@ -79,10 +79,7 @@ class MessageSpeechToTextCardState extends State { if (transcript.sttTokens.isEmpty) { return TextSpan( text: remainingFullText, - style: BotStyle.text( - context, - setColor: false, - ), + style: BotStyle.text(context), ); } diff --git a/lib/pangea/widgets/chat_list/analytics_summary/learning_settings_button.dart b/lib/pangea/widgets/chat_list/analytics_summary/learning_settings_button.dart index 1b08d951a..7d8e6e0b7 100644 --- a/lib/pangea/widgets/chat_list/analytics_summary/learning_settings_button.dart +++ b/lib/pangea/widgets/chat_list/analytics_summary/learning_settings_button.dart @@ -1,3 +1,4 @@ +import 'package:fluffychat/pangea/widgets/pressable_button.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; @@ -16,23 +17,15 @@ class LearningSettingsButton extends StatelessWidget { Widget build(BuildContext context) { return Tooltip( message: L10n.of(context).learningSettings, - child: InkWell( - customBorder: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(15), - ), - onTap: onTap, + child: PressableButton( + buttonHeight: 2.5, + borderRadius: BorderRadius.circular(15), + onPressed: onTap, + color: Theme.of(context).colorScheme.surfaceBright, child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), color: Theme.of(context).colorScheme.surfaceBright, - boxShadow: [ - BoxShadow( - color: Theme.of(context).colorScheme.primary, - spreadRadius: 1, - blurRadius: 1, - offset: const Offset(1, 1), // changes position of shadow - ), - ], ), padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), child: Row( diff --git a/lib/pangea/widgets/chat_list/analytics_summary/level_badge.dart b/lib/pangea/widgets/chat_list/analytics_summary/level_badge.dart index 3f032c4bb..1254ebfe4 100644 --- a/lib/pangea/widgets/chat_list/analytics_summary/level_badge.dart +++ b/lib/pangea/widgets/chat_list/analytics_summary/level_badge.dart @@ -1,4 +1,6 @@ import 'package:fluffychat/config/app_config.dart'; +import 'package:fluffychat/pangea/widgets/chat_list/analytics_summary/level_bar_popup.dart'; +import 'package:fluffychat/pangea/widgets/pressable_button.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; @@ -11,43 +13,46 @@ class LevelBadge extends StatelessWidget { @override Widget build(BuildContext context) { - return Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - color: Theme.of(context).colorScheme.surfaceBright, - boxShadow: [ - BoxShadow( - color: Theme.of(context).colorScheme.primary, - spreadRadius: 1, - blurRadius: 1, - offset: const Offset(1, 1), // changes position of shadow - ), - ], - ), - padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - CircleAvatar( - backgroundColor: AppConfig.gold, - radius: 8, - child: Icon( - size: 12, - Icons.star, - color: Theme.of(context).colorScheme.surfaceBright, - weight: 1000, + return PressableButton( + color: Theme.of(context).colorScheme.surfaceBright, + borderRadius: BorderRadius.circular(15), + buttonHeight: 2.5, + onPressed: () { + showDialog( + context: context, + builder: (c) => const LevelBarPopup(), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Theme.of(context).colorScheme.surfaceBright, + ), + padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + CircleAvatar( + backgroundColor: AppConfig.gold, + radius: 8, + child: Icon( + size: 12, + Icons.star, + color: Theme.of(context).colorScheme.surfaceBright, + weight: 1000, + ), ), - ), - const SizedBox(width: 4), - Text( - L10n.of(context).levelShort(level), - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: Theme.of(context).colorScheme.primary, + const SizedBox(width: 4), + Text( + L10n.of(context).levelShort(level), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: Theme.of(context).colorScheme.primary, + ), ), - ), - ], + ], + ), ), ); } diff --git a/lib/pangea/widgets/chat_list/analytics_summary/progress_indicator.dart b/lib/pangea/widgets/chat_list/analytics_summary/progress_indicator.dart index 2f25e7b1a..1dcbc8344 100644 --- a/lib/pangea/widgets/chat_list/analytics_summary/progress_indicator.dart +++ b/lib/pangea/widgets/chat_list/analytics_summary/progress_indicator.dart @@ -1,4 +1,5 @@ import 'package:fluffychat/pangea/enum/progress_indicators_enum.dart'; +import 'package:fluffychat/pangea/widgets/pressable_button.dart'; import 'package:flutter/material.dart'; /// A badge that represents one learning progress indicator (i.e., construct uses) @@ -20,23 +21,15 @@ class ProgressIndicatorBadge extends StatelessWidget { Widget build(BuildContext context) { return Tooltip( message: indicator.tooltip(context), - child: InkWell( - customBorder: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(15), - ), - onTap: onTap, + child: PressableButton( + color: Theme.of(context).colorScheme.surfaceBright, + borderRadius: BorderRadius.circular(15), + onPressed: onTap, + buttonHeight: 2.5, child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), color: Theme.of(context).colorScheme.surfaceBright, - boxShadow: [ - BoxShadow( - color: Theme.of(context).colorScheme.primary, - spreadRadius: 1, - blurRadius: 1, - offset: const Offset(-1, 1), // changes position of shadow - ), - ], ), padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), child: Row( diff --git a/lib/pangea/widgets/pressable_button.dart b/lib/pangea/widgets/pressable_button.dart index 557b9f654..a6bf4fa46 100644 --- a/lib/pangea/widgets/pressable_button.dart +++ b/lib/pangea/widgets/pressable_button.dart @@ -138,7 +138,9 @@ class PressableButtonState extends State return Container( decoration: BoxDecoration( color: Color.alphaBlend( - Colors.black.withOpacity(0.25), + Theme.of(context).brightness == Brightness.light + ? Colors.black.withOpacity(0.25) + : Colors.white.withOpacity(0.25), widget.color, ), borderRadius: widget.borderRadius,