From ac050539c8bb5b0ecbfb920d9eebe15f3444e0c5 Mon Sep 17 00:00:00 2001 From: Kelrap Date: Mon, 22 Dec 2025 11:14:40 -0500 Subject: [PATCH 1/2] Add background to make dark mode icon stand out in own message grammar practice --- lib/pages/chat/events/html_message.dart | 2 ++ .../token_practice_button.dart | 20 ++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/pages/chat/events/html_message.dart b/lib/pages/chat/events/html_message.dart index b516ba4f0..09098f984 100644 --- a/lib/pages/chat/events/html_message.dart +++ b/lib/pages/chat/events/html_message.dart @@ -469,6 +469,8 @@ class HtmlMessage extends StatelessWidget { ReadingAssistanceMode.practiceMode, ), ), + addBackground: pangeaMessageEvent!.ownMessage && + Theme.of(context).brightness != Brightness.light, width: tokenWidth, textColor: textColor, ), diff --git a/lib/pangea/toolbar/message_practice/token_practice_button.dart b/lib/pangea/toolbar/message_practice/token_practice_button.dart index 6293fb615..5a511ae13 100644 --- a/lib/pangea/toolbar/message_practice/token_practice_button.dart +++ b/lib/pangea/toolbar/message_practice/token_practice_button.dart @@ -31,6 +31,7 @@ class TokenPracticeButton extends StatelessWidget { final TextStyle textStyle; final double width; final Color textColor; + final bool addBackground; const TokenPracticeButton({ super.key, @@ -39,6 +40,7 @@ class TokenPracticeButton extends StatelessWidget { required this.textStyle, required this.width, required this.textColor, + this.addBackground = false, }); TextStyle get _emojiStyle => TextStyle( @@ -81,6 +83,7 @@ class TokenPracticeButton extends StatelessWidget { target: _activity, emojiStyle: _emojiStyle, width: tokenButtonHeight, + addBackground: addBackground, ); } else if (practiceMode == MessagePracticeMode.wordMorph) { child = _MorphMatchButton( @@ -246,6 +249,7 @@ class _NoActivityContentButton extends StatelessWidget { final PracticeTarget? target; final TextStyle emojiStyle; final double width; + final bool addBackground; const _NoActivityContentButton({ required this.practiceMode, @@ -253,6 +257,7 @@ class _NoActivityContentButton extends StatelessWidget { required this.target, required this.emojiStyle, required this.width, + required this.addBackground, }); @override @@ -283,9 +288,18 @@ class _NoActivityContentButton extends StatelessWidget { child: SizedBox( width: width, child: Center( - child: MorphIcon( - morphFeature: morphFeature, - morphTag: morphTag.lemma, + child: IconButton.filled( + style: IconButton.styleFrom( + backgroundColor: addBackground + ? Theme.of(context).colorScheme.surface.withAlpha(180) + : Colors.white.withAlpha(0), + ), + padding: const EdgeInsets.all(4), + onPressed: () => {}, + icon: MorphIcon( + morphFeature: morphFeature, + morphTag: morphTag.lemma, + ), ), ), ), From 410e2b80a653b341fe05d860cb81dd101d6f8757 Mon Sep 17 00:00:00 2001 From: ggurdin Date: Mon, 22 Dec 2025 13:45:28 -0500 Subject: [PATCH 2/2] simplify --- lib/pages/chat/events/html_message.dart | 2 -- .../token_practice_button.dart | 29 +++++++++---------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/lib/pages/chat/events/html_message.dart b/lib/pages/chat/events/html_message.dart index 09098f984..b516ba4f0 100644 --- a/lib/pages/chat/events/html_message.dart +++ b/lib/pages/chat/events/html_message.dart @@ -469,8 +469,6 @@ class HtmlMessage extends StatelessWidget { ReadingAssistanceMode.practiceMode, ), ), - addBackground: pangeaMessageEvent!.ownMessage && - Theme.of(context).brightness != Brightness.light, width: tokenWidth, textColor: textColor, ), diff --git a/lib/pangea/toolbar/message_practice/token_practice_button.dart b/lib/pangea/toolbar/message_practice/token_practice_button.dart index 5a511ae13..c791c08f1 100644 --- a/lib/pangea/toolbar/message_practice/token_practice_button.dart +++ b/lib/pangea/toolbar/message_practice/token_practice_button.dart @@ -31,7 +31,6 @@ class TokenPracticeButton extends StatelessWidget { final TextStyle textStyle; final double width; final Color textColor; - final bool addBackground; const TokenPracticeButton({ super.key, @@ -40,7 +39,6 @@ class TokenPracticeButton extends StatelessWidget { required this.textStyle, required this.width, required this.textColor, - this.addBackground = false, }); TextStyle get _emojiStyle => TextStyle( @@ -83,7 +81,6 @@ class TokenPracticeButton extends StatelessWidget { target: _activity, emojiStyle: _emojiStyle, width: tokenButtonHeight, - addBackground: addBackground, ); } else if (practiceMode == MessagePracticeMode.wordMorph) { child = _MorphMatchButton( @@ -249,7 +246,6 @@ class _NoActivityContentButton extends StatelessWidget { final PracticeTarget? target; final TextStyle emojiStyle; final double width; - final bool addBackground; const _NoActivityContentButton({ required this.practiceMode, @@ -257,7 +253,6 @@ class _NoActivityContentButton extends StatelessWidget { required this.target, required this.emojiStyle, required this.width, - required this.addBackground, }); @override @@ -288,17 +283,19 @@ class _NoActivityContentButton extends StatelessWidget { child: SizedBox( width: width, child: Center( - child: IconButton.filled( - style: IconButton.styleFrom( - backgroundColor: addBackground - ? Theme.of(context).colorScheme.surface.withAlpha(180) - : Colors.white.withAlpha(0), - ), - padding: const EdgeInsets.all(4), - onPressed: () => {}, - icon: MorphIcon( - morphFeature: morphFeature, - morphTag: morphTag.lemma, + child: CircleAvatar( + radius: width / 2, + backgroundColor: + Theme.of(context).brightness != Brightness.light + ? Theme.of(context).colorScheme.surface.withAlpha(100) + : null, + child: Padding( + padding: const EdgeInsets.all(4.0), + child: MorphIcon( + morphFeature: morphFeature, + morphTag: morphTag.lemma, + size: Size.fromWidth(width - 8.0), + ), ), ), ),