Skip to Content
Forui 0.12.0 is released 🎉

Sidebar

A sidebar widget that provides an opinionated layout for navigation on the side of the screen.

A sidebar is typically used with FScaffold. Usage of FScaffold can be found here.

CLI

To generate and customize this style:

dart run forui style create sidebar

Anatomy

This segment describes the anatomy of the various elements of a sidebar.

FSidebar

The widget that provides an opinionated layout on the side of the screen. The widget has the following sections:

NameParameterPositionOptional
headerheaderstickyâś…
contentchild/childrenscrollable❌
footerfooterstickyâś…

FSidebarGroup

A widget that is used to group several FSidebarItems.

FSidebarItem

Represents an item on the sidebar. May be nested in FSidebarItem.children to create nested items.

Usage

FSidebar(...)

FSidebar( style: FSidebarStyle(...), width: 250, header: const Text('Header'), footer: const Text('Footer'), children: [FSidebarGroup(...)], );

FSidebar.builder(...)

FSidebar.builder( style: FSidebarStyle(...), width: 250, header: const Text('Header'), footer: const Text('Footer'), itemCount: 5, itemBuilder: (context, index) => FSidebarGroup(...), );

FSidebar.raw(...)

FSidebar.raw( style: FSidebarStyle(...), width: 250, header: const Text('Header'), footer: const Text('Footer'), child: SizedBox(), );

FSidebarGroup(...)

FSidebarGroup( style: FSidebarGroupStyle(...), label: const Text('Group'), action: const Icon(FIcons.plus), onActionPress: () {}, children: [FSidebarItem(...)], );

FSidebarItem(...)

FSidebarItem( style: FSidebarItemStyle(...), icon: const Icon(FIcons.box), label: const Text('Item'), selected: false, initiallyExpanded: false, onPress: () {}, onLongPress: () {}, onHoverChange: (hovered) {}, onStateChange: (states) {}, children: [FSidebarItem(...)], );

Examples

Sheet Sidebar

Suited for devices with limited screen space.

Custom Width

Nested FSidebarItem

Last updated on