Files
buzz/mobile/lib/features/channels/compose_bar/dock.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

224 lines
8.0 KiB
Dart

part of '../compose_bar.dart';
class _ComposerDockFrame extends HookWidget {
final Animation<double> expansionAnimation;
final bool forceFullWidth;
final Widget child;
const _ComposerDockFrame({
required this.expansionAnimation,
required this.forceFullWidth,
required this.child,
});
@override
Widget build(BuildContext context) {
final reducedMotion = MediaQuery.disableAnimationsOf(context);
final recordingTransition = useAnimationController(
duration: reducedMotion
? Duration.zero
: const Duration(milliseconds: 200),
reverseDuration: reducedMotion
? Duration.zero
: const Duration(milliseconds: 140),
initialValue: forceFullWidth ? 1 : 0,
);
useEffect(() {
if (forceFullWidth) {
recordingTransition.value = math.max(
recordingTransition.value,
expansionAnimation.value.clamp(0.0, 1.0),
);
recordingTransition.forward();
} else {
recordingTransition.reverse();
}
return null;
}, [forceFullWidth, reducedMotion]);
const compactVerticalOffset = Grid.twelve + Grid.quarter;
final visibleBottomGutter = math.max(
Grid.twelve,
MediaQuery.viewPaddingOf(context).bottom +
Grid.xxs -
compactVerticalOffset,
);
final recordingGutterDelta = visibleBottomGutter - Grid.twelve;
final backdropHeight = mobileTabFooterBackdropHeight(context);
return Stack(
clipBehavior: Clip.none,
children: [
Positioned(
key: const ValueKey('composer-footer-gradient'),
left: 0,
right: 0,
bottom: 0,
height: backdropHeight,
child: IgnorePointer(
child: MobileTabFooterBackdrop(height: backdropHeight),
),
),
Padding(
padding: EdgeInsets.only(
left: composerHorizontalGutter,
right: composerHorizontalGutter,
bottom: MediaQuery.viewPaddingOf(context).bottom + Grid.xxs,
),
child: Align(
alignment: Alignment.bottomCenter,
child: AnimatedBuilder(
animation: Listenable.merge([
expansionAnimation,
recordingTransition,
]),
child: child,
builder: (context, child) {
final widthProgress = math.max(
expansionAnimation.value.clamp(0.0, 1.0),
recordingTransition.value,
);
final expansionProgress = expansionAnimation.value.clamp(
0.0,
1.0,
);
final compactPositionProgress = 1 - expansionProgress;
return Transform.translate(
key: const ValueKey('composer-position-transition'),
offset: Offset(
0,
compactVerticalOffset * compactPositionProgress,
),
child: Padding(
key: const ValueKey('composer-recording-outer-gutter'),
padding: EdgeInsets.symmetric(
horizontal: forceFullWidth
? recordingGutterDelta * compactPositionProgress
: 0,
),
child: FractionallySizedBox(
key: const ValueKey('composer-width-transition'),
widthFactor:
collapsedComposerWidthFactor +
(1 - collapsedComposerWidthFactor) * widthProgress,
child: child,
),
),
);
},
),
),
),
],
);
}
}
class _ComposerOverlayPortal extends StatelessWidget {
final OverlayPortalController controller;
final ValueListenable<_AttachmentSurface> attachmentSurface;
final bool reducedMotion;
final Widget Function(_AttachmentSurface surface) buildOverlayPanel;
final VoidCallback onDismissAttachmentSurface;
final Widget child;
const _ComposerOverlayPortal({
required this.controller,
required this.attachmentSurface,
required this.reducedMotion,
required this.buildOverlayPanel,
required this.onDismissAttachmentSurface,
required this.child,
});
@override
Widget build(BuildContext context) {
return OverlayPortal.overlayChildLayoutBuilder(
controller: controller,
overlayChildBuilder: (context, layoutInfo) {
final composerOrigin = MatrixUtils.transformPoint(
layoutInfo.childPaintTransform,
Offset.zero,
);
return ValueListenableBuilder<_AttachmentSurface>(
valueListenable: attachmentSurface,
builder: (context, surface, _) {
final surfaceDuration = reducedMotion
? Duration.zero
: Duration(
milliseconds:
surface == _AttachmentSurface.camera ||
surface == _AttachmentSurface.photos
? 320
: 250,
);
final expandedSurfaceCoversComposer =
surface == _AttachmentSurface.camera ||
surface == _AttachmentSurface.photos;
final surfaceLeft = expandedSurfaceCoversComposer
? Grid.twelve
: composerOrigin.dx;
final surfaceWidth = expandedSurfaceCoversComposer
? layoutInfo.overlaySize.width - (Grid.twelve * 2)
: layoutInfo.childSize.width;
final overlayAnchorY =
composerOrigin.dy +
(expandedSurfaceCoversComposer
? layoutInfo.childSize.height + Grid.twelve
: 0);
return Stack(
children: [
if (surface != _AttachmentSurface.closed)
Positioned(
left: 0,
top: 0,
right: 0,
height: composerOrigin.dy,
child: ExcludeSemantics(
child: GestureDetector(
key: const ValueKey('attachment-dismiss-barrier'),
behavior: HitTestBehavior.opaque,
onTap: onDismissAttachmentSurface,
),
),
),
AnimatedPositioned(
duration: surfaceDuration,
curve:
surface == _AttachmentSurface.camera ||
surface == _AttachmentSurface.photos
? const Cubic(0.34, 1.25, 0.64, 1)
: const Cubic(0.22, 1, 0.36, 1),
left: surfaceLeft,
bottom: layoutInfo.overlaySize.height - overlayAnchorY,
width: surfaceWidth,
child: ConstrainedBox(
// The suggestions grow upward from the composer, so cap
// them at the space above it. A short view, such as
// landscape with the keyboard up, then keeps the top row
// on screen instead of honoring a reserved height.
constraints: BoxConstraints(
maxHeight: surface == _AttachmentSurface.closed
? math.max(
0,
overlayAnchorY -
MediaQuery.paddingOf(context).top,
)
: double.infinity,
),
child: ClipRect(
child: Padding(
padding: const EdgeInsets.only(bottom: Grid.xxs),
child: buildOverlayPanel(surface),
),
),
),
),
],
);
},
);
},
child: child,
);
}
}