Commit c9f4a26b authored by Wilko Manger's avatar Wilko Manger

Render replies in chat overview better

parent 9c22d00d
......@@ -37,7 +37,7 @@ class ImageSubtitle extends Subtitle {
),
Icon(Icons.photo_camera,
color: Theme.of(context).textTheme.caption.color,
size: 20,
size: Subtitle.iconSize,
),
Text(' ' + l(context).photo,
style: textStyle(context)
......
......@@ -27,6 +27,8 @@ import 'text_subtitle.dart';
import 'unsupported_subtitle.dart';
abstract class Subtitle extends StatelessWidget {
static const iconSize = 20.0;
final RoomEvent event;
@protected
final String senderName;
......
......@@ -28,18 +28,50 @@ class TextSubtitle extends Subtitle {
TextSubtitle(this.event) : super(event);
@override
Widget build(BuildContext context) =>
RichText(
overflow: TextOverflow.ellipsis,
maxLines: 1,
text: TextSpan(
style: textStyle(context),
children: [
senderSpan(context),
TextSpan(
text: event.content.body ?? 'null'
Widget build(BuildContext context) {
if (event.content.inReplyToId == null) {
return RichText(
overflow: TextOverflow.ellipsis,
maxLines: 1,
text: TextSpan(
style: textStyle(context),
children: [
senderSpan(context),
TextSpan(
text: event.content.body ?? 'null'
)
]
)
);
} else {
// Strip replied-to content
final text = event.content.formattedBody
.split(RegExp('(<\\/*mx-reply>)'))[2];
return Row(
children: <Widget>[
RichText(
overflow: TextOverflow.ellipsis,
maxLines: 1,
text: senderSpan(context)
),
Icon(
Icons.reply,
color: Theme.of(context).textTheme.caption.color,
size: Subtitle.iconSize
),
Expanded(
child: RichText(
overflow: TextOverflow.ellipsis,
maxLines: 1,
text: TextSpan(
style: textStyle(context),
text: ' ' + text ?? 'null'
)
),
)
]
)
);
],
);
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment