SSideBarItem class

Sidebar model contains two icon data and string for the text main Icon can't be null but unselected icon can be null and in this case it will be the main Icon Sidebar model Represents a single item in the sidebar menu.

Each SSideBarItem defines a menu option with icons, text, optional badges, tooltips, and tap callbacks. Items can display different icons when selected vs unselected, and support notification badges.

Basic Usage

SSideBarItem(
  iconSelected: Icons.home,
  iconUnselected: Icons.home_outlined,
  title: 'Home',
  tooltip: 'Go to Home',
  badgeText: '3', // Optional notification badge
  badgeColor: Colors.red,
  onTap: (offset) {
    print('Home tapped at position: $offset');
  },
)

Badge Support

Items can display notification badges to show counts or status:

SSideBarItem(
  iconSelected: Icons.notifications,
  title: 'Notifications',
  badgeText: '5',
  badgeColor: Colors.red.shade400,
  badgeTextStyle: TextStyle(
    color: Colors.white,
    fontSize: 10,
    fontWeight: FontWeight.bold,
  ),
)

Icon States

Use different icons for selected and unselected states:

SSideBarItem(
  iconSelected: Icons.favorite,        // Filled when selected
  iconUnselected: Icons.favorite_border, // Outlined when not selected
  title: 'Favorites',
)

Constructors

SSideBarItem({required IconData iconSelected, required String title, IconData? iconUnselected, String? tooltip, String? badgeText, Color? badgeColor, TextStyle? badgeTextStyle, dynamic onTap(Offset? offset)?})
Creates a sidebar item with optional tooltip, badge, and tap callback.

Properties

badgeColor Color?
final
badgeText String?
final
badgeTextStyle TextStyle?
final
hashCode int
The hash code for this object.
no setterinherited
iconSelected IconData
final
iconUnselected IconData?
final
onTap → dynamic Function(Offset? offset)?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
title String
final
tooltip String?
final

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