feat(ui): add semanticsLabel to StreamAvatar / Group / Stack#132
feat(ui): add semanticsLabel to StreamAvatar / Group / Stack#132xsahil03x wants to merge 1 commit into
Conversation
…amAvatarStack null (default) composes through — the placeholder or children speak per their own contract. Non-null exposes the widget as a single labeled image node and drops descendants (initials, icons, "+N" overflow badge) from the semantics tree. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughChangesAvatar accessibility semantics
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #132 +/- ##
==========================================
+ Coverage 44.53% 47.39% +2.85%
==========================================
Files 178 178
Lines 7243 7250 +7
==========================================
+ Hits 3226 3436 +210
+ Misses 4017 3814 -203 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/stream_core_flutter/lib/src/components/avatar/stream_avatar.dart (1)
214-256: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the repeated Semantics-wrap block into a shared helper. The same
if (props.semanticsLabel case final label?) { ... Semantics(label: label, image: true, excludeSemantics: true, child: x) ... }block is copy-pasted identically in all three widget files.
packages/stream_core_flutter/lib/src/components/avatar/stream_avatar.dart#L214-L256: extract this block into a sharedWidget wrapWithSemanticsLabel(Widget child, String? label)helper (or similar) and call it here.packages/stream_core_flutter/lib/src/components/avatar/stream_avatar_group.dart#L172-L213: call the same shared helper instead of duplicating the block.packages/stream_core_flutter/lib/src/components/avatar/stream_avatar_stack.dart#L212-L245: call the same shared helper instead of duplicating the block.♻️ Example helper
Widget wrapWithSemanticsLabel(Widget child, String? label) { if (label == null) return child; return Semantics( label: label, image: true, excludeSemantics: true, child: child, ); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/stream_core_flutter/lib/src/components/avatar/stream_avatar.dart` around lines 214 - 256, Extract the duplicated semantics wrapper into a shared wrapWithSemanticsLabel helper that returns the child unchanged for a null label and otherwise applies Semantics with the existing label, image, and excludeSemantics settings. In packages/stream_core_flutter/lib/src/components/avatar/stream_avatar.dart#L214-L256, replace the local if block with the helper; make the same replacement in packages/stream_core_flutter/lib/src/components/avatar/stream_avatar_group.dart#L172-L213 and packages/stream_core_flutter/lib/src/components/avatar/stream_avatar_stack.dart#L212-L245.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/stream_core_flutter/lib/src/components/avatar/stream_avatar.dart`:
- Around line 214-256: Extract the duplicated semantics wrapper into a shared
wrapWithSemanticsLabel helper that returns the child unchanged for a null label
and otherwise applies Semantics with the existing label, image, and
excludeSemantics settings. In
packages/stream_core_flutter/lib/src/components/avatar/stream_avatar.dart#L214-L256,
replace the local if block with the helper; make the same replacement in
packages/stream_core_flutter/lib/src/components/avatar/stream_avatar_group.dart#L172-L213
and
packages/stream_core_flutter/lib/src/components/avatar/stream_avatar_stack.dart#L212-L245.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6961d9ec-af6d-4079-9183-ec8444cb3a1c
📒 Files selected for processing (7)
packages/stream_core_flutter/CHANGELOG.mdpackages/stream_core_flutter/lib/src/components/avatar/stream_avatar.dartpackages/stream_core_flutter/lib/src/components/avatar/stream_avatar_group.dartpackages/stream_core_flutter/lib/src/components/avatar/stream_avatar_stack.dartpackages/stream_core_flutter/test/components/avatar/stream_avatar_group_test.dartpackages/stream_core_flutter/test/components/avatar/stream_avatar_stack_test.dartpackages/stream_core_flutter/test/components/avatar/stream_avatar_test.dart
Points the git dep at c711bba, the commit on the open GetStream/stream-core-flutter#132 branch that adds `semanticsLabel` to `StreamAvatar` / `StreamAvatarGroup` / `StreamAvatarStack`. Required so our chat-side widgets compile; must be swapped to the merged main ref once #132 lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
semanticsLabeltoStreamAvatar,StreamAvatarGroup, andStreamAvatarStack.null(default) composes through — placeholder / children speak per their own contract.+Noverflow badge) from the semantics tree.Linear tickets
Test plan
flutter testinstream_core_flutter— new avatar / group / stack tests pass.🤖 Generated with Claude Code