mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-01-23 18:44:10 +01:00
fix: Properly re-render the timeline etc. when the full userinformation was fetched
This commit is contained in:
parent
4a92787feb
commit
f4c527a933
@ -63,7 +63,10 @@ class ChatView extends StatelessWidget {
|
|||||||
redirector.stopRedirection();
|
redirector.stopRedirection();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: StreamBuilder(
|
||||||
|
stream: controller.room.onUpdate.stream
|
||||||
|
.rateLimit(Duration(milliseconds: 250)),
|
||||||
|
builder: (context, snapshot) => Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
actionsIconTheme: IconThemeData(
|
actionsIconTheme: IconThemeData(
|
||||||
color: controller.selectedEvents.isEmpty
|
color: controller.selectedEvents.isEmpty
|
||||||
@ -80,12 +83,9 @@ class ChatView extends StatelessWidget {
|
|||||||
: UnreadBadgeBackButton(roomId: controller.roomId),
|
: UnreadBadgeBackButton(roomId: controller.roomId),
|
||||||
titleSpacing: 0,
|
titleSpacing: 0,
|
||||||
title: controller.selectedEvents.isEmpty
|
title: controller.selectedEvents.isEmpty
|
||||||
? StreamBuilder(
|
? ListTile(
|
||||||
stream: controller.room.onUpdate.stream
|
leading: Avatar(
|
||||||
.rateLimit(Duration(milliseconds: 250)),
|
controller.room.avatar, controller.room.displayname),
|
||||||
builder: (context, snapshot) => ListTile(
|
|
||||||
leading: Avatar(controller.room.avatar,
|
|
||||||
controller.room.displayname),
|
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: EdgeInsets.zero,
|
||||||
onTap: controller.room.isDirectChat
|
onTap: controller.room.isDirectChat
|
||||||
? () => showModalBottomSheet(
|
? () => showModalBottomSheet(
|
||||||
@ -118,17 +118,15 @@ class ChatView extends StatelessWidget {
|
|||||||
controller.room.directChatMatrixID)
|
controller.room.directChatMatrixID)
|
||||||
.rateLimit(Duration(seconds: 1)),
|
.rateLimit(Duration(seconds: 1)),
|
||||||
builder: (context, snapshot) => Text(
|
builder: (context, snapshot) => Text(
|
||||||
controller.room
|
controller.room.getLocalizedStatus(context),
|
||||||
.getLocalizedStatus(context),
|
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
//overflow: TextOverflow.ellipsis,
|
//overflow: TextOverflow.ellipsis,
|
||||||
))
|
))
|
||||||
: Row(
|
: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Icon(Icons.edit_outlined,
|
Icon(Icons.edit_outlined,
|
||||||
color: Theme.of(context)
|
color:
|
||||||
.colorScheme
|
Theme.of(context).colorScheme.secondary,
|
||||||
.secondary,
|
|
||||||
size: 13),
|
size: 13),
|
||||||
SizedBox(width: 4),
|
SizedBox(width: 4),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -137,16 +135,15 @@ class ChatView extends StatelessWidget {
|
|||||||
.getLocalizedTypingText(context),
|
.getLocalizedTypingText(context),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context)
|
color:
|
||||||
.colorScheme
|
Theme.of(context).colorScheme.secondary,
|
||||||
.secondary,
|
|
||||||
fontStyle: FontStyle.italic,
|
fontStyle: FontStyle.italic,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
))
|
)
|
||||||
: Text(controller.selectedEvents.length.toString()),
|
: Text(controller.selectedEvents.length.toString()),
|
||||||
actions: controller.selectMode
|
actions: controller.selectMode
|
||||||
? <Widget>[
|
? <Widget>[
|
||||||
@ -260,6 +257,13 @@ class ChatView extends StatelessWidget {
|
|||||||
thisEventsKeyMap[
|
thisEventsKeyMap[
|
||||||
controller.filteredEvents[i].eventId] = i;
|
controller.filteredEvents[i].eventId] = i;
|
||||||
}
|
}
|
||||||
|
final seenByText =
|
||||||
|
controller.room.getLocalizedSeenByText(
|
||||||
|
context,
|
||||||
|
controller.timeline,
|
||||||
|
controller.filteredEvents,
|
||||||
|
controller.unfolded,
|
||||||
|
);
|
||||||
|
|
||||||
return ListView.custom(
|
return ListView.custom(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
@ -287,33 +291,15 @@ class ChatView extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
: Container()
|
: Container()
|
||||||
: i == 0
|
: i == 0
|
||||||
? StreamBuilder(
|
? AnimatedContainer(
|
||||||
stream: controller
|
height: seenByText.isEmpty ? 0 : 24,
|
||||||
.room.onUpdate.stream
|
|
||||||
.rateLimit(Duration(
|
|
||||||
milliseconds: 250)),
|
|
||||||
builder: (_, __) {
|
|
||||||
final seenByText = controller.room
|
|
||||||
.getLocalizedSeenByText(
|
|
||||||
context,
|
|
||||||
controller.timeline,
|
|
||||||
controller.filteredEvents,
|
|
||||||
controller.unfolded,
|
|
||||||
);
|
|
||||||
return AnimatedContainer(
|
|
||||||
height:
|
|
||||||
seenByText.isEmpty ? 0 : 24,
|
|
||||||
duration: seenByText.isEmpty
|
duration: seenByText.isEmpty
|
||||||
? Duration(milliseconds: 0)
|
? Duration(milliseconds: 0)
|
||||||
: Duration(
|
: Duration(milliseconds: 300),
|
||||||
milliseconds: 300),
|
alignment: controller.filteredEvents
|
||||||
alignment: controller
|
|
||||||
.filteredEvents
|
|
||||||
.isNotEmpty &&
|
.isNotEmpty &&
|
||||||
controller
|
controller.filteredEvents
|
||||||
.filteredEvents
|
.first.senderId ==
|
||||||
.first
|
|
||||||
.senderId ==
|
|
||||||
client.userID
|
client.userID
|
||||||
? Alignment.topRight
|
? Alignment.topRight
|
||||||
: Alignment.topLeft,
|
: Alignment.topLeft,
|
||||||
@ -330,14 +316,12 @@ class ChatView extends StatelessWidget {
|
|||||||
.scaffoldBackgroundColor
|
.scaffoldBackgroundColor
|
||||||
.withOpacity(0.8),
|
.withOpacity(0.8),
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.circular(
|
BorderRadius.circular(4),
|
||||||
4),
|
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
seenByText,
|
seenByText,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow:
|
overflow: TextOverflow.ellipsis,
|
||||||
TextOverflow.ellipsis,
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
@ -345,8 +329,6 @@ class ChatView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
: AutoScrollTag(
|
: AutoScrollTag(
|
||||||
key: ValueKey(controller
|
key: ValueKey(controller
|
||||||
@ -764,7 +746,9 @@ class ChatView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
));
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user