fix: Update read receipt display

This commit is contained in:
Christian Pauly 2021-02-13 10:34:02 +01:00
parent bd24387212
commit de6e49515e

View File

@ -60,8 +60,6 @@ class _ChatState extends State<Chat> {
MatrixState matrix; MatrixState matrix;
String seenByText = '';
final AutoScrollController _scrollController = AutoScrollController(); final AutoScrollController _scrollController = AutoScrollController();
FocusNode inputFocus = FocusNode(); FocusNode inputFocus = FocusNode();
@ -150,8 +148,6 @@ class _ChatState extends State<Chat> {
() { () {
filteredEvents = filteredEvents =
timeline.getFilteredEvents(collapseRoomCreate: _collapseRoomCreate); timeline.getFilteredEvents(collapseRoomCreate: _collapseRoomCreate);
seenByText =
room.getLocalizedSeenByText(context, timeline, filteredEvents);
}, },
); );
} }
@ -751,41 +747,51 @@ class _ChatState extends State<Chat> {
) )
: Container() : Container()
: i == 0 : i == 0
? AnimatedContainer( ? StreamBuilder(
height: seenByText.isEmpty ? 0 : 24, stream: room.onUpdate.stream,
duration: seenByText.isEmpty builder: (_, __) {
? Duration(milliseconds: 0) final seenByText =
: Duration(milliseconds: 300), room.getLocalizedSeenByText(
alignment: context,
filteredEvents.first.senderId == timeline,
client.userID filteredEvents);
? Alignment.topRight return AnimatedContainer(
: Alignment.topLeft, height: seenByText.isEmpty ? 0 : 24,
child: Container( duration: seenByText.isEmpty
padding: EdgeInsets.symmetric( ? Duration(milliseconds: 0)
horizontal: 4), : Duration(milliseconds: 300),
decoration: BoxDecoration( alignment:
color: Theme.of(context) filteredEvents.first.senderId ==
.scaffoldBackgroundColor client.userID
.withOpacity(0.8), ? Alignment.topRight
borderRadius: : Alignment.topLeft,
BorderRadius.circular(4), child: Container(
), padding: EdgeInsets.symmetric(
child: Text( horizontal: 4),
seenByText, decoration: BoxDecoration(
maxLines: 1, color: Theme.of(context)
overflow: TextOverflow.ellipsis, .scaffoldBackgroundColor
style: TextStyle( .withOpacity(0.8),
color: borderRadius:
Theme.of(context).accentColor, BorderRadius.circular(4),
),
child: Text(
seenByText,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Theme.of(context)
.accentColor,
),
),
), ),
), padding: EdgeInsets.only(
), left: 8,
padding: EdgeInsets.only( right: 8,
left: 8, bottom: 8,
right: 8, ),
bottom: 8, );
), },
) )
: AutoScrollTag( : AutoScrollTag(
key: ValueKey( key: ValueKey(