OudsLink.icon constructor

const OudsLink.icon({
  1. Key? key,
  2. required String label,
  3. required String? icon,
  4. OudsLinkSize size = OudsLinkSize.defaultSize,
  5. OudsLinkDensity density = OudsLinkDensity.defaultDensity,
  6. VoidCallback? onPressed,
  7. bool tinted = true,
})

Creates an OudsLink displaying its label alongside a custom icon.

  • key : Controls how one widget replaces another widget in the tree.
  • label : The text displayed by the link. Required, non-empty; wraps onto multiple lines automatically if it doesn't fit the available width.
  • icon : Required SVG asset path (or package asset) of the custom icon displayed alongside the label. Its size automatically adapts to size.
  • size : The size of the link, OudsLinkSize.defaultSize or OudsLinkSize.small, controlling text style, icon size and touch target dimensions. Defaults to OudsLinkSize.defaultSize.
  • density : The density of the link, OudsLinkDensity.defaultDensity or OudsLinkDensity.compact, controlling the minimum height and block padding. Defaults to OudsLinkDensity.defaultDensity.
  • onPressed : Callback invoked when the link is tapped or activated (keyboard/screen reader). When null, the link is rendered and announced as disabled and cannot receive focus.
  • tinted : Whether the icon should be tinted with the theme color. Defaults to true. Set to false to keep the icon's original colors (e.g. for multi-color or brand icons); in that case, ensure sufficient contrast with the background for accessibility reasons.

Implementation

const OudsLink.icon({
  super.key,
  required this.label,
  required this.icon,
  this.size = OudsLinkSize.defaultSize,
  this.density = OudsLinkDensity.defaultDensity,
  this.onPressed,
  this.tinted = true,
}) : _indicator = null,
     layout = OudsLinkLayout.textAndIcon;