mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-24 04:59:26 +01:00
fix: Load story avatars faster
This commit is contained in:
parent
ed236f345f
commit
df98254640
@ -121,22 +121,31 @@ class StoriesHeader extends StatelessWidget {
|
||||
...client.storiesRooms.map(
|
||||
(room) => Opacity(
|
||||
opacity: room.hasPosts ? 1 : 0.75,
|
||||
child: _StoryButton(
|
||||
label: room.creatorDisplayname,
|
||||
child: Avatar(
|
||||
mxContent: room
|
||||
child: FutureBuilder<Profile>(
|
||||
future: room.getCreatorProfile(),
|
||||
builder: (context, snapshot) {
|
||||
final displayname = snapshot.data?.displayName ??
|
||||
room
|
||||
.getState(EventTypes.RoomCreate)!
|
||||
.sender
|
||||
.avatarUrl,
|
||||
name: room.creatorDisplayname,
|
||||
.senderId
|
||||
.localpart!;
|
||||
final avatarUrl = snapshot.data?.avatarUrl;
|
||||
return _StoryButton(
|
||||
label: displayname,
|
||||
child: Avatar(
|
||||
mxContent: avatarUrl,
|
||||
name: displayname,
|
||||
size: 100,
|
||||
fontSize: 24,
|
||||
),
|
||||
unread: room.membership == Membership.invite ||
|
||||
room.hasNewMessages,
|
||||
onPressed: () => _goToStoryAction(context, room.id),
|
||||
onLongPressed: () => _contextualActions(context, room),
|
||||
),
|
||||
onPressed: () =>
|
||||
_goToStoryAction(context, room.id),
|
||||
onLongPressed: () =>
|
||||
_contextualActions(context, room),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -148,8 +157,8 @@ class StoriesHeader extends StatelessWidget {
|
||||
}
|
||||
|
||||
extension on Room {
|
||||
String get creatorDisplayname =>
|
||||
getState(EventTypes.RoomCreate)!.sender.calcDisplayname();
|
||||
Future<Profile> getCreatorProfile() =>
|
||||
client.getProfileFromUserId(getState(EventTypes.RoomCreate)!.senderId);
|
||||
|
||||
bool get hasPosts {
|
||||
if (membership == Membership.invite) return true;
|
||||
|
Loading…
Reference in New Issue
Block a user