Skip to content

Conversation

@xsahil03x
Copy link
Member

@xsahil03x xsahil03x commented Dec 3, 2025

Submit a pull request

Fixes: #2454

Description of the pull request

This change ensures that the fullscreen media viewer on both mobile and desktop properly respects the safe area insets (like notches and system bars).

It replaces the AnimatedPadding widget with padding on the AnimatedContainer itself, using MediaQuery.paddingOf(context) to correctly calculate the top and bottom padding. This prevents the media content from being obscured by system UI elements when the details (header/footer) are visible.

Screenshots / Videos

Before After
image simulator_screenshot_9021136F-DB96-4DE1-A213-621E739D8897

Summary by CodeRabbit

  • Bug Fixes
    • Fixed fullscreen media display not properly respecting safe areas on devices with notches or dynamic islands.

✏️ Tip: You can customize this high-level summary in your review settings.

This change ensures that the fullscreen media viewer on both mobile and desktop properly respects the safe area insets (like notches and system bars).

It replaces the `AnimatedPadding` widget with padding on the `AnimatedContainer` itself, using `MediaQuery.paddingOf(context)` to correctly calculate the top and bottom padding. This prevents the media content from being obscured by system UI elements when the details (header/footer) are visible.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 3, 2025

Walkthrough

This PR addresses issue #2454 by refactoring the fullscreen media viewers to properly respect safe area padding. The changes restructure the AnimatedContainer layout in both mobile and desktop implementations to incorporate MediaQuery padding plus toolbar height, relocate attachment-type rendering to separate Builder children, simplify color logic via switch expressions, and remove an unused iOS framework dependency.

Changes

Cohort / File(s) Change Summary
Layout refactoring for fullscreen media
packages/stream_chat_flutter/lib/src/fullscreen_media/full_screen_media.dart, packages/stream_chat_flutter/lib/src/fullscreen_media/full_screen_media_desktop.dart
Restructured AnimatedContainer to apply safe area padding (MediaQuery padding + toolbar height) and switched color logic to functional switch expressions. Moved attachment-type rendering (image/giphy PhotoView, video Chewie) from inline branching to separate Builder child widget for cleaner control flow.
Documentation update
packages/stream_chat_flutter/CHANGELOG.md
Added entry to Upcoming section documenting fix for StreamGallery not respecting safe area for fullscreen media.
iOS build configuration
sample_app/ios/Runner.xcodeproj/project.pbxproj
Removed volume_controller.framework from the [CP] Embed Frameworks phase and Pods-Runner framework copy lists.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • full_screen_media.dart and full_screen_media_desktop.dart: Verify that the new padding calculations correctly account for safe area insets and toolbar height across different screen states; confirm that moving content to the Builder child doesn't alter animation or rendering behavior.
  • Padding computation: Ensure MediaQuery.of(context).padding.top + kToolbarHeight is the correct formula and that bottom padding is appropriately handled.
  • Video playback: Confirm video initialization and Chewie widget lifecycle remain unaffected by the layout restructuring.

Possibly related PRs

  • PR #2450: Also removes volume_controller framework entries from iOS project configuration files, indicating coordinated plugin cleanup.

Suggested reviewers

  • renefloor
  • Brazol

Poem

🐰 A video player freed from shadowed bounds,
Safe padding guards where media plays,
No more clipping where AppBar surrounds—
The fullscreen fix brightens mobile days!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes an unrelated change: removing volume_controller.framework from the iOS sample app's Xcode project, which is not mentioned in linked issue #2454 and appears to be a separate maintenance task. Remove the volume_controller.framework changes from this PR or create a separate PR for iOS build configuration updates to maintain scope clarity.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and concisely describes the main change: fixing the fullscreen media viewer to respect safe area insets, which is the core objective of the PR.
Linked Issues check ✅ Passed The PR addresses issue #2454 by implementing safe area padding in fullscreen media viewers on both mobile and desktop, ensuring video player controls are not clipped behind system UI elements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/video-player-controls-cropped

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 and usage tips.

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

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 279c6d2 and a2cc961.

📒 Files selected for processing (4)
  • packages/stream_chat_flutter/CHANGELOG.md (1 hunks)
  • packages/stream_chat_flutter/lib/src/fullscreen_media/full_screen_media.dart (1 hunks)
  • packages/stream_chat_flutter/lib/src/fullscreen_media/full_screen_media_desktop.dart (1 hunks)
  • sample_app/ios/Runner.xcodeproj/project.pbxproj (0 hunks)
💤 Files with no reviewable changes (1)
  • sample_app/ios/Runner.xcodeproj/project.pbxproj
⏰ 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_persistence
  • GitHub Check: stream_chat
  • GitHub Check: stream_chat_localizations
  • GitHub Check: stream_chat_flutter_core
  • GitHub Check: stream_chat_flutter
  • GitHub Check: analyze_legacy_versions
  • GitHub Check: build (ios)
  • GitHub Check: test
  • GitHub Check: build (android)
🔇 Additional comments (5)
packages/stream_chat_flutter/lib/src/fullscreen_media/full_screen_media_desktop.dart (2)

320-331: Padding is applied unconditionally, but should it vary based on isDisplayingDetail?

The padding is always applied with padding.top + kToolbarHeight and padding.bottom + kToolbarHeight, regardless of whether the header/footer are visible (isDisplayingDetail). When isDisplayingDetail is false, the header and footer slide off-screen, so applying full padding would leave unnecessary empty space around the media content.

Consider making the padding conditional:

 return AnimatedContainer(
   duration: kThemeChangeDuration,
   color: switch (isDisplayingDetail) {
     true => StreamChannelHeaderTheme.of(context).color,
     false => Colors.black,
   },
-  padding: EdgeInsetsDirectional.only(
-    top: padding.top + kToolbarHeight,
-    bottom: padding.bottom + kToolbarHeight,
-  ),
+  padding: isDisplayingDetail
+      ? EdgeInsetsDirectional.only(
+          top: padding.top + kToolbarHeight,
+          bottom: padding.bottom + kToolbarHeight,
+        )
+      : EdgeInsets.zero,
   child: child,
 );

Please verify whether the padding should animate away when the header/footer are hidden. The current implementation always reserves space for the toolbar even when it's not visible.


335-383: Good refactoring to separate content rendering from the animated container.

The use of a Builder child to handle attachment-type rendering is clean and improves readability. The structure properly separates the animation/padding concerns from the actual media rendering logic.

packages/stream_chat_flutter/lib/src/fullscreen_media/full_screen_media.dart (2)

284-295: Same concern: padding is applied unconditionally regardless of header/footer visibility.

Similar to the desktop version, the padding is always padding.top + kToolbarHeight and padding.bottom + kToolbarHeight, even when isDisplayingDetail is false and the header/footer have animated off-screen.

Consider making the padding conditional to avoid unnecessary empty space when the UI chrome is hidden:

 return AnimatedContainer(
   duration: kThemeChangeDuration,
   color: switch (isDisplayingDetail) {
     true => StreamChannelHeaderTheme.of(context).color,
     false => Colors.black,
   },
-  padding: EdgeInsetsDirectional.only(
-    top: padding.top + kToolbarHeight,
-    bottom: padding.bottom + kToolbarHeight,
-  ),
+  padding: isDisplayingDetail
+      ? EdgeInsetsDirectional.only(
+          top: padding.top + kToolbarHeight,
+          bottom: padding.bottom + kToolbarHeight,
+        )
+      : EdgeInsets.zero,
   child: child,
 );

Please verify whether the intended UX is to keep the safe area padding visible at all times, or to animate it away with the header/footer. If the former, disregard this comment.


299-330: LGTM!

The Builder child pattern is consistent with the desktop variant. Video initialization is properly handled in initState, and the loading indicator provides good UX while the video controller initializes.

packages/stream_chat_flutter/CHANGELOG.md (1)

1-7: LGTM!

The changelog entry correctly documents the fix and references the linked issue #2454. The format is consistent with existing entries.

@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

❌ Patch coverage is 22.72727% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.61%. Comparing base (279c6d2) to head (a2cc961).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...rc/fullscreen_media/full_screen_media_desktop.dart 0.00% 27 Missing ⚠️
...er/lib/src/fullscreen_media/full_screen_media.dart 58.82% 7 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2456   +/-   ##
=======================================
  Coverage   64.60%   64.61%           
=======================================
  Files         420      420           
  Lines       26210    26210           
=======================================
+ Hits        16934    16936    +2     
+ Misses       9276     9274    -2     

☔ 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 xsahil03x merged commit c0fd5f8 into master Dec 3, 2025
20 of 21 checks passed
@xsahil03x xsahil03x deleted the fix/video-player-controls-cropped branch December 3, 2025 13:21
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.

iOS: Video player top controls clipped when playing videos under top AppBar

3 participants