Skip to content

Conversation

dballance
Copy link
Contributor

@dballance dballance commented Jul 21, 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

Adds bottom and bottomOpacity options to ChannelHeader to pass through to AppBar

Screenshots / Videos

N/A

Summary by CodeRabbit

  • New Features
    • Added support for an optional widget below the main toolbar in the channel header, with configurable opacity.
  • Tests
    • Introduced a new visual test to verify the appearance of the channel header when an additional bottom widget is present.

Copy link
Contributor

coderabbitai bot commented Jul 21, 2025

Walkthrough

The StreamChannelHeader widget was updated to include optional bottom and bottomOpacity properties, enabling an additional widget below the header with configurable opacity. The preferredSize logic was updated accordingly. Documentation in the changelog was added, and a new golden test was introduced to verify the rendering with the bottom widget.

Changes

File(s) Change Summary
packages/stream_chat_flutter/lib/src/channel/channel_header.dart Added bottom and bottomOpacity properties to StreamChannelHeader; updated preferredSize logic.
packages/stream_chat_flutter/CHANGELOG.md Documented the addition of bottom and bottomOpacity to StreamChannelHeader.
packages/stream_chat_flutter/test/src/channel/channel_header_test.dart Added a golden test for StreamChannelHeader with a bottom widget.

Sequence Diagram(s)

sequenceDiagram
    participant App
    participant StreamChannelHeader
    participant BottomWidget

    App->>StreamChannelHeader: Create with bottom widget and bottomOpacity
    StreamChannelHeader->>BottomWidget: Render as bottom (if provided)
    StreamChannelHeader->>App: Display header with optional bottom
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Poem

A header now with space below,
For widgets you might want to show.
With opacity you can adjust,
And golden tests ensure we trust.
The changelog sings the news today—
More flexible headers are on the way!
🐰✨

Note

⚡️ Unit Test Generation is now available in beta!

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

✨ 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.

@dballance dballance changed the title feat(stream_chat_flutter): add bottom and bottomOpacity to ChannelHeader feat(ui): add bottom and bottomOpacity to ChannelHeader Jul 21, 2025
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 186d12e and 810b3f1.

📒 Files selected for processing (1)
  • packages/stream_chat_flutter/lib/src/channel/channel_header.dart (4 hunks)
🔇 Additional comments (4)
packages/stream_chat_flutter/lib/src/channel/channel_header.dart (4)

69-69: LGTM! Constructor parameter follows Flutter conventions.

The bottom parameter addition is well-placed and consistent with the existing parameter structure.


72-72: LGTM! Appropriate default value for bottomOpacity.

The default value of 1 matches AppBar's default behavior and maintains consistency with similar numeric properties.


111-112: LGTM! Proper field declaration with appropriate documentation.

The field uses the correct type PreferredSizeWidget? that matches AppBar's bottom property, and the documentation is clear and concise.


125-126: LGTM! Proper field declaration with clear documentation.

The field uses the correct double type and provides clear documentation about controlling the bottom widget's opacity.

@dballance dballance force-pushed the feat/add-bottom-to-channel-list-header branch from ca87004 to 52f51e5 Compare July 21, 2025 13:56
Copy link

codecov bot commented Jul 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.66%. Comparing base (b82ce14) to head (8de5adb).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2318   +/-   ##
=======================================
  Coverage   63.65%   63.66%           
=======================================
  Files         409      409           
  Lines       25609    25614    +5     
=======================================
+ Hits        16301    16306    +5     
  Misses       9308     9308           

☔ 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.

@xsahil03x
Copy link
Member

xsahil03x commented Jul 21, 2025

Hey @dballance , Thank you for the contribution.

Can you also add some golden tests for these features and update the changelog entry? Thanks

@dballance
Copy link
Contributor Author

@xsahil03x been traveling - trying to get this accomplished.

How exactly can I go about running goldens? Seems locally (macos) all the CI goldens fail in my environment. Further, it's trying to run MacOS variants and failing as well.

@xsahil03x
Copy link
Member

Hey @dballance , you can use --update-goldens to verify they pass locally. Once commited i can regenerate them using the update_golden workflow in this PR.

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: 0

🧹 Nitpick comments (1)
packages/stream_chat_flutter/test/src/channel/channel_header_test.dart (1)

481-548: Well-structured golden test for the bottom widget functionality.

The test implementation follows established patterns and properly covers the visual rendering of the new bottom property. The mock setup is comprehensive and the test constraints are appropriate.

However, consider adding a companion test for the bottomOpacity property to ensure complete coverage of both new features mentioned in the PR objectives.

goldenTest(
  'golden test for StreamChannelHeader with bottom widget and opacity',
  fileName: 'channel_header_bottom_widget_opacity',
  constraints: const BoxConstraints.tightFor(width: 300, height: 60),
  builder: () {
    // ... same mock setup ...
    
    return MaterialAppWrapper(
      home: StreamChat(
        client: client,
        connectivityStream: Stream.value([ConnectivityResult.wifi]),
        child: StreamChannel(
          channel: channel,
          child: const Scaffold(
            body: StreamChannelHeader(
              bottom: PreferredSize(
                preferredSize: Size.fromHeight(1),
                child: Divider(height: 1, color: Colors.red),
              ),
              bottomOpacity: 0.5, // Test the opacity functionality
            ),
          ),
        ),
      ),
    );
  },
);
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2e93dde and 8de5adb.

⛔ Files ignored due to path filters (1)
  • packages/stream_chat_flutter/test/src/channel/goldens/ci/channel_header_bottom_widget.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • packages/stream_chat_flutter/test/src/channel/channel_header_test.dart (2 hunks)

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.

LGTM

@xsahil03x xsahil03x merged commit 96988eb into GetStream:master Jul 25, 2025
21 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