Compare commits
5 changed files with 29 additions and 49 deletions
|
|
@ -10,7 +10,6 @@ import "package:nexus/controllers/recent_emoji.dart";
|
||||||
import "package:nexus/controllers/rooms.dart";
|
import "package:nexus/controllers/rooms.dart";
|
||||||
import "package:nexus/controllers/room_chat.dart";
|
import "package:nexus/controllers/room_chat.dart";
|
||||||
import "package:nexus/controllers/via.dart";
|
import "package:nexus/controllers/via.dart";
|
||||||
import "package:nexus/helpers/extensions/event_id_is_fake.dart";
|
|
||||||
import "package:nexus/models/content/message.dart";
|
import "package:nexus/models/content/message.dart";
|
||||||
import "package:nexus/models/event.dart";
|
import "package:nexus/models/event.dart";
|
||||||
import "package:nexus/models/relation_type.dart";
|
import "package:nexus/models/relation_type.dart";
|
||||||
|
|
@ -230,7 +229,7 @@ extension BuildEventOptions on Event {
|
||||||
.redaction(targetUser: sender, roomId: roomId),
|
.redaction(targetUser: sender, roomId: roomId),
|
||||||
),
|
),
|
||||||
) &&
|
) &&
|
||||||
!eventId.isFake)
|
!eventId.startsWith("~"))
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
onTap: () => showReasonDialog(
|
onTap: () => showReasonDialog(
|
||||||
title: "Delete Message",
|
title: "Delete Message",
|
||||||
|
|
@ -247,7 +246,7 @@ extension BuildEventOptions on Event {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
if (eventId.isFake)
|
if (eventId.startsWith("~"))
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
onTap: () => ref.watch(notifier).hideClientSticky(rowId),
|
onTap: () => ref.watch(notifier).hideClientSticky(rowId),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
extension EventIdIsFake on String {
|
|
||||||
bool get isFake => startsWith("~") || startsWith("\$gomuks");
|
|
||||||
}
|
|
||||||
|
|
@ -18,20 +18,17 @@ class const EventPreview(final Event event, {super.key})
|
||||||
if (event.content is MessageContent) MessageAvatar(event),
|
if (event.content is MessageContent) MessageAvatar(event),
|
||||||
|
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Row(
|
child: Wrap(
|
||||||
crossAxisAlignment: .center,
|
crossAxisAlignment: .center,
|
||||||
mainAxisSize: .min,
|
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
|
runSpacing: 2,
|
||||||
children: [
|
children: [
|
||||||
if (event.content is MessageContent)
|
if (event.content is MessageContent) MessageDisplayname(event),
|
||||||
Flexible(child: MessageDisplayname(event)),
|
EventRenderer(
|
||||||
Flexible(
|
event.rowId,
|
||||||
child: EventRenderer(
|
roomId: event.roomId,
|
||||||
event.rowId,
|
textOnly: true,
|
||||||
roomId: event.roomId,
|
maxLines: 1,
|
||||||
textOnly: true,
|
|
||||||
maxLines: 1,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,11 @@
|
||||||
import "package:material_ui/material_ui.dart";
|
import "package:material_ui/material_ui.dart";
|
||||||
|
|
||||||
class const Loading({super.key, final double? dimension})
|
class const Loading({super.key, final double? height}) extends StatelessWidget {
|
||||||
extends StatelessWidget {
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Center(
|
Widget build(BuildContext context) => Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: .all(16),
|
padding: .all(16),
|
||||||
child: SizedBox.square(
|
child: SizedBox(height: height, child: CircularProgressIndicator()),
|
||||||
dimension: dimension,
|
|
||||||
child: CircularProgressIndicator(),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ import "package:nexus/widgets/html/html.dart";
|
||||||
import "package:nexus/widgets/lazy_loading/message_avatar.dart";
|
import "package:nexus/widgets/lazy_loading/message_avatar.dart";
|
||||||
import "package:nexus/widgets/lazy_loading/message_displayname.dart";
|
import "package:nexus/widgets/lazy_loading/message_displayname.dart";
|
||||||
import "package:nexus/widgets/linkified_text.dart";
|
import "package:nexus/widgets/linkified_text.dart";
|
||||||
import "package:nexus/widgets/loading.dart";
|
|
||||||
import "package:nexus/widgets/message_image.dart";
|
import "package:nexus/widgets/message_image.dart";
|
||||||
import "package:nexus/widgets/reaction_row.dart";
|
import "package:nexus/widgets/reaction_row.dart";
|
||||||
import "package:nexus/widgets/timestamp.dart";
|
import "package:nexus/widgets/timestamp.dart";
|
||||||
|
|
@ -198,32 +197,24 @@ class const MessageRenderer(
|
||||||
onTap: onTapReply,
|
onTap: onTapReply,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: .symmetric(vertical: 8, horizontal: 12),
|
padding: .symmetric(vertical: 8, horizontal: 12),
|
||||||
child: SizedBox(
|
child: switch (ref.watch(
|
||||||
height: 32,
|
EventController.provider(
|
||||||
child: OverflowBox(
|
.new(
|
||||||
alignment: .centerLeft,
|
roomId: event.roomId,
|
||||||
minHeight: 0,
|
eventId: event.replyTo!,
|
||||||
maxHeight: .infinity,
|
),
|
||||||
child: switch (ref.watch(
|
|
||||||
EventController.provider(
|
|
||||||
.new(
|
|
||||||
roomId: event.roomId,
|
|
||||||
eventId: event.replyTo!,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)) {
|
|
||||||
AsyncData(:final value?) ||
|
|
||||||
AsyncLoading(
|
|
||||||
:final value?,
|
|
||||||
) => EventPreview(value),
|
|
||||||
AsyncError _ => Text(
|
|
||||||
"An error occurred while fetching the reply",
|
|
||||||
style: errorStyle,
|
|
||||||
),
|
|
||||||
_ => Loading(dimension: 12),
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
)) {
|
||||||
|
AsyncData(:final value?) ||
|
||||||
|
AsyncLoading(
|
||||||
|
:final value?,
|
||||||
|
) => EventPreview(value),
|
||||||
|
AsyncError _ => Text(
|
||||||
|
"An error occurred while fetching the reply",
|
||||||
|
style: errorStyle,
|
||||||
|
),
|
||||||
|
_ => Text("Fetching event..."),
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue