Link class

A navigation link that renders itself as an <a> tag.

Supports optional leading and trailing icon components and a text label, laid out horizontally via CSS inline-flex.

Use classes to apply context-specific CSS (e.g. 'nav-link', 'social-link', 'topic-link'). Icon wrappers automatically use '{classes}-icon' for consistent styling.

Link.path('/docs', label: 'Docs', leading: Icons.docs)
Link.url('https://github.com', label: 'GitHub', trailing: Icons.openInNew)
Inheritance
Available extensions

Constructors

Link.fromJson(Map<String, dynamic> json)
factory
Link.path(String path, {String? label, Component? leading, Component? trailing, String classes = 'nav-link', Key? key})
Creates a nav link to an internal path.
Link.url(String url, {String? label, Component? leading, Component? trailing, String classes = 'nav-link', Key? key})
Creates a nav link to an external URL.

Properties

classes → String
CSS class(es) applied to the <a> element.
final
hashCode → int
The hash code for this object.
no setterinherited
href → String
The href to use (path or url).
no setter
isExternal → bool
Whether this is an external link.
no setter
key → Key?
Controls how one component replaces another component in the tree.
finalinherited
label → String?
Display label text.
final
leading → Component?
Component rendered before the label.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
trailing → Component?
Component rendered after the label.
final

Methods

apply({String? id, String? classes, Styles? styles, Map<String, String>? attributes, Map<String, EventCallback>? events}) → Component

Available on Component, provided by the ComponentApplyExtension extension

build(BuildContext context) → Component
Describes the part of the user interface represented by this component.
override
createElement() → Element
Creates a StatelessElement to manage this component's location in the tree.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shouldRebuild(covariant Component newComponent) → bool
Implement this method to determine whether a rebuild can be skipped.
inherited
toJson() → Map<String, dynamic>
toString() → String
A string representation of this object.
inherited

Operators

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