feat: make NavigationDrawerDestination.label accept custom controls#6395
Open
ndonkoHenri wants to merge 12 commits intorelease/v0.85.0from
Open
feat: make NavigationDrawerDestination.label accept custom controls#6395ndonkoHenri wants to merge 12 commits intorelease/v0.85.0from
NavigationDrawerDestination.label accept custom controls#6395ndonkoHenri wants to merge 12 commits intorelease/v0.85.0from
Conversation
Deploying flet-website-v2 with
|
| Latest commit: |
3e7c4a1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9911f00d.flet-website-v2.pages.dev |
| Branch Preview URL: | https://nav-drawer-label.flet-website-v2.pages.dev |
Deploying flet-examples with
|
| Latest commit: |
3e7c4a1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://57200613.flet-examples.pages.dev |
| Branch Preview URL: | https://nav-drawer-label.flet-examples.pages.dev |
NavigationDrawerDestination.label more customizableNavigationDrawerDestination.label accept custom controls
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands NavigationDrawerDestination.label to support passing a Control (e.g., ft.Text(...)) for richer label customization, and adds NavigationDrawer theming capabilities (state-based label text styles and icon theme) alongside new documentation/examples.
Changes:
- Allow
NavigationDrawerDestination.labelto be a string or aControl, and update Flutter rendering to build label widgets viabuildTextOrWidget(). - Add
NavigationDrawerTheme.icon_themeparsing/handling to enable state-based icon theming for drawer destinations. - Add new docs/examples (theming + adaptive navigation) and golden assets; extend integration tests to generate/update screenshots/GIFs.
Reviewed changes
Copilot reviewed 14 out of 31 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| website/docs/controls/navigationrail/index.md | Adds adaptive navigation example reference and GIF. |
| website/docs/controls/navigationdrawer/index.md | Improves image alt text; adds theming + adaptive navigation examples. |
| website/docs/controls/navigationbar/index.md | Adds adaptive navigation example reference and GIF. |
| sdk/python/Taskfile.yml | Ensures website deps are installed before yarn start. |
| sdk/python/packages/flet/src/flet/controls/theme.py | Documents label selected state styling; adds NavigationDrawerTheme.icon_theme. |
| sdk/python/packages/flet/src/flet/controls/material/navigation_drawer.py | Updates API/docs for destinations; changes tile_padding default; updates docs/examples in docstrings. |
| sdk/python/packages/flet/integration_tests/examples/material/test_navigation_drawer.py | Adds theming + adaptive navigation screenshot/GIF tests; updates docs screenshot setup. |
| sdk/python/packages/flet/integration_tests/examples/material/golden/macos/navigation_drawer/* | Adds/updates golden images/GIFs for new/updated examples. |
| sdk/python/examples/controls/navigation_drawer/theming/* | New theming example demonstrating label/icon theming. |
| sdk/python/examples/controls/navigation_drawer/adaptive_navigation/* | New adaptive navigation example (NavigationBar ↔ NavigationRail + end drawer). |
| packages/flet/lib/src/utils/theme.dart | Parses NavigationDrawerThemeData.iconTheme from icon_theme. |
| packages/flet/lib/src/extensions/control.dart | Extends buildIconOrWidget() with required / error handling options. |
| packages/flet/lib/src/controls/navigation_drawer.dart | Uses buildTextOrWidget() for labels; enforces icon via required: true. |
| client/pubspec.lock | Bumps transitive test deps (matcher, test_api). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sdk/python/packages/flet/src/flet/controls/material/navigation_drawer.py
Show resolved
Hide resolved
sdk/python/packages/flet/src/flet/controls/material/navigation_drawer.py
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #6379
Test Code
Summary by Sourcery
Make NavigationDrawerDestination labels accept controls and enhance navigation drawer theming and examples.
New Features:
Enhancements:
Build:
Documentation:
Tests:
Chores: