feat(chat): sender avatar on both sides, coloured per person
Feedback: avatars only on the left, all the same colour, so it was hard to tell who said what. In a 1:1 only the peer had an avatar (one colour). Now each message carries its sender's avatar on their own side — mine trailing, the peer's leading — each tinted by a deterministic colour from their pubkey. Two sides, two colours: who-said-what is obvious at a glance.
This commit is contained in:
parent
4af90876f4
commit
dc40640682
2 changed files with 36 additions and 19 deletions
|
|
@ -113,9 +113,7 @@ void main() {
|
|||
expect(find.byKey(const Key('chat.daySeparator')), findsNWidgets(2));
|
||||
});
|
||||
|
||||
testWidgets('the peer bubble carries an avatar, mine does not', (
|
||||
tester,
|
||||
) async {
|
||||
testWidgets('each sender gets a distinctly coloured avatar', (tester) async {
|
||||
final transport = _FakeMessageTransport();
|
||||
final cubit = MessagesCubit(transport, peerPubkey: peer, selfPubkey: me)
|
||||
..start();
|
||||
|
|
@ -126,8 +124,14 @@ void main() {
|
|||
await tester.pumpWidget(host(cubit));
|
||||
await tester.pump();
|
||||
|
||||
// One avatar, for the single peer message; my own bubble has none.
|
||||
expect(find.byType(PeerAvatar), findsOneWidget);
|
||||
// Both sides carry an avatar, and the two people are different colours —
|
||||
// so you can tell who said what at a glance.
|
||||
expect(find.byType(PeerAvatar), findsNWidgets(2));
|
||||
final discs = tester
|
||||
.widgetList<CircleAvatar>(find.byType(CircleAvatar))
|
||||
.toList();
|
||||
expect(discs, hasLength(2));
|
||||
expect(discs.first.backgroundColor, isNot(discs.last.backgroundColor));
|
||||
});
|
||||
|
||||
testWidgets('a new message lands in view at the bottom, not below the fold', (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue