Skip to content

Conversation

dballance
Copy link
Contributor

@dballance dballance commented Jul 25, 2025

CLA

  • I have signed the Stream CLA (required).
  • The code changes follow best practices
  • Code changes are tested (add some information if not applicable)

Description of the pull request

StreamMessageInput currently contains some hard-coded padding (const EdgeInsets.all(8)) and some fixed, non-configurable margins.

This allows direct overriding of these paddings and margins so users can customize their inputs without unnecessary margin / padding.

Example code used to produce these screenshots (borders are transparent gradients):

StreamMessageInput(
  focusNode: _focusNode,
  messageInputController: _messageInputController,
  onQuotedMessageCleared: _messageInputController.clearQuotedMessage,
  idleSendIcon: _SendIcon(size: iconSizes, color: theme.dividerColor),
  activeSendIcon: _SendIcon(size: iconSizes, color: theme.primaryColor),
  actionsLocation: ActionsLocation.leftInside,
  showCommandsButton: false,
  sendButtonLocation: SendButtonLocation.inside,
  attachmentButtonBuilder: (context, defaultWidget) =>
    defaultWidget.copyWith(
      icon: Container(
        decoration: BoxDecoration(
          shape: BoxShape.circle,
          border: Border.all(
            color: Theme.of(context).dividerColor,
          ),
        ),
        child: const Icon(Icons.plus, size: iconSizes))),
),

With the updates here, I provided the below to produce the "after" shots

padding: const EdgeInsets.symmetric(vertical: 8),
textFieldMargin: EdgeInsets.zero,

Note: Here is the current implementation for the margin calculation - which adds margin to the input anytime you use SendButtonLocation.inside or any ActionLocations that isn't ActionLocationLeft (or commands button is enabled).

final margin = (widget.sendButtonLocation == SendButtonLocation.inside
      ? const EdgeInsets.only(right: 8)
      : EdgeInsets.zero) +
  (widget.actionsLocation != ActionsLocation.left || _commandEnabled
      ? const EdgeInsets.only(left: 8)
      : EdgeInsets.zero);

Certainly open to naming suggestions or even abstracting as some "TextInputEdgeInsets" that would contain both a margin and padding property. Could also be convinced that we should just vendor the StreamMessageInput class here and make these changes ourselves, but seems like there may be a possibility to get this working in the shared lib.

Screenshots / Videos

Before After
image image

Here shows a top and bottom view of the before and after
edited-margin

I also attempted to drop actionsLocation: ActionsLocation.leftInside and sendButtonLocation: SendButtonLocation.inside, which produced the below:

image

Still not ideal, as there is extraneous margin around the text input.

Summary by CodeRabbit

  • New Features
    • Added new options to customize the padding and text field margin in the message input component, allowing for improved layout control.
  • Tests
    • Introduced new tests to verify the correct application of custom padding and margin in the message input.
    • Refactored test setup for better maintainability.

Copy link
Contributor

coderabbitai bot commented Jul 25, 2025

Walkthrough

This change introduces two new layout parameters, padding and textInputMargin, to the StreamMessageInput widget in the stream_chat_flutter package. The changelog is updated, the widget and its state are modified to support these parameters, and new tests are added to verify their behavior. Test setup is refactored for maintainability.

Changes

File(s) Change Summary
Changelog update
packages/stream_chat_flutter/CHANGELOG.md
Added "Upcoming" section documenting new padding and textInputMargin parameters.
Widget modification
packages/stream_chat_flutter/lib/src/message_input/stream_message_input.dart
Added padding and textInputMargin properties to StreamMessageInput; updated layout to use them.
Test refactor and additions
packages/stream_chat_flutter/test/src/message_input/message_input_test.dart
Refactored test setup with helper function; added tests for new padding and margin parameters; imported desktop_drop.

Sequence Diagram(s)

sequenceDiagram
    participant Test as Widget Test
    participant Widget as StreamMessageInput
    participant UI as UI Layout

    Test->>Widget: Instantiate with custom padding/textInputMargin
    Widget->>UI: Build with specified padding and margin
    UI-->>Test: Rendered with expected layout
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Suggested reviewers

  • renefloor

Poem

In the chat where messages flow,
New paddings and margins now softly grow.
With tests that ensure each edge is just right,
The input feels cozy, both day and night.
A bunny hops by, with a satisfied grin—
Layout control is a win! 🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9205466 and 5bc8ea2.

📒 Files selected for processing (1)
  • packages/stream_chat_flutter/CHANGELOG.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/stream_chat_flutter/CHANGELOG.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: stream_chat_flutter_core
  • GitHub Check: stream_chat_flutter
  • GitHub Check: stream_chat
  • GitHub Check: analyze_legacy_versions
  • GitHub Check: stream_chat_persistence
  • GitHub Check: stream_chat_localizations
  • GitHub Check: build (android)
  • GitHub Check: test
  • GitHub Check: analyze
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Jul 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.65%. Comparing base (ab6554c) to head (5bc8ea2).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2328   +/-   ##
=======================================
  Coverage   63.65%   63.65%           
=======================================
  Files         409      409           
  Lines       25617    25619    +2     
=======================================
+ Hits        16306    16308    +2     
  Misses       9311     9311           

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1ea9047 and 27e5b7f.

📒 Files selected for processing (1)
  • packages/stream_chat_flutter/CHANGELOG.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
packages/stream_chat_flutter/CHANGELOG.md

[style] ~7-~7: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...e context access in async operations. - Added padding and textFieldMargin to `Str...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: build (android)
  • GitHub Check: format
  • GitHub Check: analyze
  • GitHub Check: build (ios)
  • GitHub Check: test
  • GitHub Check: analyze_legacy_versions
  • GitHub Check: stream_chat_flutter_core
  • GitHub Check: stream_chat_persistence
  • GitHub Check: stream_chat_flutter
  • GitHub Check: stream_chat_localizations
  • GitHub Check: stream_chat

@dballance
Copy link
Contributor Author

Updated changelog to fix naming conflict and remove from 9.15.0 (moved to Upcoming).

Copy link
Member

@xsahil03x xsahil03x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @dballance LGTM, can you just fix the field name in changelog? Thanks

@dballance
Copy link
Contributor Author

Hey @dballance LGTM, can you just fix the field name in changelog? Thanks

Yeah - sorry about that. I thought I had it correct but got cross somewhere along the way.

@xsahil03x xsahil03x merged commit c67a249 into GetStream:master Jul 28, 2025
17 checks passed
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