Files
buzz/mobile/test/shared/widgets/dm_header_cluster_test.dart
klopez4212 96e56c5b33 Add participant avatars to mobile conversation headers (#9369)
## Summary

Add participant portraits to mobile conversation headers, with up to
four portraits in a compact cluster. DM and Solo headers show
counterparts; channel headers use the member roster. Names stay on one
line, and tapping either the portrait or title opens the existing
settings.

- iOS: float portraits above the glass title capsule; lift standalone
animated artwork and tuck the title underneath.
- Android: place the cluster inside a left-aligned title pill, 16 dp
after Back, with smaller agent portraits and a 48 dp tap target.
- Remove header presence/member-count subtitles. In confirmed two-member
conversations (DM, Solo, or channel), hide redundant incoming author
avatars and give text the freed 48 dp while retaining the previous total
width. Apply this to thread replies and align their footers; messages
with avatars and outgoing messages retain their production width caps.

Keep sender attribution visible while DM metadata and current membership
disagree. Forum loading, error, and post-list states reserve the full
conversation header height. The floating title follows the app-selected
appearance, including when it differs from iOS. Conversation headers
remain name-only, including temporary conversations, as requested;
retention accessibility text is preserved.

## Validation

- Formatting/static analysis and full mobile suite: 4,695 passed, 71
skipped; auxiliary push and crypto suites passed.
- Full native iOS suite passed, including title positioning/reset and
settings activation.
- Installed previews on physical iPhone Air and Pixel; Android
avatar/title settings taps exercised.
- Final diff reviewed for correctness, accessibility, scope, and
public-source boundaries; no blocking findings.

The width follow-up is covered by rendered conversation/thread tests.
The width follow-up is installed and launched on iPhone Air; the Pixel
preview remains on the preceding header build. The review fixes have not
been installed on physical devices.

## Snapshots

Current Pixel preview, cropped to the header to omit conversation
history. These captures show a single agent and a four-portrait cluster.
The current iOS preview is installed, but a fresh physical-device
screenshot was blocked by device authentication; no outdated iOS capture
is included.

### Android — single agent

![Android single-agent
header](https://github.com/user-attachments/assets/9ecb45b7-a2e0-4699-8889-ab7934fd1759)

### Android — grouped agents

![Android grouped-agent
header](https://github.com/user-attachments/assets/f4435720-0d10-4b4e-98c2-5494dc9a83c4)

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
2026-11-11 15:28:39 -08:00

51 lines
1.7 KiB
Dart

import 'package:buzz/shared/widgets/dm_header_cluster.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets(
'conversation cluster fits one through many portraits without overlap',
(tester) async {
for (final count in [1, 2, 3, 4, 8]) {
await tester.pumpWidget(
MaterialApp(
home: Center(
child: DmHeaderCluster(
count: count,
builder: (i, size) => SizedBox.square(
key: ValueKey('portrait-$i'),
dimension: size,
),
),
),
),
);
final cluster = tester.getRect(find.byType(DmHeaderCluster));
expect(cluster.size, const Size(64, 64));
final visible = count.clamp(0, 4);
final rectangles = [
for (var i = 0; i < visible; i++)
tester.getRect(find.byKey(ValueKey('portrait-$i'))),
];
expect(find.byKey(ValueKey('portrait-$visible')), findsNothing);
for (var i = 0; i < rectangles.length; i++) {
final portrait = rectangles[i];
expect(
(portrait.center - cluster.center).distance + portrait.width / 2,
lessThanOrEqualTo(32.01),
);
for (var j = i + 1; j < rectangles.length; j++) {
expect(
(portrait.center - rectangles[j].center).distance,
greaterThanOrEqualTo((portrait.width + rectangles[j].width) / 2),
);
}
}
if (count > 1) {
expect(rectangles.map((r) => r.width).toSet().length, visible);
}
}
},
);
}