Revert "revert recent changes to relevant files to test if that fixes hidden …" (#1456)
This reverts commit c1041dda70.
This commit is contained in:
parent
c1041dda70
commit
87fca9f56a
3 changed files with 33 additions and 17 deletions
|
|
@ -46,9 +46,7 @@ class MessageTextUtil {
|
|||
start: globalIndex,
|
||||
end: startIndex,
|
||||
hideContent: false,
|
||||
// selected: (isSelected?.call(token) ?? false) && !hasHiddenContent,
|
||||
highlight:
|
||||
(isSelected?.call(token) ?? false) && !hasHiddenContent,
|
||||
selected: (isSelected?.call(token) ?? false) && !hasHiddenContent,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -59,10 +57,7 @@ class MessageTextUtil {
|
|||
end: endIndex,
|
||||
token: token,
|
||||
hideContent: hideContent,
|
||||
// selected: (isSelected?.call(token) ?? false) &&
|
||||
// !hideContent &&
|
||||
// !hasHiddenContent,
|
||||
highlight: (isSelected?.call(token) ?? false) &&
|
||||
selected: (isSelected?.call(token) ?? false) &&
|
||||
!hideContent &&
|
||||
!hasHiddenContent,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -3,10 +3,12 @@ import 'package:flutter/material.dart';
|
|||
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pangea/analytics/controllers/message_analytics_controller.dart';
|
||||
import 'package:fluffychat/pangea/events/event_wrappers/pangea_message_event.dart';
|
||||
import 'package:fluffychat/pangea/events/models/pangea_token_model.dart';
|
||||
import 'package:fluffychat/pangea/events/utils/message_text_util.dart';
|
||||
import 'package:fluffychat/pangea/toolbar/enums/activity_type_enum.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
|
||||
/// Question - does this need to be stateful or does this work?
|
||||
|
|
@ -69,7 +71,7 @@ class MessageTokenText extends StatelessWidget {
|
|||
class TokenPosition {
|
||||
final int start;
|
||||
final int end;
|
||||
final bool highlight;
|
||||
final bool selected;
|
||||
final bool hideContent;
|
||||
final PangeaToken? token;
|
||||
|
||||
|
|
@ -77,7 +79,7 @@ class TokenPosition {
|
|||
required this.start,
|
||||
required this.end,
|
||||
required this.hideContent,
|
||||
required this.highlight,
|
||||
required this.selected,
|
||||
this.token,
|
||||
});
|
||||
}
|
||||
|
|
@ -176,6 +178,19 @@ class MessageTextWidget extends StatelessWidget {
|
|||
text: TextSpan(
|
||||
children:
|
||||
tokenPositions.mapIndexed((int i, TokenPosition tokenPosition) {
|
||||
final shouldDo = tokenPosition.token?.shouldDoActivity(
|
||||
a: ActivityTypeEnum.wordMeaning,
|
||||
feature: null,
|
||||
tag: null,
|
||||
) ??
|
||||
false;
|
||||
|
||||
final didMeaningActivity =
|
||||
tokenPosition.token?.didActivitySuccessfully(
|
||||
ActivityTypeEnum.wordMeaning,
|
||||
) ??
|
||||
true;
|
||||
|
||||
final substring = messageCharacters
|
||||
.skip(tokenPosition.start)
|
||||
.take(tokenPosition.end - tokenPosition.start)
|
||||
|
|
@ -199,11 +214,13 @@ class MessageTextWidget extends StatelessWidget {
|
|||
text: substring,
|
||||
style: style.merge(
|
||||
TextStyle(
|
||||
backgroundColor: tokenPosition.highlight
|
||||
? Theme.of(context).brightness == Brightness.light
|
||||
? Colors.black.withAlpha(100)
|
||||
: Colors.white.withAlpha(100)
|
||||
: Colors.transparent,
|
||||
backgroundColor: tokenPosition.selected
|
||||
? AppConfig.primaryColor.withAlpha(80)
|
||||
: (isSelected != null && shouldDo)
|
||||
? !didMeaningActivity
|
||||
? AppConfig.success.withAlpha(60)
|
||||
: AppConfig.gold.withAlpha(60)
|
||||
: Colors.transparent,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -82,7 +82,10 @@ class OverlayMessage extends StatelessWidget {
|
|||
if (ownMessage) {
|
||||
color = displayEvent.status.isError
|
||||
? Colors.redAccent
|
||||
: theme.colorScheme.primary;
|
||||
: Color.alphaBlend(
|
||||
Colors.white.withAlpha(180),
|
||||
ThemeData.dark().colorScheme.primary,
|
||||
);
|
||||
}
|
||||
|
||||
final noBubble = {
|
||||
|
|
@ -96,8 +99,9 @@ class OverlayMessage extends StatelessWidget {
|
|||
MessageTypes.Audio,
|
||||
}.contains(event.messageType);
|
||||
|
||||
final textColor =
|
||||
ownMessage ? theme.colorScheme.onPrimary : theme.colorScheme.onSurface;
|
||||
final textColor = ownMessage
|
||||
? ThemeData.dark().colorScheme.onPrimary
|
||||
: theme.colorScheme.onSurface;
|
||||
|
||||
return Material(
|
||||
color: color,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue