|
|
|
|
@ -5,6 +5,7 @@ import 'package:fluffychat/pangea/matrix_event_wrappers/pangea_message_event.dar
|
|
|
|
|
import 'package:fluffychat/pangea/utils/any_state_holder.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/widgets/chat/message_buttons.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/widgets/chat/message_selection_overlay.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/widgets/pressable_button.dart';
|
|
|
|
|
import 'package:fluffychat/utils/date_time_extension.dart';
|
|
|
|
|
import 'package:fluffychat/utils/string_color.dart';
|
|
|
|
|
import 'package:fluffychat/widgets/avatar.dart';
|
|
|
|
|
@ -41,6 +42,7 @@ class Message extends StatelessWidget {
|
|
|
|
|
final bool immersionMode;
|
|
|
|
|
final ChatController controller;
|
|
|
|
|
final MessageOverlayController? overlayController;
|
|
|
|
|
final bool isButton;
|
|
|
|
|
// Pangea#
|
|
|
|
|
final Color? avatarPresenceBackgroundColor;
|
|
|
|
|
|
|
|
|
|
@ -65,6 +67,7 @@ class Message extends StatelessWidget {
|
|
|
|
|
required this.immersionMode,
|
|
|
|
|
required this.controller,
|
|
|
|
|
this.overlayController,
|
|
|
|
|
this.isButton = false,
|
|
|
|
|
// Pangea#
|
|
|
|
|
super.key,
|
|
|
|
|
});
|
|
|
|
|
@ -353,9 +356,26 @@ class Message extends StatelessWidget {
|
|
|
|
|
: 1,
|
|
|
|
|
duration: FluffyThemes.animationDuration,
|
|
|
|
|
curve: FluffyThemes.animationCurve,
|
|
|
|
|
child: Material(
|
|
|
|
|
color:
|
|
|
|
|
noBubble ? Colors.transparent : color,
|
|
|
|
|
child:
|
|
|
|
|
// #Pangea
|
|
|
|
|
PressableButton(
|
|
|
|
|
triggerAnimation: controller
|
|
|
|
|
.showToolbarStream.stream
|
|
|
|
|
.where(
|
|
|
|
|
(eventID) => eventID == event.eventId,
|
|
|
|
|
),
|
|
|
|
|
depressed: !isButton,
|
|
|
|
|
borderRadius: borderRadius,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
showToolbar(pangeaMessageEvent);
|
|
|
|
|
},
|
|
|
|
|
color: color,
|
|
|
|
|
child:
|
|
|
|
|
// Pangea#
|
|
|
|
|
Material(
|
|
|
|
|
color: noBubble
|
|
|
|
|
? Colors.transparent
|
|
|
|
|
: color,
|
|
|
|
|
clipBehavior: Clip.antiAlias,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: borderRadius,
|
|
|
|
|
@ -366,7 +386,9 @@ class Message extends StatelessWidget {
|
|
|
|
|
? LayerLinkAndKey('overlay_msg')
|
|
|
|
|
.link
|
|
|
|
|
: MatrixState.pAnyState
|
|
|
|
|
.layerLinkAndKey(event.eventId)
|
|
|
|
|
.layerLinkAndKey(
|
|
|
|
|
event.eventId,
|
|
|
|
|
)
|
|
|
|
|
.link,
|
|
|
|
|
child: Container(
|
|
|
|
|
key: overlayController != null
|
|
|
|
|
@ -379,7 +401,8 @@ class Message extends StatelessWidget {
|
|
|
|
|
.key,
|
|
|
|
|
// Pangea#
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.circular(
|
|
|
|
|
AppConfig.borderRadius,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -391,7 +414,8 @@ class Message extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
constraints: const BoxConstraints(
|
|
|
|
|
maxWidth:
|
|
|
|
|
FluffyThemes.columnWidth * 1.5,
|
|
|
|
|
FluffyThemes.columnWidth *
|
|
|
|
|
1.5,
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
@ -401,14 +425,15 @@ class Message extends StatelessWidget {
|
|
|
|
|
if (event.relationshipType ==
|
|
|
|
|
RelationshipTypes.reply)
|
|
|
|
|
FutureBuilder<Event?>(
|
|
|
|
|
future: event
|
|
|
|
|
.getReplyEvent(timeline),
|
|
|
|
|
future: event.getReplyEvent(
|
|
|
|
|
timeline,
|
|
|
|
|
),
|
|
|
|
|
builder: (
|
|
|
|
|
BuildContext context,
|
|
|
|
|
snapshot,
|
|
|
|
|
) {
|
|
|
|
|
final replyEvent = snapshot
|
|
|
|
|
.hasData
|
|
|
|
|
final replyEvent =
|
|
|
|
|
snapshot.hasData
|
|
|
|
|
? snapshot.data!
|
|
|
|
|
: Event(
|
|
|
|
|
eventId: event
|
|
|
|
|
@ -416,21 +441,26 @@ class Message extends StatelessWidget {
|
|
|
|
|
content: {
|
|
|
|
|
'msgtype':
|
|
|
|
|
'm.text',
|
|
|
|
|
'body': '...',
|
|
|
|
|
'body':
|
|
|
|
|
'...',
|
|
|
|
|
},
|
|
|
|
|
senderId:
|
|
|
|
|
event.senderId,
|
|
|
|
|
senderId: event
|
|
|
|
|
.senderId,
|
|
|
|
|
type:
|
|
|
|
|
'm.room.message',
|
|
|
|
|
room: event.room,
|
|
|
|
|
status: EventStatus
|
|
|
|
|
room: event
|
|
|
|
|
.room,
|
|
|
|
|
status:
|
|
|
|
|
EventStatus
|
|
|
|
|
.sent,
|
|
|
|
|
originServerTs:
|
|
|
|
|
DateTime.now(),
|
|
|
|
|
DateTime
|
|
|
|
|
.now(),
|
|
|
|
|
);
|
|
|
|
|
return Padding(
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets.only(
|
|
|
|
|
const EdgeInsets
|
|
|
|
|
.only(
|
|
|
|
|
bottom: 4.0,
|
|
|
|
|
),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
@ -446,7 +476,8 @@ class Message extends StatelessWidget {
|
|
|
|
|
replyEvent,
|
|
|
|
|
ownMessage:
|
|
|
|
|
ownMessage,
|
|
|
|
|
timeline: timeline,
|
|
|
|
|
timeline:
|
|
|
|
|
timeline,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -471,7 +502,8 @@ class Message extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
if (event.hasAggregatedEvents(
|
|
|
|
|
timeline,
|
|
|
|
|
RelationshipTypes.edit,
|
|
|
|
|
RelationshipTypes
|
|
|
|
|
.edit,
|
|
|
|
|
)
|
|
|
|
|
// #Pangea
|
|
|
|
|
||
|
|
|
|
|
@ -507,7 +539,8 @@ class Message extends StatelessWidget {
|
|
|
|
|
if (event
|
|
|
|
|
.hasAggregatedEvents(
|
|
|
|
|
timeline,
|
|
|
|
|
RelationshipTypes.edit,
|
|
|
|
|
RelationshipTypes
|
|
|
|
|
.edit,
|
|
|
|
|
)) ...[
|
|
|
|
|
// Pangea#
|
|
|
|
|
Icon(
|
|
|
|
|
@ -520,7 +553,9 @@ class Message extends StatelessWidget {
|
|
|
|
|
' - ${displayEvent.originServerTs.localizedTimeShort(context)}',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: textColor
|
|
|
|
|
.withAlpha(164),
|
|
|
|
|
.withAlpha(
|
|
|
|
|
164,
|
|
|
|
|
),
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -536,6 +571,7 @@ class Message extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|