parent
650f1ac8e4
commit
0a3ec830a3
3 changed files with 43 additions and 27 deletions
|
|
@ -18,17 +18,20 @@ class const EventPreview(final Event event, {super.key})
|
|||
if (event.content is MessageContent) MessageAvatar(event),
|
||||
|
||||
Flexible(
|
||||
child: Wrap(
|
||||
child: Row(
|
||||
crossAxisAlignment: .center,
|
||||
mainAxisSize: .min,
|
||||
spacing: 8,
|
||||
runSpacing: 2,
|
||||
children: [
|
||||
if (event.content is MessageContent) MessageDisplayname(event),
|
||||
EventRenderer(
|
||||
event.rowId,
|
||||
roomId: event.roomId,
|
||||
textOnly: true,
|
||||
maxLines: 1,
|
||||
if (event.content is MessageContent)
|
||||
Flexible(child: MessageDisplayname(event)),
|
||||
Flexible(
|
||||
child: EventRenderer(
|
||||
event.rowId,
|
||||
roomId: event.roomId,
|
||||
textOnly: true,
|
||||
maxLines: 1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
import "package:material_ui/material_ui.dart";
|
||||
|
||||
class const Loading({super.key, final double? height}) extends StatelessWidget {
|
||||
class const Loading({super.key, final double? dimension})
|
||||
extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => Center(
|
||||
child: Padding(
|
||||
padding: .all(16),
|
||||
child: SizedBox(height: height, child: CircularProgressIndicator()),
|
||||
child: SizedBox.square(
|
||||
dimension: dimension,
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import "package:nexus/widgets/html/html.dart";
|
|||
import "package:nexus/widgets/lazy_loading/message_avatar.dart";
|
||||
import "package:nexus/widgets/lazy_loading/message_displayname.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/reaction_row.dart";
|
||||
import "package:nexus/widgets/timestamp.dart";
|
||||
|
|
@ -197,24 +198,32 @@ class const MessageRenderer(
|
|||
onTap: onTapReply,
|
||||
child: Padding(
|
||||
padding: .symmetric(vertical: 8, horizontal: 12),
|
||||
child: switch (ref.watch(
|
||||
EventController.provider(
|
||||
.new(
|
||||
roomId: event.roomId,
|
||||
eventId: event.replyTo!,
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 32,
|
||||
child: OverflowBox(
|
||||
alignment: .centerLeft,
|
||||
minHeight: 0,
|
||||
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