Skip to content

Add configurable width for side menu and adjacent content (subwindow)#86

Open
max-anders wants to merge 4 commits intoJamalianpour:masterfrom
max-anders:master
Open

Add configurable width for side menu and adjacent content (subwindow)#86
max-anders wants to merge 4 commits intoJamalianpour:masterfrom
max-anders:master

Conversation

@max-anders
Copy link

@max-anders max-anders commented Mar 10, 2025

This update introduces a customContentWidth parameter to improve control over the width of the side menu and its adjacent content, specifically for handling the transition between collapsed and expanded states.

By default, the width is based on MediaQuery.of(context).size.width, but it can be customized for different layouts, particularly when using LayoutBuilder. This ensures a smoother and more predictable transition between states.

🔹 Changes & Improvements

Added customContentWidth to define the width for both the side menu and adjacent content.
Helps resolve issues where the transition between collapsed and expanded states was inconsistent due to full-screen width calculations.
Defaults to MediaQuery but allows custom values to fit within constrained layouts (e.g., when placed inside a Row).
Works seamlessly with LayoutBuilder.maxWidth for better responsiveness.

📌 Usage Example

When using the widget normally:

SideMenu(customContentWidth: MediaQuery.of(context).size.width * 0.7),

For better adaptability inside a constrained layout:

LayoutBuilder(
  builder: (context, constraints) {
    return SideMenu(customContentWidth: constraints.maxWidth);
  },
);

This ensures that the side menu and its adjacent content correctly adjust within flexible layouts rather than relying on the full screen width.

@Jamalianpour
Copy link
Owner

Hi @max-anders, thanks for your PR.
Before I accept and merge it, add document and comments to your code.

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