Skip to content

Fix: EmptyContentScreen visibility issue in landscape mode#2009

Open
rahul31124 wants to merge 1 commit into
openMF:developmentfrom
rahul31124:scrolling
Open

Fix: EmptyContentScreen visibility issue in landscape mode#2009
rahul31124 wants to merge 1 commit into
openMF:developmentfrom
rahul31124:scrolling

Conversation

@rahul31124
Copy link
Copy Markdown
Member

@rahul31124 rahul31124 commented Apr 26, 2026

Issue Fix

Fixes #{MW-399}
Jira Task: MW-399

Screenshots

Record_2026-04-26-18-06-16_6a5d239ecc870d7d1b844aa672071987.mp4

Description

Updated the EmptyContentScreen component to support scrolling in landscape orientation.

  • Apply the AndroidStyle.xml style template to your code in Android Studio.

  • Run the unit tests with ./gradlew check to make sure you didn't break anything

  • If you have multiple commits please combine them into one commit by squashing them.

Summary by CodeRabbit

Bug Fixes

  • Empty content screen now supports vertical scrolling, ensuring content remains accessible on smaller displays and preventing overflow issues.

@rahul31124 rahul31124 requested a review from a team April 26, 2026 13:24
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 26, 2026

📝 Walkthrough

Walkthrough

The first overload of EmptyContentScreen composable was modified to include vertical scrolling functionality by adding verticalScroll(rememberScrollState()) modifier to its root Column, enabling content to scroll when it exceeds the viewport height.

Changes

Cohort / File(s) Summary
Scroll Container Enhancement
core/ui/src/commonMain/kotlin/org/mifospay/core/ui/EmptyContentScreen.kt
Added vertical scroll capability to the first EmptyContentScreen overload by wrapping the root Column with verticalScroll(rememberScrollState()) modifier.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

🐰 A scroll, a swipe, a gentle flow,
Where empty screens now steal the show!
The rabbit hops with pure delight,
Content scrolls smooth, all feels so right! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 'Fix: EmptyContentScreen visibility issue in landscape mode' directly describes the main change: adding vertical scrolling to EmptyContentScreen to fix visibility issues in landscape orientation, which aligns with the raw summary and PR objectives.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Copy Markdown
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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
core/ui/src/commonMain/kotlin/org/mifospay/core/ui/EmptyContentScreen.kt (2)

95-161: ⚠️ Potential issue | 🟠 Major

Same landscape visibility issue not fixed in the button overload.

This second overload (EmptyContentScreen with btnText/btnIcon/onClick) renders an even taller layout (extra spacer + MifosButton) but did not receive the verticalScroll change. In landscape it will exhibit the same content-cut-off behavior described in MW-399. Apply the same scrolling treatment here for consistency, otherwise users hitting empty states that include an action button will still see clipped content.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/ui/src/commonMain/kotlin/org/mifospay/core/ui/EmptyContentScreen.kt`
around lines 95 - 161, The second overload of EmptyContentScreen (the composable
that accepts btnText, btnIcon, onClick and renders imageContent plus
MifosButton) lacks the vertical scrolling added elsewhere and can be clipped in
landscape; fix it by making the inner Column that currently has
.padding(...).fillMaxSize().testTag("mifos:empty") scrollable — add
.verticalScroll(rememberScrollState()) (importing rememberScrollState) to that
Column (or wrap its contents in a Column/Box with verticalScroll) so the
imageContent, Spacers, Texts and MifosButton are scrollable in constrained
heights. Ensure you reference EmptyContentScreen, imageContent, and MifosButton
when locating the change.

52-92: ⚠️ Potential issue | 🟠 Major

verticalScroll with inner fillMaxSize() silently breaks vertical centering.

verticalScroll measures children with unbounded max height. Two consequences in this layout:

  1. The outer Column's verticalArrangement = Arrangement.Center (line 56) becomes a no-op — there is no "remaining" space to distribute inside an unbounded scroll viewport.
  2. The inner Column's Modifier.fillMaxSize() (line 61) cannot fill height under unbounded constraints, so it collapses to wrap-content height; its own verticalArrangement = Arrangement.Center (line 63) also stops centering.

Net effect: when content fits on screen (the common portrait case), the title/subtitle/image will now hug the top instead of being vertically centered as before. To keep centering when content fits and scroll when it overflows, give the scroll content a min height equal to the viewport, e.g. via BoxWithConstraints/heightIn(min = maxHeight), and use fillMaxWidth() (not fillMaxSize()) on the inner column.

♻️ Suggested fix to preserve centering while supporting scroll
-    Column(
-        modifier = modifier.fillMaxSize()
-            .verticalScroll(rememberScrollState()),
-        horizontalAlignment = Alignment.CenterHorizontally,
-        verticalArrangement = Arrangement.Center,
-    ) {
-        Column(
-            modifier = Modifier
-                .padding(KptTheme.spacing.md)
-                .fillMaxSize()
-                .testTag("mifos:empty"),
-            verticalArrangement = Arrangement.Center,
-            horizontalAlignment = Alignment.CenterHorizontally,
-        ) {
+    BoxWithConstraints(modifier = modifier.fillMaxSize()) {
+        val viewportHeight = maxHeight
+        Column(
+            modifier = Modifier
+                .fillMaxWidth()
+                .verticalScroll(rememberScrollState())
+                .heightIn(min = viewportHeight)
+                .padding(KptTheme.spacing.md)
+                .testTag("mifos:empty"),
+            verticalArrangement = Arrangement.Center,
+            horizontalAlignment = Alignment.CenterHorizontally,
+        ) {
             ...
         }
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/ui/src/commonMain/kotlin/org/mifospay/core/ui/EmptyContentScreen.kt`
around lines 52 - 92, The outer Column uses
verticalScroll(rememberScrollState()) which makes height unbounded so
Arrangement.Center becomes a no-op and the inner Column's Modifier.fillMaxSize()
collapses; to fix, wrap the scroll content in a viewport-aware container (e.g.,
BoxWithConstraints) and apply Modifier.heightIn(min = maxHeight) to the
scrolling child so it gets at least the viewport height, and change the inner
Column's Modifier.fillMaxSize() to Modifier.fillMaxWidth() (keep
padding/testTag) so its verticalArrangement = Arrangement.Center can actually
center when content fits while still allowing scrolling when content overflows;
update the composable that contains imageContent(), title and subTitle
accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@core/ui/src/commonMain/kotlin/org/mifospay/core/ui/EmptyContentScreen.kt`:
- Around line 95-161: The second overload of EmptyContentScreen (the composable
that accepts btnText, btnIcon, onClick and renders imageContent plus
MifosButton) lacks the vertical scrolling added elsewhere and can be clipped in
landscape; fix it by making the inner Column that currently has
.padding(...).fillMaxSize().testTag("mifos:empty") scrollable — add
.verticalScroll(rememberScrollState()) (importing rememberScrollState) to that
Column (or wrap its contents in a Column/Box with verticalScroll) so the
imageContent, Spacers, Texts and MifosButton are scrollable in constrained
heights. Ensure you reference EmptyContentScreen, imageContent, and MifosButton
when locating the change.
- Around line 52-92: The outer Column uses verticalScroll(rememberScrollState())
which makes height unbounded so Arrangement.Center becomes a no-op and the inner
Column's Modifier.fillMaxSize() collapses; to fix, wrap the scroll content in a
viewport-aware container (e.g., BoxWithConstraints) and apply
Modifier.heightIn(min = maxHeight) to the scrolling child so it gets at least
the viewport height, and change the inner Column's Modifier.fillMaxSize() to
Modifier.fillMaxWidth() (keep padding/testTag) so its verticalArrangement =
Arrangement.Center can actually center when content fits while still allowing
scrolling when content overflows; update the composable that contains
imageContent(), title and subTitle accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f191bf32-693b-4695-b02d-787c4f52b15e

📥 Commits

Reviewing files that changed from the base of the PR and between d399e0a and 653508f.

📒 Files selected for processing (1)
  • core/ui/src/commonMain/kotlin/org/mifospay/core/ui/EmptyContentScreen.kt

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