chore: allow users to select activity messages (#2153)
This commit is contained in:
parent
dacc4c3470
commit
83bcf95f2e
4 changed files with 162 additions and 159 deletions
|
|
@ -189,6 +189,8 @@ class ChatEventList extends StatelessWidget {
|
|||
resetAnimateIn: () {
|
||||
controller.animateInEventIndex = null;
|
||||
},
|
||||
highlightMarker:
|
||||
controller.scrollToEventIdMarker == event.eventId,
|
||||
)
|
||||
:
|
||||
// Pangea#
|
||||
|
|
|
|||
|
|
@ -609,9 +609,9 @@ class HtmlMessage extends StatelessWidget {
|
|||
return SelectionArea(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
if (!isOverlay && pangeaMessageEvent != null) {
|
||||
if (!isOverlay) {
|
||||
controller.showToolbar(
|
||||
pangeaMessageEvent!.event,
|
||||
pangeaMessageEvent?.event ?? event,
|
||||
pangeaMessageEvent: pangeaMessageEvent,
|
||||
nextEvent: nextEvent,
|
||||
prevEvent: prevEvent,
|
||||
|
|
|
|||
|
|
@ -10,10 +10,8 @@ import 'package:fluffychat/config/themes.dart';
|
|||
import 'package:fluffychat/pages/chat/chat.dart';
|
||||
import 'package:fluffychat/pages/chat/events/room_creation_state_event.dart';
|
||||
import 'package:fluffychat/pangea/choreographer/enums/use_type.dart';
|
||||
import 'package:fluffychat/pangea/common/utils/any_state_holder.dart';
|
||||
import 'package:fluffychat/pangea/common/widgets/pressable_button.dart';
|
||||
import 'package:fluffychat/pangea/events/event_wrappers/pangea_message_event.dart';
|
||||
import 'package:fluffychat/pangea/toolbar/widgets/message_selection_overlay.dart';
|
||||
import 'package:fluffychat/utils/date_time_extension.dart';
|
||||
import 'package:fluffychat/utils/file_description.dart';
|
||||
import 'package:fluffychat/utils/string_color.dart';
|
||||
|
|
@ -47,7 +45,6 @@ class Message extends StatelessWidget {
|
|||
// #Pangea
|
||||
final bool immersionMode;
|
||||
final ChatController controller;
|
||||
final MessageOverlayController? overlayController;
|
||||
final bool isButton;
|
||||
// Pangea#
|
||||
final List<Color> colors;
|
||||
|
|
@ -73,7 +70,6 @@ class Message extends StatelessWidget {
|
|||
// #Pangea
|
||||
required this.immersionMode,
|
||||
required this.controller,
|
||||
this.overlayController,
|
||||
this.isButton = false,
|
||||
// Pangea#
|
||||
required this.colors,
|
||||
|
|
@ -83,7 +79,7 @@ class Message extends StatelessWidget {
|
|||
// #Pangea
|
||||
void showToolbar(PangeaMessageEvent? pangeaMessageEvent) {
|
||||
// if overlayController is not null, the message is already in overlay mode
|
||||
if (pangeaMessageEvent != null && overlayController == null) {
|
||||
if (pangeaMessageEvent != null) {
|
||||
controller.showToolbar(
|
||||
event,
|
||||
pangeaMessageEvent: pangeaMessageEvent,
|
||||
|
|
@ -253,12 +249,8 @@ class Message extends StatelessWidget {
|
|||
right: 0,
|
||||
child: InkWell(
|
||||
// #Pangea
|
||||
onTap: () => overlayController == null
|
||||
? showToolbar(pangeaMessageEvent)
|
||||
: controller.clearSelectedEvents(),
|
||||
onLongPress: () => overlayController == null
|
||||
? showToolbar(pangeaMessageEvent)
|
||||
: controller.clearSelectedEvents(),
|
||||
onTap: () => showToolbar(pangeaMessageEvent),
|
||||
onLongPress: () => showToolbar(pangeaMessageEvent),
|
||||
// onTap: () => onSelect(event),
|
||||
// onLongPress: () => onSelect(event),
|
||||
// Pangea#
|
||||
|
|
@ -290,9 +282,7 @@ class Message extends StatelessWidget {
|
|||
// ),
|
||||
// )
|
||||
// else if (nextEventSameSender || ownMessage)
|
||||
if (nextEventSameSender ||
|
||||
ownMessage ||
|
||||
overlayController != null)
|
||||
if (nextEventSameSender || ownMessage)
|
||||
// Pangea#
|
||||
SizedBox(
|
||||
width: Avatar.defaultSize,
|
||||
|
|
@ -332,11 +322,7 @@ class Message extends StatelessWidget {
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// #Pangea
|
||||
// if (!nextEventSameSender)
|
||||
if (!nextEventSameSender &&
|
||||
overlayController == null)
|
||||
// Pangea#
|
||||
if (!nextEventSameSender)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 8.0,
|
||||
|
|
@ -431,14 +417,11 @@ class Message extends StatelessWidget {
|
|||
clipBehavior: Clip.antiAlias,
|
||||
// #Pangea
|
||||
child: CompositedTransformTarget(
|
||||
link: overlayController != null
|
||||
? LayerLinkAndKey('overlay_msg')
|
||||
.link
|
||||
: MatrixState.pAnyState
|
||||
.layerLinkAndKey(
|
||||
event.eventId,
|
||||
)
|
||||
.link,
|
||||
link: MatrixState.pAnyState
|
||||
.layerLinkAndKey(
|
||||
event.eventId,
|
||||
)
|
||||
.link,
|
||||
// child: BubbleBackground(
|
||||
// colors: colors,
|
||||
// ignore: noBubble || !ownMessage,
|
||||
|
|
@ -446,15 +429,11 @@ class Message extends StatelessWidget {
|
|||
// Pangea#
|
||||
child: Container(
|
||||
// #Pangea
|
||||
key: overlayController != null
|
||||
? LayerLinkAndKey(
|
||||
'overlay_msg',
|
||||
).key
|
||||
: MatrixState.pAnyState
|
||||
.layerLinkAndKey(
|
||||
event.eventId,
|
||||
)
|
||||
.key,
|
||||
key: MatrixState.pAnyState
|
||||
.layerLinkAndKey(
|
||||
event.eventId,
|
||||
)
|
||||
.key,
|
||||
// Pangea#
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
|
|
@ -551,8 +530,6 @@ class Message extends StatelessWidget {
|
|||
pangeaMessageEvent:
|
||||
pangeaMessageEvent,
|
||||
immersionMode: immersionMode,
|
||||
overlayController:
|
||||
overlayController,
|
||||
controller: controller,
|
||||
nextEvent: nextEvent,
|
||||
prevEvent: previousEvent,
|
||||
|
|
@ -648,11 +625,10 @@ class Message extends StatelessWidget {
|
|||
event.hasAggregatedEvents(timeline, RelationshipTypes.reaction);
|
||||
// #Pangea
|
||||
// if (showReceiptsRow || displayTime || selected || displayReadMarker) {
|
||||
if (overlayController == null &&
|
||||
(showReceiptsRow ||
|
||||
displayTime ||
|
||||
displayReadMarker ||
|
||||
(pangeaMessageEvent?.showMessageButtons ?? false))) {
|
||||
if (showReceiptsRow ||
|
||||
displayTime ||
|
||||
displayReadMarker ||
|
||||
(pangeaMessageEvent?.showMessageButtons ?? false)) {
|
||||
// Pangea#
|
||||
container = Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
|
@ -694,9 +670,8 @@ class Message extends StatelessWidget {
|
|||
duration: FluffyThemes.animationDuration,
|
||||
curve: FluffyThemes.animationCurve,
|
||||
// #Pangea
|
||||
child: overlayController != null ||
|
||||
(!showReceiptsRow &&
|
||||
!(pangeaMessageEvent?.showMessageButtons ?? false))
|
||||
child: !showReceiptsRow &&
|
||||
!(pangeaMessageEvent?.showMessageButtons ?? false)
|
||||
// child: !showReceiptsRow
|
||||
// Pangea#
|
||||
? const SizedBox.shrink()
|
||||
|
|
@ -784,15 +759,7 @@ class Message extends StatelessWidget {
|
|||
left: 8.0,
|
||||
right: 8.0,
|
||||
top: nextEventSameSender ? 1.0 : 4.0,
|
||||
bottom:
|
||||
// #Pangea
|
||||
overlayController != null
|
||||
? 0
|
||||
:
|
||||
// Pangea#
|
||||
previousEventSameSender
|
||||
? 1.0
|
||||
: 4.0,
|
||||
bottom: previousEventSameSender ? 1.0 : 4.0,
|
||||
),
|
||||
child: container,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -17,13 +17,15 @@ class ActivityPlanMessage extends StatelessWidget {
|
|||
final bool animateIn;
|
||||
final void Function()? resetAnimateIn;
|
||||
final ChatController controller;
|
||||
final bool highlightMarker;
|
||||
|
||||
const ActivityPlanMessage(
|
||||
this.event, {
|
||||
required this.timeline,
|
||||
required this.controller,
|
||||
this.animateIn = false,
|
||||
this.resetAnimateIn,
|
||||
required this.controller,
|
||||
this.highlightMarker = false,
|
||||
super.key,
|
||||
});
|
||||
|
||||
|
|
@ -65,114 +67,146 @@ class ActivityPlanMessage extends StatelessWidget {
|
|||
alignment: Alignment.bottomLeft,
|
||||
child: animateIn
|
||||
? const SizedBox(height: 0, width: double.infinity)
|
||||
: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
AnimatedOpacity(
|
||||
opacity: animateIn
|
||||
? 0
|
||||
: event.messageType == MessageTypes.BadEncrypted ||
|
||||
event.status.isSending
|
||||
? 0.5
|
||||
: 1,
|
||||
duration: FluffyThemes.animationDuration,
|
||||
curve: FluffyThemes.animationCurve,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: color,
|
||||
borderRadius: borderRadius,
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: CompositedTransformTarget(
|
||||
link: MatrixState.pAnyState
|
||||
.layerLinkAndKey(
|
||||
event.eventId,
|
||||
)
|
||||
.link,
|
||||
child: Container(
|
||||
key: MatrixState.pAnyState
|
||||
.layerLinkAndKey(
|
||||
event.eventId,
|
||||
)
|
||||
.key,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConfig.borderRadius,
|
||||
: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: InkWell(
|
||||
onTap: () => controller.showToolbar(event),
|
||||
onLongPress: () => controller.showToolbar(event),
|
||||
borderRadius:
|
||||
BorderRadius.circular(AppConfig.borderRadius / 2),
|
||||
child: Material(
|
||||
borderRadius:
|
||||
BorderRadius.circular(AppConfig.borderRadius / 2),
|
||||
color: highlightMarker
|
||||
? theme.colorScheme.secondaryContainer
|
||||
.withAlpha(128)
|
||||
: Colors.transparent,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
child: GestureDetector(
|
||||
onTap: () => controller.showToolbar(event),
|
||||
onLongPress: () => controller.showToolbar(event),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
AnimatedOpacity(
|
||||
opacity: animateIn
|
||||
? 0
|
||||
: event.messageType ==
|
||||
MessageTypes.BadEncrypted ||
|
||||
event.status.isSending
|
||||
? 0.5
|
||||
: 1,
|
||||
duration: FluffyThemes.animationDuration,
|
||||
curve: FluffyThemes.animationCurve,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: color,
|
||||
borderRadius: borderRadius,
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 8,
|
||||
),
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: FluffyThemes.columnWidth * 1.5,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
MessageContent(
|
||||
displayEvent,
|
||||
textColor: textColor,
|
||||
borderRadius: borderRadius,
|
||||
controller: controller,
|
||||
immersionMode: false,
|
||||
timeline: timeline,
|
||||
linkColor:
|
||||
theme.brightness == Brightness.light
|
||||
? theme.colorScheme.primary
|
||||
: theme.colorScheme.onPrimary,
|
||||
),
|
||||
if (event.hasAggregatedEvents(
|
||||
timeline,
|
||||
RelationshipTypes.edit,
|
||||
))
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 4.0,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (event.hasAggregatedEvents(
|
||||
timeline,
|
||||
RelationshipTypes.edit,
|
||||
)) ...[
|
||||
Icon(
|
||||
Icons.edit_outlined,
|
||||
color: textColor.withAlpha(164),
|
||||
size: 14,
|
||||
),
|
||||
Text(
|
||||
' - ${displayEvent.originServerTs.localizedTimeShort(context)}',
|
||||
style: TextStyle(
|
||||
color: textColor.withAlpha(
|
||||
164,
|
||||
),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: CompositedTransformTarget(
|
||||
link: MatrixState.pAnyState
|
||||
.layerLinkAndKey(
|
||||
event.eventId,
|
||||
)
|
||||
.link,
|
||||
child: Container(
|
||||
key: MatrixState.pAnyState
|
||||
.layerLinkAndKey(
|
||||
event.eventId,
|
||||
)
|
||||
.key,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConfig.borderRadius,
|
||||
),
|
||||
),
|
||||
],
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 8,
|
||||
),
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: FluffyThemes.columnWidth * 1.5,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
MessageContent(
|
||||
displayEvent,
|
||||
textColor: textColor,
|
||||
borderRadius: borderRadius,
|
||||
controller: controller,
|
||||
immersionMode: false,
|
||||
timeline: timeline,
|
||||
linkColor: theme.brightness ==
|
||||
Brightness.light
|
||||
? theme.colorScheme.primary
|
||||
: theme.colorScheme.onPrimary,
|
||||
),
|
||||
if (event.hasAggregatedEvents(
|
||||
timeline,
|
||||
RelationshipTypes.edit,
|
||||
))
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 4.0,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (event.hasAggregatedEvents(
|
||||
timeline,
|
||||
RelationshipTypes.edit,
|
||||
)) ...[
|
||||
Icon(
|
||||
Icons.edit_outlined,
|
||||
color: textColor
|
||||
.withAlpha(164),
|
||||
size: 14,
|
||||
),
|
||||
Text(
|
||||
' - ${displayEvent.originServerTs.localizedTimeShort(context)}',
|
||||
style: TextStyle(
|
||||
color:
|
||||
textColor.withAlpha(
|
||||
164,
|
||||
),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 4.0,
|
||||
right: 4.0,
|
||||
),
|
||||
child: MessageReactions(event, timeline),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 4.0,
|
||||
right: 4.0,
|
||||
),
|
||||
child: MessageReactions(event, timeline),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue