SideBarController class
Controller for managing sidebar state and popup functionality.
The SideBarController provides static methods for programmatic control of sidebar behavior, including popup/overlay sidebars and state management.
Popup Sidebars
Create overlay sidebars that float above content:
// Show a popup sidebar
SideBarController.activateSideBar(
SSideBar(
sidebarItems: [
SSideBarItem(iconSelected: Icons.favorite, title: 'Favorites'),
SSideBarItem(iconSelected: Icons.history, title: 'Recent'),
],
onTapForAllTabButtons: (index) {},
),
);
// Dismiss the popup
SideBarController.deactivateSideBar();
State Management
Check and control sidebar state:
// Check if popup sidebar is active
bool isActive = SideBarController.isSideBarActive();
// Check if sidebar is minimized
bool isMinimized = SideBarController.isSideBarMinimized();
// Set minimized state
SideBarController.setMinimizedState(true);
// Get controller instance for advanced usage
final controller = SideBarController.getController();
Use Cases
- Context Menus: Show temporary sidebars for quick actions
- Floating Navigation: Overlay sidebars for mobile/desktop
- Programmatic Control: Control sidebar state from anywhere in the app
- State Persistence: Maintain sidebar state across navigation
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isActive ↔ bool
-
getter/setter pair
- isMinimized ↔ bool
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timer ↔ PausableTimer?
-
getter/setter pair
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
activateSideBar(
{Widget? sSideBar, Offset? offset, BorderRadius? borderRadius}) → void - Activate the sidebar by showing it in a pop overlay
-
deactivateSideBar(
{bool shouldCallToDismissPopOverlay = true}) → void - Deactivate the sidebar by dismissing the pop overlay
-
getController(
) → Injected< SideBarController> - Get the SideBarController instance
-
isSideBarActive(
) → bool - Check if the sidebar is active or minimized
-
isSideBarMinimized(
) → bool - Check if the sidebar is minimized
-
setMinimizedState(
bool minimize) → void - Set the minimized state of the sidebar