Skip to content

fix: use ceil() for grid height calculation in dashboard menu - #532

Merged
PeterJhongLinksys merged 1 commit into
dev-2.0.0from
fix/dashboard-menu-grid-height
Dec 26, 2025
Merged

fix: use ceil() for grid height calculation in dashboard menu#532
PeterJhongLinksys merged 1 commit into
dev-2.0.0from
fix/dashboard-menu-grid-height

Conversation

@AustinChangLinksys

@AustinChangLinksys AustinChangLinksys commented Dec 24, 2025

Copy link
Copy Markdown
Collaborator

User description

Problem

The dashboard menu grid view was cutting off content at the bottom. The height calculation was truncating rows when item count is not divisible by column count.

Solution

Use .ceil() to round up the row count, ensuring all rows are fully visible.

Changes

  • Modified _buildMenuGridView in dashboard_menu_view.dart to use .ceil() for height calculation

Testing

  • Verified menu items are now fully visible without truncation

PR Type

Bug fix


Description

  • Fixed grid height calculation using .ceil() to prevent content truncation

  • Ensures all menu items are fully visible when count not divisible by columns

  • Applies to both desktop (3 columns) and mobile (1 column) layouts


Diagram Walkthrough

flowchart LR
  A["Grid Height Calculation"] -->|"Apply ceil() to row count"| B["Prevent Row Truncation"]
  B -->|"Ensures all items visible"| C["Fixed Menu Display"]
Loading

File Walkthrough

Relevant files
Bug fix
dashboard_menu_view.dart
Apply ceil() to grid row count calculation                             

lib/page/dashboard/views/dashboard_menu_view.dart

  • Modified _buildMenuGridView method to apply .ceil() to the row count
    calculation
  • Changed from (items.length / columnCount) * itemHeight to
    (items.length / columnCount).ceil() * itemHeight
  • Ensures proper height allocation for grid when item count is not
    evenly divisible by column count
  • Fixes content cutoff issue in both desktop and mobile layouts
+2/-1     

The height calculation was truncating rows when item count is not divisible
by column count, causing content to be cut off. Using ceil() ensures
all rows are fully visible.
@qodo-code-review

Copy link
Copy Markdown

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Refactor to improve readability and maintainability

Extract magic numbers from the height calculation into named variables like
columnCount and itemHeight to improve readability and maintainability.

lib/page/dashboard/views/dashboard_menu_view.dart [65-74]

 final isDesktop = !context.isMobileLayout;
+final columnCount = isDesktop ? 3 : 1;
+final itemHeight = isDesktop ? 152.0 : 112.0;
+final rowCount = (items.length / columnCount).ceil();
+final gridHeight = rowCount * itemHeight;
+
 return Scrollbar(
   thickness: 0,
   child: SizedBox(
-    height: (items.length / (isDesktop ? 3 : 1)).ceil() *
-            (isDesktop ? 152 : 112) +
-        kDefaultToolbarHeight,
+    height: gridHeight + kDefaultToolbarHeight,
     child: GridView.builder(
       controller: Scrollable.maybeOf(context)?.widget.controller,
       gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 6

__

Why: This is a valid suggestion that improves code readability and maintainability by extracting magic numbers into well-named variables, making the height calculation logic clearer.

Low
  • More

@PeterJhongLinksys PeterJhongLinksys left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good.

@PeterJhongLinksys
PeterJhongLinksys merged commit 74df1d7 into dev-2.0.0 Dec 26, 2025
2 checks passed
@AustinChangLinksys
AustinChangLinksys deleted the fix/dashboard-menu-grid-height branch June 12, 2026 05:55
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