Skip to content

feat: Add custom pane example to NavigationView#1302

Closed
Copilot wants to merge 2 commits intomasterfrom
copilot/improve-custom-pane-usage
Closed

feat: Add custom pane example to NavigationView#1302
Copilot wants to merge 2 commits intomasterfrom
copilot/improve-custom-pane-usage

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 2, 2026

NavigationPane.customPane accepts a NavigationPaneWidget for fully custom pane layouts, but lacked any example or documentation showing how to use it.

Changes

  • Example app: Added a "Custom pane" section to NavigationViewPage with a live demo and code snippet showing NavigationPaneWidget usage
  • _CustomNavigationPane: New private class in the example demonstrating how to extend NavigationPaneWidget and compose data.content into a custom layout
  • Changelog: Added entry under [next]

Usage

class CustomNavigationPane extends NavigationPaneWidget {
  @override
  Widget build(BuildContext context, NavigationPaneWidgetData data) {
    return Row(
      children: [
        Container(
          width: 200,
          color: Colors.red.withValues(alpha: 0.2),
          child: const Center(child: Text('Custom pane')),
        ),
        Expanded(child: data.content),
      ],
    );
  }
}

NavigationView(
  pane: NavigationPane(
    customPane: CustomNavigationPane(),
    items: [...],
  ),
)

NavigationPaneWidgetData provides content, titleBar, scrollController, paneKey, listKey, and pane for full control over the layout.

Original prompt

This section details on the original issue you should resolve

<issue_title>Improve developer experience for a custom pane in navigation view.</issue_title>
<issue_description>Implemented NavigationPane.customPane, which now gives you the ability to create custom panes for NavigationView</issue_description>

<agent_instructions>Suggest a more dev-friendly way to use custom panes and implement it. Add a custom pane to the example app. In the end, update the changelog.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@bdlukaa The implementation for a custom pane is very simple, but it could definitely get some love.

First, create a NavigationPaneWidget, similar to creating a stateless widget:

class CustomNavigationPane extends NavigationPaneWidget {
  CustomNavigationPane();

  @override
  Widget build(BuildContext context, NavigationPaneWidgetData data) {
    return Row(
      children: [
        Container(
          color: Colors.red,
          child: Text('This is a custom navigation pane'),
        ),
        Expanded(child: data.content),
      ],
    );
  }
}

Then, provide it in your navigation view tree:

NavigationView(
  pane: NavigationPane(
    customPane: CustomNavigationPane(),
    ...
  ),
  ...
),
```</body></comment_new>
</comments>

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: bdlukaa <45696119+bdlukaa@users.noreply.github.com>
Copilot AI changed the title [WIP] Enhance developer experience for custom panes in navigation view feat: Add custom pane example to NavigationView Mar 2, 2026
@bdlukaa
Copy link
Copy Markdown
Owner

bdlukaa commented Mar 5, 2026

@copilot Address #1025 in this PR. Improve NavigationView documentation, showing off the various features it has, with code examples in the /example project.

@bdlukaa bdlukaa closed this Mar 27, 2026
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.

Improve developer experience for a custom pane in navigation view.

2 participants