Example
Properties
Required
The list of widgets to display in the sidebar. While you have full flexibility, most of the time this will be NeoSidebarButton widgets. You can also include other widgets like a logo, workspace dropdown, progress card, etc.
The main content widget that will be displayed alongside the sidebar. Typically
const AutoRouter() when using Neo’s recommended routing approach, but can be any widget that represents your main content area.State Management
The sidebar layout uses Riverpod providers to manage its state:Controls the sidebar’s visibility and collapse state. Access via
ref.watch() or ref.read().Available State Methods
Platform Behavior
Desktop (768px and above)
Desktop (768px and above)
- Swipe gestures: Control collapse/expand state
- Content behavior: Main content area scales horizontally when collapsing/expanding
Mobile (below 768px)
Mobile (below 768px)
- Swipe gestures: Control hide/show state
- Content behavior: Content slides slightly offscreen to make room for sidebar
Animation & Theming
The sidebar layout uses smooth animations powered by the Neo Theming System:Controls the animation duration for sidebar transitions. Configurable through your theme, though the default timing is carefully crafted.
Best Practices
- Recommended with AutoRouter: Use
child: const AutoRouter()for nested routing when using Neo’s CLI templates and routing approach. - Safe area handling: Structure your pages with
Container(color: theme.colors.bgPrimary)→NeoSafeArea→your contentfor proper full-screen behavior. - Active State Management: Determine active sidebar buttons based on your current route path. Use
router.currentPathto check the active route and setisActiveonNeoSidebarButtonaccordingly. See the Neo CLI sidebar template for a complete example.
Integration Notes
- Internal Components: Never use
NeoSidebardirectly;NeoSidebarLayouthandles everything and provides the complete Neo experience. - Safe Area Intelligence: Automatically handles safe areas and removes them during full-screen transitions.
- Route-Based Active State: The sidebar no longer manages active item state internally. Instead, determine active state based on your routing system (e.g., using
AutoRouter.currentPath).

