fix: Receipt row not auto updating
This commit is contained in:
parent
6bdefc43e9
commit
51ae4390ab
1 changed files with 62 additions and 49 deletions
|
|
@ -14,58 +14,71 @@ class SeenByRow extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
|
|
||||||
final seenByUsers = controller.room.getSeenByUsers(controller.timeline!);
|
|
||||||
const maxAvatars = 7;
|
const maxAvatars = 7;
|
||||||
return Container(
|
return StreamBuilder(
|
||||||
width: double.infinity,
|
stream: controller.room.client.onSync.stream.where(
|
||||||
alignment: Alignment.center,
|
(syncUpdate) =>
|
||||||
child: AnimatedContainer(
|
syncUpdate.rooms?.join?[controller.room.id]?.ephemeral?.any(
|
||||||
constraints: const BoxConstraints(
|
(ephemeral) => ephemeral.type == 'm.receipt',
|
||||||
maxWidth: FluffyThemes.maxTimelineWidth,
|
) ??
|
||||||
),
|
false,
|
||||||
height: seenByUsers.isEmpty ? 0 : 24,
|
),
|
||||||
duration: seenByUsers.isEmpty
|
builder: (context, asyncSnapshot) {
|
||||||
? Duration.zero
|
final seenByUsers = controller.room.getSeenByUsers(
|
||||||
: FluffyThemes.animationDuration,
|
controller.timeline!,
|
||||||
curve: FluffyThemes.animationCurve,
|
);
|
||||||
alignment:
|
return Container(
|
||||||
controller.timeline!.events.isNotEmpty &&
|
width: double.infinity,
|
||||||
controller.timeline!.events.first.senderId ==
|
alignment: Alignment.center,
|
||||||
Matrix.of(context).client.userID
|
child: AnimatedContainer(
|
||||||
? Alignment.topRight
|
constraints: const BoxConstraints(
|
||||||
: Alignment.topLeft,
|
maxWidth: FluffyThemes.maxTimelineWidth,
|
||||||
padding: const EdgeInsets.only(left: 8, right: 8, bottom: 4),
|
),
|
||||||
child: Wrap(
|
height: seenByUsers.isEmpty ? 0 : 24,
|
||||||
spacing: 4,
|
duration: seenByUsers.isEmpty
|
||||||
children: [
|
? Duration.zero
|
||||||
...(seenByUsers.length > maxAvatars
|
: FluffyThemes.animationDuration,
|
||||||
? seenByUsers.sublist(0, maxAvatars)
|
curve: FluffyThemes.animationCurve,
|
||||||
: seenByUsers)
|
alignment:
|
||||||
.map(
|
controller.timeline!.events.isNotEmpty &&
|
||||||
(user) => Avatar(
|
controller.timeline!.events.first.senderId ==
|
||||||
mxContent: user.avatarUrl,
|
Matrix.of(context).client.userID
|
||||||
name: user.calcDisplayname(),
|
? Alignment.topRight
|
||||||
size: 16,
|
: Alignment.topLeft,
|
||||||
),
|
padding: const EdgeInsets.only(left: 8, right: 8, bottom: 4),
|
||||||
),
|
child: Wrap(
|
||||||
if (seenByUsers.length > maxAvatars)
|
spacing: 4,
|
||||||
SizedBox(
|
children: [
|
||||||
width: 16,
|
...(seenByUsers.length > maxAvatars
|
||||||
height: 16,
|
? seenByUsers.sublist(0, maxAvatars)
|
||||||
child: Material(
|
: seenByUsers)
|
||||||
color: theme.colorScheme.surface,
|
.map(
|
||||||
borderRadius: BorderRadius.circular(32),
|
(user) => Avatar(
|
||||||
child: Center(
|
mxContent: user.avatarUrl,
|
||||||
child: Text(
|
name: user.calcDisplayname(),
|
||||||
'+${seenByUsers.length - maxAvatars}',
|
size: 16,
|
||||||
style: const TextStyle(fontSize: 9),
|
),
|
||||||
|
),
|
||||||
|
if (seenByUsers.length > maxAvatars)
|
||||||
|
SizedBox(
|
||||||
|
width: 16,
|
||||||
|
height: 16,
|
||||||
|
child: Material(
|
||||||
|
color: theme.colorScheme.surface,
|
||||||
|
borderRadius: BorderRadius.circular(32),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'+${seenByUsers.length - maxAvatars}',
|
||||||
|
style: const TextStyle(fontSize: 9),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
);
|
||||||
),
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue