Skip to content

Commit e236329

Browse files
klopez4212CarlPrincess Donutleaderbrow
authored
Polish Huddle participant interactions (#6312)
## Summary - arrange Huddle participants in a responsive, equal-weight cluster with spring enter/exit motion and a `+N` overflow - spotlight tapped participants over a blurred call surface, with a roster for hidden participants and no self-avatar action - add selection haptics across full-screen and drawer controls, including both end-call buttons <img width="1080" height="2424" alt="Screenshot_20260819-151448" src="https://github.com/user-attachments/assets/00b7fdca-2304-4788-9952-e07224798513" /> <img width="1080" height="2424" alt="Screenshot_20260819-151422" src="https://github.com/user-attachments/assets/a0cfc861-0519-44ff-bb56-4c983ed6344c" /> ## Validation - `just mobile-check` - focused participant, drawer-control, and full-screen end-call widget tests - Huddle-focused widget suite (15 tests) - full mobile Flutter suite (1,538 tests) ## Dependency Built on #6056 and contains only the follow-up interaction work. Merge after #6056 lands. --------- Signed-off-by: kenny lopez <[email protected]> Signed-off-by: Kenny Lopez <[email protected]> Signed-off-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz> Signed-off-by: Tom Brow <[email protected]> Co-authored-by: Carl <3c4caeafb646d23867f1c4832e68211d77e2561946171625f75c3ce1a3f2670f@buzz.block.builderlab.xyz> Co-authored-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz> Co-authored-by: leader <71e9f2c44a6932b6772caaaccda1911d010463c3e2c6c40410b8329956046801@buzz.block.builderlab.xyz> Co-authored-by: Tom Brow <[email protected]> Co-authored-by: Mongo <9cfd347903944d5b85aa6c93d2ab67381b978a92a31914bca69998968752a1d7@buzz.block.builderlab.xyz>
1 parent 4baccd5 commit e236329

9 files changed

Lines changed: 1159 additions & 213 deletions

‎mobile/lib/features/channels/channel_detail_page.dart‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import 'dart:async';
22
import 'dart:math' show cos, max, min, pi;
3+
import 'dart:ui' show ImageFilter, lerpDouble;
34

45
import 'package:flutter/foundation.dart';
56
import 'package:flutter/material.dart';
67
import 'package:flutter/rendering.dart' show ScrollDirection;
8+
import 'package:flutter/services.dart';
79
import 'package:flutter_hooks/flutter_hooks.dart';
810
import 'package:hooks_riverpod/hooks_riverpod.dart';
911
import 'package:lucide_icons_flutter/lucide_icons.dart';
@@ -79,7 +81,9 @@ part 'channel_detail_page/message_list.dart';
7981
part 'channel_detail_page/system_rows.dart';
8082
part 'channel_detail_page/huddle_sheet.dart';
8183
part 'channel_detail_page/huddle_call_avatar.dart';
84+
part 'channel_detail_page/huddle_participant_cluster.dart';
8285
part 'channel_detail_page/huddle_call_participants.dart';
86+
part 'channel_detail_page/huddle_participant_overlay.dart';
8387
part 'channel_detail_page/huddle_call_controls.dart';
8488
part 'channel_detail_page/huddle_drawer.dart';
8589
part 'channel_detail_page/huddle_reactions.dart';

‎mobile/lib/features/channels/channel_detail_page/huddle_call_avatar.dart‎

Lines changed: 29 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class _HuddleCallAvatar extends HookConsumerWidget {
77
required this.fallbackLabel,
88
required this.active,
99
required this.speakerLevel,
10+
required this.onTap,
1011
this.isSelf = false,
1112
this.frameSize = _huddleAvatarFrameSize,
1213
});
@@ -16,6 +17,7 @@ class _HuddleCallAvatar extends HookConsumerWidget {
1617
final String? fallbackLabel;
1718
final bool active;
1819
final double speakerLevel;
20+
final VoidCallback? onTap;
1921
final bool isSelf;
2022
final double frameSize;
2123

@@ -56,31 +58,28 @@ class _HuddleCallAvatar extends HookConsumerWidget {
5658
originRegistry.register(pubkey, originKey);
5759
return () => originRegistry.unregister(pubkey, originKey);
5860
}, [originRegistry, pubkey, originKey]);
59-
final showsLabel = useState(false);
60-
final profileName = profile?.displayName?.trim();
61-
final directoryName = fallbackLabel?.trim();
62-
final label = isSelf
63-
? 'You'
64-
: (profileName?.isNotEmpty == true ? profileName : null) ??
65-
(directoryName?.isNotEmpty == true ? directoryName : null) ??
66-
(pubkey.isEmpty ? 'Participant' : shortPubkey(pubkey));
67-
void toggleLabel() => showsLabel.value = !showsLabel.value;
61+
final label = _huddleParticipantLabel(
62+
pubkey: pubkey,
63+
profile: profile,
64+
fallbackLabel: fallbackLabel,
65+
isSelf: isSelf,
66+
);
6867

6968
return SizedBox(
7069
width: frameSize,
7170
child: Semantics(
7271
label: active ? '$label, speaking' : label,
73-
hint: showsLabel.value
74-
? 'Tap to hide participant name'
75-
: 'Tap to show participant name',
76-
button: true,
77-
onTap: toggleLabel,
72+
hint: onTap == null ? null : 'Tap to focus participant',
73+
button: onTap != null,
74+
onTap: onTap,
7875
excludeSemantics: true,
7976
child: GestureDetector(
8077
key: ValueKey('huddle-participant-avatar-$pubkey'),
81-
behavior: HitTestBehavior.opaque,
78+
behavior: onTap == null
79+
? HitTestBehavior.deferToChild
80+
: HitTestBehavior.opaque,
8281
excludeFromSemantics: true,
83-
onTap: toggleLabel,
82+
onTap: onTap,
8483
child: Column(
8584
mainAxisSize: MainAxisSize.min,
8685
crossAxisAlignment: CrossAxisAlignment.center,
@@ -136,54 +135,24 @@ class _HuddleCallAvatar extends HookConsumerWidget {
136135
),
137136
),
138137
),
139-
AnimatedSwitcher(
140-
key: ValueKey('huddle-participant-label-reveal-$pubkey'),
141-
duration: reducedMotion
142-
? Duration.zero
143-
: const Duration(milliseconds: 180),
144-
reverseDuration: reducedMotion
145-
? Duration.zero
146-
: const Duration(milliseconds: 140),
147-
switchInCurve: Curves.easeOutCubic,
148-
switchOutCurve: Curves.easeInCubic,
149-
layoutBuilder: (currentChild, previousChildren) => Stack(
150-
alignment: Alignment.topCenter,
151-
children: [...previousChildren, ?currentChild],
152-
),
153-
transitionBuilder: (child, animation) => FadeTransition(
154-
opacity: animation,
155-
child: SizeTransition(
156-
sizeFactor: animation,
157-
axisAlignment: -1,
158-
child: child,
159-
),
160-
),
161-
child: showsLabel.value
162-
? Padding(
163-
key: ValueKey('huddle-participant-label-$pubkey'),
164-
padding: const EdgeInsets.only(top: Grid.half),
165-
child: SizedBox(
166-
width: frameSize,
167-
child: Text(
168-
label,
169-
maxLines: 1,
170-
overflow: TextOverflow.ellipsis,
171-
textAlign: TextAlign.center,
172-
style: context.textTheme.labelLarge?.copyWith(
173-
color: context.colors.onSurface,
174-
fontWeight: active ? FontWeight.w600 : null,
175-
),
176-
),
177-
),
178-
)
179-
: SizedBox(
180-
key: ValueKey('huddle-participant-label-empty-$pubkey'),
181-
),
182-
),
183138
],
184139
),
185140
),
186141
),
187142
);
188143
}
189144
}
145+
146+
String _huddleParticipantLabel({
147+
required String pubkey,
148+
required UserProfile? profile,
149+
required String? fallbackLabel,
150+
required bool isSelf,
151+
}) {
152+
if (isSelf) return 'You';
153+
final profileName = profile?.displayName?.trim();
154+
final directoryName = fallbackLabel?.trim();
155+
return (profileName?.isNotEmpty == true ? profileName : null) ??
156+
(directoryName?.isNotEmpty == true ? directoryName : null) ??
157+
(pubkey.isEmpty ? 'Participant' : shortPubkey(pubkey));
158+
}

‎mobile/lib/features/channels/channel_detail_page/huddle_call_controls.dart‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class _HuddleCallControls extends StatelessWidget {
3535
: context.colors.surfaceContainerHighest,
3636
dimension: 80,
3737
toggled: isSpeakerEnabled,
38+
useHapticFeedback: true,
3839
onPressed: onToggleSpeaker,
3940
),
4041
const SizedBox(width: Grid.sm),
@@ -50,6 +51,7 @@ class _HuddleCallControls extends StatelessWidget {
5051
: context.colors.primary,
5152
dimension: 80,
5253
toggled: isMuted,
54+
useHapticFeedback: true,
5355
onPressed: onToggleMute,
5456
),
5557
const SizedBox(width: Grid.sm),
@@ -60,6 +62,7 @@ class _HuddleCallControls extends StatelessWidget {
6062
foregroundColor: context.colors.onSurface,
6163
backgroundColor: context.colors.surfaceContainerHighest,
6264
dimension: 80,
65+
useHapticFeedback: true,
6366
onPressed: onReact,
6467
),
6568
],
@@ -79,6 +82,7 @@ class _HuddleRoundControl extends StatelessWidget {
7982
this.dimension = 64,
8083
this.showTooltip = true,
8184
this.toggled,
85+
this.useHapticFeedback = false,
8286
});
8387

8488
final String tooltip;
@@ -89,21 +93,31 @@ class _HuddleRoundControl extends StatelessWidget {
8993
final double dimension;
9094
final bool showTooltip;
9195
final bool? toggled;
96+
final bool useHapticFeedback;
9297

9398
@override
9499
Widget build(BuildContext context) {
100+
final effectiveOnPressed = onPressed == null
101+
? null
102+
: () {
103+
if (useHapticFeedback) {
104+
unawaited(HapticFeedback.selectionClick());
105+
}
106+
onPressed!();
107+
};
108+
95109
return Semantics(
96110
label: tooltip,
97111
button: true,
98112
enabled: onPressed != null,
99113
toggled: toggled,
100-
onTap: onPressed,
114+
onTap: effectiveOnPressed,
101115
child: ExcludeSemantics(
102116
child: SizedBox.square(
103117
dimension: dimension,
104118
child: IconButton(
105119
tooltip: showTooltip ? tooltip : null,
106-
onPressed: onPressed,
120+
onPressed: effectiveOnPressed,
107121
style: IconButton.styleFrom(
108122
foregroundColor: foregroundColor,
109123
backgroundColor: backgroundColor,

‎mobile/lib/features/channels/channel_detail_page/huddle_call_participants.dart‎

Lines changed: 22 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ class _HuddleCallParticipants extends StatelessWidget {
1313
required this.retryTooltip,
1414
required this.retryIcon,
1515
required this.onRetry,
16+
required this.onParticipantTap,
17+
required this.onOverflowTap,
1618
});
1719

1820
final bool connected;
@@ -26,6 +28,8 @@ class _HuddleCallParticipants extends StatelessWidget {
2628
final String retryTooltip;
2729
final IconData retryIcon;
2830
final VoidCallback onRetry;
31+
final ValueChanged<String> onParticipantTap;
32+
final VoidCallback onOverflowTap;
2933

3034
@override
3135
Widget build(BuildContext context) {
@@ -74,10 +78,13 @@ class _HuddleCallParticipants extends StatelessWidget {
7478
final localHeightFactor = hasDenseRemoteRoster ? 0.42 : 0.5;
7579
final movementDuration = reducedMotion
7680
? Duration.zero
77-
: const Duration(milliseconds: 260);
81+
: const Duration(milliseconds: 360);
7882
final entryDuration = reducedMotion
7983
? Duration.zero
80-
: const Duration(milliseconds: 180);
84+
: const Duration(milliseconds: 420);
85+
final exitDuration = reducedMotion
86+
? Duration.zero
87+
: const Duration(milliseconds: 360);
8188

8289
return Stack(
8390
key: const ValueKey('huddle-participant-stage'),
@@ -87,7 +94,7 @@ class _HuddleCallParticipants extends StatelessWidget {
8794
child: TweenAnimationBuilder<double>(
8895
key: const ValueKey('huddle-local-participant-motion'),
8996
duration: movementDuration,
90-
curve: Curves.easeInOutCubic,
97+
curve: Curves.easeOutBack,
9198
tween: Tween(
9299
begin: hasRemoteParticipants ? 1 : 0,
93100
end: hasRemoteParticipants ? 1 : 0,
@@ -120,6 +127,7 @@ class _HuddleCallParticipants extends StatelessWidget {
120127
? 0
121128
: speakerLevels[localPubkey] ?? 0,
122129
isSelf: true,
130+
onTap: null,
123131
),
124132
),
125133
),
@@ -131,54 +139,17 @@ class _HuddleCallParticipants extends StatelessWidget {
131139
child: Align(
132140
key: const ValueKey('huddle-remote-participant-group'),
133141
alignment: const Alignment(0, 0.35),
134-
child: LayoutBuilder(
135-
builder: (context, constraints) {
136-
final layout = _HuddleParticipantLayout.fit(
137-
availableSize: constraints.biggest,
138-
participantCount: remotePubkeys.length,
139-
dense: hasDenseRemoteRoster,
140-
);
141-
return TweenAnimationBuilder<double>(
142-
key: const ValueKey('huddle-remote-participants'),
143-
duration: movementDuration,
144-
curve: Curves.easeInOutCubic,
145-
tween: Tween(end: layout.frameSize),
146-
builder: (context, frameSize, _) => Wrap(
147-
alignment: WrapAlignment.center,
148-
runAlignment: WrapAlignment.center,
149-
spacing: layout.spacing,
150-
runSpacing: layout.runSpacing,
151-
children: [
152-
for (final pubkey in remotePubkeys)
153-
SizedBox(
154-
key: ValueKey('huddle-participant-entry-$pubkey'),
155-
width: frameSize,
156-
height: frameSize + _huddleParticipantLabelSpace,
157-
child: TweenAnimationBuilder<double>(
158-
duration: entryDuration,
159-
curve: Curves.easeOutCubic,
160-
tween: Tween(begin: 0, end: 1),
161-
builder: (context, value, child) => Opacity(
162-
opacity: value,
163-
child: Transform.scale(
164-
scale: 0.95 + value * 0.05,
165-
child: child,
166-
),
167-
),
168-
child: _HuddleCallAvatar(
169-
pubkey: pubkey,
170-
profile: profiles[pubkey],
171-
fallbackLabel: fallbackLabels[pubkey],
172-
active: activeSpeakerPubkeys.contains(pubkey),
173-
speakerLevel: speakerLevels[pubkey] ?? 0,
174-
frameSize: frameSize,
175-
),
176-
),
177-
),
178-
],
179-
),
180-
);
181-
},
142+
child: _HuddleParticipantCluster(
143+
pubkeys: remotePubkeys,
144+
profiles: profiles,
145+
fallbackLabels: fallbackLabels,
146+
activeSpeakerPubkeys: activeSpeakerPubkeys,
147+
speakerLevels: speakerLevels,
148+
movementDuration: movementDuration,
149+
entryDuration: entryDuration,
150+
exitDuration: exitDuration,
151+
onParticipantTap: onParticipantTap,
152+
onOverflowTap: onOverflowTap,
182153
),
183154
),
184155
),
@@ -226,59 +197,3 @@ class _HuddleLoadingBee extends HookWidget {
226197
);
227198
}
228199
}
229-
230-
class _HuddleParticipantLayout {
231-
const _HuddleParticipantLayout({
232-
required this.frameSize,
233-
required this.spacing,
234-
required this.runSpacing,
235-
});
236-
237-
final double frameSize;
238-
final double spacing;
239-
final double runSpacing;
240-
241-
static _HuddleParticipantLayout fit({
242-
required Size availableSize,
243-
required int participantCount,
244-
required bool dense,
245-
}) {
246-
const spacing = Grid.xs;
247-
const runSpacing = Grid.xxs;
248-
final maximumFrameSize = dense
249-
? _huddleDenseAvatarFrameSize
250-
: _huddleAvatarFrameSize;
251-
if (participantCount <= 0 || availableSize.isEmpty) {
252-
return _HuddleParticipantLayout(
253-
frameSize: maximumFrameSize,
254-
spacing: spacing,
255-
runSpacing: runSpacing,
256-
);
257-
}
258-
259-
var bestFrameSize = _huddleMinimumAvatarFrameSize;
260-
for (var columns = 1; columns <= participantCount; columns++) {
261-
final rows = (participantCount + columns - 1) ~/ columns;
262-
final widthForAvatars = availableSize.width - spacing * (columns - 1);
263-
final heightForAvatars =
264-
availableSize.height -
265-
runSpacing * (rows - 1) -
266-
_huddleParticipantLabelSpace * rows;
267-
if (widthForAvatars <= 0 || heightForAvatars <= 0) continue;
268-
269-
final widthBound = widthForAvatars / columns;
270-
final heightBound = heightForAvatars / rows;
271-
final candidate = min(maximumFrameSize, min(widthBound, heightBound));
272-
if (candidate > bestFrameSize) bestFrameSize = candidate;
273-
}
274-
275-
return _HuddleParticipantLayout(
276-
frameSize: bestFrameSize.clamp(
277-
_huddleMinimumAvatarFrameSize,
278-
maximumFrameSize,
279-
),
280-
spacing: spacing,
281-
runSpacing: runSpacing,
282-
);
283-
}
284-
}

0 commit comments

Comments
 (0)