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(
|
...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 ??
|
||||||
.getState(EventTypes.RoomCreate)!
|
room
|
||||||
.sender
|
.getState(EventTypes.RoomCreate)!
|
||||||
.avatarUrl,
|
.senderId
|
||||||
name: room.creatorDisplayname,
|
.localpart!;
|
||||||
size: 100,
|
final avatarUrl = snapshot.data?.avatarUrl;
|
||||||
fontSize: 24,
|
return _StoryButton(
|
||||||
),
|
label: displayname,
|
||||||
unread: room.membership == Membership.invite ||
|
child: Avatar(
|
||||||
room.hasNewMessages,
|
mxContent: avatarUrl,
|
||||||
onPressed: () => _goToStoryAction(context, room.id),
|
name: displayname,
|
||||||
onLongPressed: () => _contextualActions(context, room),
|
size: 100,
|
||||||
),
|
fontSize: 24,
|
||||||
|
),
|
||||||
|
unread: room.membership == Membership.invite ||
|
||||||
|
room.hasNewMessages,
|
||||||
|
onPressed: () =>
|
||||||
|
_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