Skip to content

NavigationRail: optionally scrollable and more configurable #169421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

pogojotz
Copy link
Contributor

@pogojotz pogojotz commented May 24, 2025

This is modified and extended version of the merged and reverted PR #137415. It was reverted, because it broke a the sample app "Material 3 demo". This PR circumvents the breaking of existing code, by making the changes optional via constructor parameters. Default values for the parameters are functionally equivalent to the state before this change. The new key parameter for this is scrollable.

Additionally this change includes the parameters leadingAtTop: true and trailingAtBottom: false.

Fixes #89167

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels May 24, 2025
@pogojotz
Copy link
Contributor Author

pogojotz commented May 24, 2025

Reasoning for the additional parameters trailingAtBottom and leadingAtTop

There seems to be a use case for at least trailingAtBottom: true, as the mentioned "Material 3 demo" implements exactly that in a bit of a hacky approach. The sample app exploits the knowledge of the implementation detail, that trailing is part of the same Column as the navigation destination and using an Expanded widget to expand to bottom. There was an attempt to fix this in flutter/samples#2157, but that was dropped due to difficulties, which ultimately led to the revert (#143097) mentioned earlier.

I believe, by introducing more flexibility to the NavigationRail, less hacks will be implemented to achieve, what people would like to see in their apps. The Material guidelines do not mention anything about trailing widgets.

The leading widget seems to be address the "menu" and "FAB" buttons mentioned in the guidelines, which are always at the top. So I leave it up for debate, if leadingAtTop is actually required, but I think it might be good to have an additional degree of freedom.

@pogojotz pogojotz force-pushed the make-navrail-optionally-scrollable branch from 168bd28 to a42fbaf Compare May 25, 2025 15:50
@pogojotz pogojotz marked this pull request as ready for review May 25, 2025 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Making NavigationRail scrollable
1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy