mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 23:09:35 +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(
|
...client.storiesRooms.map(
|
||||||
(room) => Opacity(
|
(room) => Opacity(
|
||||||
opacity: room.hasPosts ? 1 : 0.75,
|
opacity: room.hasPosts ? 1 : 0.75,
|
||||||
child: _StoryButton(
|
child: FutureBuilder<Profile>(
|
||||||
label: room.creatorDisplayname,
|
future: room.getCreatorProfile(),
|
||||||
child: Avatar(
|
builder: (context, snapshot) {
|
||||||
mxContent: room
|
final displayname = snapshot.data?.displayName ??
|
||||||
|
room
|
||||||
.getState(EventTypes.RoomCreate)!
|
.getState(EventTypes.RoomCreate)!
|
||||||
.sender
|
.senderId
|
||||||
.avatarUrl,
|
.localpart!;
|
||||||
name: room.creatorDisplayname,
|
final avatarUrl = snapshot.data?.avatarUrl;
|
||||||
|
return _StoryButton(
|
||||||
|
label: displayname,
|
||||||
|
child: Avatar(
|
||||||
|
mxContent: avatarUrl,
|
||||||
|
name: displayname,
|
||||||
size: 100,
|
size: 100,
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
),
|
),
|
||||||
unread: room.membership == Membership.invite ||
|
unread: room.membership == Membership.invite ||
|
||||||
room.hasNewMessages,
|
room.hasNewMessages,
|
||||||
onPressed: () => _goToStoryAction(context, room.id),
|
onPressed: () =>
|
||||||
onLongPressed: () => _contextualActions(context, room),
|
_goToStoryAction(context, room.id),
|
||||||
),
|
onLongPressed: () =>
|
||||||
|
_contextualActions(context, room),
|
||||||
|
);
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -148,8 +157,8 @@ class StoriesHeader extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension on Room {
|
extension on Room {
|
||||||
String get creatorDisplayname =>
|
Future<Profile> getCreatorProfile() =>
|
||||||
getState(EventTypes.RoomCreate)!.sender.calcDisplayname();
|
client.getProfileFromUserId(getState(EventTypes.RoomCreate)!.senderId);
|
||||||
|
|
||||||
bool get hasPosts {
|
bool get hasPosts {
|
||||||
if (membership == Membership.invite) return true;
|
if (membership == Membership.invite) return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user