Skip to content

feat(ui): add onLongPress to StreamButton - #210

Merged
xsahil03x merged 2 commits into
mainfrom
sahil/stream-button-on-long-press
Oct 30, 2026
Merged

xsahil03x merged 2 commits into
mainfrom
sahil/stream-button-on-long-press

Conversation

@xsahil03x

@xsahil03x xsahil03x commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

What changed

  • StreamButton and StreamButton.icon take an onLongPress callback (also on StreamButtonProps), passed to the underlying button.
  • While onLongPress is set, a long press calls it instead of showing the icon button's tooltip; the tooltip still shows on hover.
  • The button exposes a long-press action to accessibility services. As with Flutter's own buttons there is no hint field; a caller that wants a long-press hint wraps the button in Semantics(onLongPressHint: …).
  • Gallery: a "Long Press" knob on the StreamButton playground.

Why

The chat SDK's composer needs a long press on the send button to offer scheduling a message (GetStream/stream-chat-flutter#3138 and the UI PR stacked on it).

Verification

  • Widget tests: a long press calls onLongPress and doesn't show the tooltip, a tap still calls onPressed, and the semantics node has the long-press action.
  • flutter analyze clean on the package and the gallery.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Buttons now support an optional long-press action, including icon-only buttons. Tooltips use manual triggering when a long-press action is available.
    • The button playground includes a long-press control and displays feedback when a button is long-pressed.

StreamButton and StreamButton.icon take an onLongPress callback, which
also gives the button a long-press action for accessibility services.
While it is set, a long press calls it instead of showing the icon
button's tooltip; the tooltip still shows on hover.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@xsahil03x
xsahil03x requested a review from a team as a code owner October 30, 2026 18:49
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 55 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 34ddb784-a8e6-4cc5-88e5-191a539e9c9d
Commits

Reviewing files that changed from the base of the PR and between a9a9d08 and e454a82.

Files selected for processing: 1
  • packages/stream_core_flutter/lib/src/components/buttons/stream_button.dart

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2d3dd37c-1f8e-474a-b5b0-f7829da8a890
Commits

Reviewing files that changed from the base of the PR and between ae8613d and a9a9d08.

Files selected for processing: 4
  • apps/design_system_gallery/lib/components/buttons/button.dart
  • packages/stream_core_flutter/CHANGELOG.md
  • packages/stream_core_flutter/lib/src/components/buttons/stream_button.dart
  • packages/stream_core_flutter/test/components/buttons/stream_button_test.dart

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

StreamButton and StreamButton.icon now accept optional long-press callbacks and adjust tooltip triggering when a callback is set. The button playground adds a Long Press control and displays feedback when the configured callback runs.

Changes: Button long-press support

Layer / File(s) Summary
Add and validate the long-press API
packages/stream_core_flutter/lib/src/components/buttons/stream_button.dart, packages/stream_core_flutter/test/components/buttons/stream_button_test.dart, packages/stream_core_flutter/CHANGELOG.md
Both constructors and StreamButtonProps now support onLongPress. The callback is passed to ElevatedButton. Tooltip triggering is manual when the callback is set. Tests cover long-press behavior, semantics, and tap behavior. The changelog records the addition.
Configure long press in the gallery
apps/design_system_gallery/lib/components/buttons/button.dart
The playground adds a Long Press control and passes a callback to icon-only and labeled buttons when enabled and not disabled. The callback displays a message for one second.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Playground
  participant StreamButton
  participant ElevatedButton
  participant showMessage
  User->>ElevatedButton: Long-press the button
  ElevatedButton->>StreamButton: Invoke onLongPress callback
  StreamButton->>Playground: Invoke configured callback
  Playground->>showMessage: Display long-press message
Loading

Suggested reviewers: renefloor

Merge Risk: Minimal · previous review a9a9d

Long-press support appears ready to merge after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title "feat(ui): add onLongPress to StreamButton" matches the main change. The changeset adds an optional onLongPress callback to StreamButton, StreamButton.icon, and StreamButtonProps, passes it …
Description check Passed The description follows the repository template. It has a "What changed" section that describes the onLongPress API, the tooltip and accessibility behavior, and the gallery knob. It has a "Why" sectio…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(ui): add onLongPress to StreamButton" matches the main change. The changeset adds an optional onLongPress callback to StreamButton, StreamButton.icon, and StreamButtonProps, passes it to the underlying ElevatedButton, and suppresses the tooltip trigger on long press. The title is specific, short, and in a conventional commit format.

Full details: Description check

Explanation

The description follows the repository template. It has a "What changed" section that describes the onLongPress API, the tooltip and accessibility behavior, and the gallery knob. It has a "Why" section that links the chat SDK use case. It has a "Verification" section that lists widget tests and flutter analyze results. The template's Linear ticket field, CLA checklist, Github Issue field, and Screenshots/Videos table are not present. The author does not provide a Linear ticket or a screenshot of the gallery knob or the long-press behavior.

Resolution

Add the Linear ticket reference (FLU-...) or confirm that it is not applicable. Optionally link a GitHub issue in the Github Issue field. Complete or confirm the CLA checklist items. Add a Screenshots / Videos entry, or state why one is not needed. The description is otherwise complete.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (4 skipped: 4 unsupported.)

Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Use Flutter's wording for onPressed and onLongPress, and wrap the icon
button in a plain Tooltip as Flutter's buttons do: a long press still
calls onLongPress instead of showing the tooltip.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.99%. Comparing base (ae8613d) to head (e454a82).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #210      +/-   ##
==========================================
+ Coverage   71.98%   71.99%   +0.01%     
==========================================
  Files         216      216              
  Lines        9066     9067       +1     
==========================================
+ Hits         6526     6528       +2     
+ Misses       2540     2539       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xsahil03x
xsahil03x merged commit 9c8779f into main Oct 30, 2026
17 checks passed
@xsahil03x
xsahil03x deleted the sahil/stream-button-on-long-press branch October 30, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants