Commit 5d91cf0e authored by Wilko Manger's avatar Wilko Manger

Show sent state icon next to own messages

parent 2e00b60c
......@@ -32,6 +32,7 @@ class ImageSubtitle extends Subtitle {
Widget build(BuildContext context) =>
Row(
children: <Widget>[
buildSentStateIcon(context),
RichText(
text: senderSpan(context),
),
......
......@@ -33,9 +33,14 @@ abstract class Subtitle extends StatelessWidget {
@protected
final String senderName;
final bool isMine;
Subtitle(this.event)
: senderName =
event != null && !event.sender.isIdenticalTo(di.getLocalUser())
: isMine = event.sender.isIdenticalTo(di.getLocalUser()),
senderName =
event != null
&& !event.sender.isIdenticalTo(di.getLocalUser())
&& !event.room.isDirect
? '${displayNameOf(event.sender)}: '
: '';
......@@ -70,4 +75,18 @@ abstract class Subtitle extends StatelessWidget {
color: Theme.of(context).textTheme.caption.color
),
);
Widget buildSentStateIcon(BuildContext context) {
if (isMine) {
return Icon(event.sentState != SentState.sent
? Icons.access_time
: Icons.check,
size: Subtitle.iconSize,
color: Colors.grey,
);
} else {
return Container(height: 0, width: 0);
}
}
}
\ No newline at end of file
......@@ -35,18 +35,25 @@ class TextSubtitle extends Subtitle {
? displayNameOf(event.sender) + ' ' : null
);
if (event.content.inReplyToId == null) {
return RichText(
overflow: TextOverflow.ellipsis,
maxLines: 1,
text: TextSpan(
style: textStyle(context),
children: [
sender,
TextSpan(
text: event.content.body ?? 'null'
)
]
)
return Row(
children: <Widget>[
buildSentStateIcon(context),
Expanded(
child: RichText(
overflow: TextOverflow.ellipsis,
maxLines: 1,
text: TextSpan(
style: textStyle(context),
children: [
sender,
TextSpan(
text: event.content.body ?? 'null'
)
]
)
),
)
],
);
} else {
// Strip replied-to content
......@@ -55,6 +62,7 @@ class TextSubtitle extends Subtitle {
return Row(
children: <Widget>[
buildSentStateIcon(context),
RichText(
overflow: TextOverflow.ellipsis,
maxLines: 1,
......
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