BaseCustomImageKey class

Metadata for custom image-based tab bar items

Use this to specify custom image assets for both Material and iOS platforms. On iOS with CNTabBar, uses the native image property for better performance.

Example with platform-specific images:

BottomNavigationBarItem(
  icon: Image.asset(
    'assets/home.png',
    key: BaseCustomImageKey(
      materialImage: 'assets/home.png',
      iosImage: 'assets/home_ios.png',
      imageSize: 28.0, // Size in points for iOS
    ),
  ),
  label: 'Home',
)

Example with single image for all platforms:

BottomNavigationBarItem(
  icon: Image.asset(
    'assets/home.png',
    key: BaseCustomImageKey(
      materialImage: 'assets/home.png',
      imageSize: 28.0,
    ),
  ),
  label: 'Home',
)
Inheritance

Constructors

BaseCustomImageKey({required String materialImage, String? iosImage, double imageSize = 28.0, double width = 24.0, double height = 24.0})
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
height → double
Height of the image in the tab bar for Material design (default: 24.0)
final
imageForIOS → String
Get the appropriate image for the current platform
no setter
imageForMaterial → String
no setter
imageSize → double
Size of the image in points for iOS CNTabBar (default: 28.0) This is used with CNTabBarItem's imageSize property
final
iosImage → String?
The image asset path for iOS (optional, uses materialImage if not provided)
final
materialImage → String
The image asset path for Material design (Android)
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
value → String
The value to which this key delegates its operator==.
finalinherited
width → double
Width of the image in the tab bar for Material design (default: 24.0)
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