BaseIconButton class

BaseIconButton

Modern cross-platform icon button with native SF Symbols support via CNIcon.

Native SF Symbols Support:

  • Use symbol parameter for native SF Symbols on iOS (e.g., 'heart.fill', 'star')
  • Automatic fallback to Material Icons on Android via icon or fallbackIcon
  • True native rendering via CNIcon when symbol is provided
  • CNIcon components include built-in iOS 26 Liquid Glass effects automatically

iOS 26 Features (via CNIcon):

  • Liquid Glass Design: Built-in transparency, refractions, and depth
  • Native Rendering: True iOS platform integration
  • Smart Haptic Feedback: Adaptive haptic responses for icon interactions
  • Unified Design Language: Consistent experience across Apple platforms

Material 3 Integration:

  • Semantic ColorScheme usage for icon colors with enhanced state layers
  • Modern accessibility and touch target sizing with improved elevation
  • Cross-platform harmony while preserving platform-specific icon behaviors

use CupertinoButton with CNIcon (native SF Symbols with built-in liquid glass) or Icon by cupertino *** use cupertino = { forceUseMaterial: true } force use IconButton on cuperitno. use IconButton by material *** use material = { forceUseCupertino: true } force use CupertinoButton on material.

Examples:

// Native SF Symbol on iOS
BaseIconButton(
  symbol: 'heart.fill',
  color: Colors.red,
  onPressed: () {},
)

// Cross-platform with fallback
BaseIconButton(
  symbol: 'star.fill',
  fallbackIcon: Icons.star,
  color: Colors.yellow,
  onPressed: () {},
)

// Standard Material Icon
BaseIconButton(
  icon: Icons.settings,
  onPressed: () {},
)

CupertinoButton + CNIcon: Native SF Symbols with built-in Liquid Glass effects IconButton: Updated for Material 3 (Material You) Updated: 2025.10.25 for native CN components with built-in liquid glass

Inheritance

Constructors

BaseIconButton({Key? key, IconData? icon, String? symbol, IconData? fallbackIcon, Color? color, Color? disabledColor, EdgeInsetsGeometry? padding = const EdgeInsets.all(8.0), VoidCallback? onPressed, double? minSize = kMinInteractiveDimensionCupertino, double? pressedOpacity = 0.4, BorderRadius? borderRadius = const BorderRadius.all(Radius.circular(8.0)), double iconSize = 24.0, VisualDensity? visualDensity, double? splashRadius, AlignmentGeometry alignment = Alignment.center, Color? focusColor, Color? hoverColor, Color? highlightColor, Color? splashColor, FocusNode? focusNode, MouseCursor mouseCursor = SystemMouseCursors.click, bool autofocus = false, String? tooltip, bool enableFeedback = true, BoxConstraints? constraints, bool adaptiveHaptics = true, BaseParam? baseParam})
const

Properties

adaptiveHaptics → bool
Enhanced haptic feedback for icon interactions Provides adaptive haptic responses tailored for icon-based actions Note: CNIcon components automatically include liquid glass effects
final
alignment → AlignmentGeometry
CupertinoButton.alignment or IconButton.alignment
final
autofocus → bool
IconButton.autofocus
final
baseParam → BaseParam?
Personalization parameters, gets platform parameters first, then mode parameters
finalinherited
borderRadius → BorderRadius?
CupertinoButton.borderRadius
final
color → Color?
CupertinoButton.color or IconButton.color
final
constraints → BoxConstraints?
IconButton.constraints
final
disabledColor → Color?
CupertinoButton.disabledColor or IconButton.disabledColor
final
enableFeedback → bool
IconButton.enableFeedback
final
fallbackIcon → IconData?
Fallback Material icon for Android when using symbol If not provided and symbol is used, will use icon as fallback
final
focusColor → Color?
IconButton.focusColor
final
focusNode → FocusNode?
IconButton.focusNode
final
hashCode → int
The hash code for this object.
no setterinherited
highlightColor → Color?
IconButton.highlightColor
final
hoverColor → Color?
IconButton.hoverColor
final
icon → IconData?
IconData - Standard Material/Cupertino icon Use either icon or symbol, not both
final
iconSize → double
*** cupertino properties end *** *** material properties start *** IconButton.iconSize
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
minSize → double?
*** general properties end *** *** cupertino properties start *** CupertinoButton.minSize
final
mouseCursor → MouseCursor
IconButton.mouseCursor
final
onPressed → VoidCallback?
CupertinoButton.onPressed or IconButton.onPressed
final
padding → EdgeInsetsGeometry?
*** general properties start *** CupertinoButton.padding or IconButton.padding
final
pressedOpacity → double?
CupertinoButton.pressedOpacity
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
splashColor → Color?
IconButton.splashColor
final
splashRadius → double?
IconButton.splashRadius
final
symbol → String?
SF Symbol name for native iOS icons (e.g., 'heart.fill', 'star', 'gearshape') When provided, uses CNIcon for true native rendering on iOS Use either icon or symbol, not both
final
tooltip → String?
IconButton.tooltip
final
visualDensity → VisualDensity?
IconButton.visualDensity
final

Methods

beforeBuild(BuildContext context) → void
Called before build
inherited
beforeBuildByCupertino(BuildContext context) → void
Called before buildByCupertino
inherited
beforeBuildByCupertinoNative(BuildContext context) → void
Called before buildByCupertinoNative (native iOS implementation)
inherited
beforeBuildByMaterial(BuildContext context) → void
Called before buildByMaterial
inherited
build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
inherited
buildByCupertino(BuildContext context) → Widget
*** material properties end ***
buildByCupertinoNative(BuildContext context) → dynamic
build on cupertino mode with native iOS components (cupertino_native package) This is called when baseParam.nativeIOS = true Default implementation falls back to buildByCupertino()
inherited
buildByMaterial(BuildContext context) → Widget
build on material mode
commonBuild(BuildContext context, BaseParam? baseParam) → dynamic
inherited
createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
getBuildMode(BaseParam? baseParam) → WidgetBuildMode
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited
valueOf(String key, dynamic value) → dynamic
inherited
valueOfBaseParam(BaseParam? baseParam, String key, dynamic value) → dynamic
No reflection available in Dart First get value from platform, then from mode, finally from value itself
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited