diff --git a/lib/pangea/message_token_text/message_token_button.dart b/lib/pangea/message_token_text/message_token_button.dart index cba22ec44..2b2624948 100644 --- a/lib/pangea/message_token_text/message_token_button.dart +++ b/lib/pangea/message_token_text/message_token_button.dart @@ -297,17 +297,13 @@ class MessageTokenButtonContent extends StatelessWidget { Color _color(BuildContext context) { final bool isLight = Theme.of(context).brightness == Brightness.light; - if (activity == null) { - return isLight - ? Theme.of(context).colorScheme.primary - : Theme.of(context).colorScheme.primaryContainer; - } - if (isActivityCompleteOrNullForToken) { - return AppConfig.gold; - } - return isLight + final defaultColor = isLight ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.primaryContainer; + + return activity != null && isActivityCompleteOrNullForToken + ? AppConfig.gold + : defaultColor; } @override @@ -382,6 +378,8 @@ class MessageTokenButtonContent extends StatelessWidget { (selectedChoice != null ? 0.4 : 0.0) + (accepted.isNotEmpty ? 0.3 : 0.0); + final theme = Theme.of(context); + return InkWell( onTap: selectedChoice != null ? () => onMatch?.call(selectedChoice!) @@ -389,15 +387,11 @@ class MessageTokenButtonContent extends StatelessWidget { borderRadius: _borderRadius, child: CustomPaint( painter: DottedBorderPainter( - color: Theme.of(context).brightness == Brightness.light - ? Theme.of(context) - .colorScheme - .primary + color: theme.brightness == Brightness.light + ? theme.colorScheme.primary .withAlpha((colorAlpha * 255).toInt()) - : Theme.of(context) - .colorScheme - .primaryContainer - .withAlpha((colorAlpha * 275).toInt()), + : theme.colorScheme.primaryContainer + .withAlpha((colorAlpha * 255).toInt()), borderRadius: _borderRadius, ), child: Container( @@ -406,9 +400,7 @@ class MessageTokenButtonContent extends StatelessWidget { width: max(width, 24.0), alignment: Alignment.center, decoration: BoxDecoration( - color: Theme.of(context) - .colorScheme - .primary + color: theme.colorScheme.primary .withAlpha((max(0, colorAlpha - 0.7) * 255).toInt()), borderRadius: _borderRadius, ),