CsAnchorNavigation class

Cloudscape's AnchorNavigation: a table of contents for a long page that highlights the section in view.

CsAnchorNavigation(
  anchors: const [
    CsAnchorNavigationAnchor(text: 'Overview', href: '#overview'),
    CsAnchorNavigationAnchor(text: 'Pricing', href: '#pricing'),
    CsAnchorNavigationAnchor(text: 'On-demand', href: '#on-demand', level: 2, info: 'Updated'),
  ],
  scrollSpy: spy,
)

Pass activeHref to control the highlight yourself; leave it null and pass a scrollSpy to follow the scroll position. Following an anchor calls onFollow and, with a scroll spy and scrollOnFollow, scrolls to the section. onActiveHrefChange fires whenever the active anchor changes, from scrolling or from activeHref.

Anchors are a flat list in page order; CsAnchorNavigationAnchor.level nests them. The accent bar of the active anchor also covers its nested anchors, as in Cloudscape.

Inheritance

Constructors

CsAnchorNavigation({Key? key, required List<CsAnchorNavigationAnchor> anchors, String? activeHref, CsAnchorScrollSpy? scrollSpy, bool scrollOnFollow = true, ValueChanged<CsAnchorNavigationAnchor>? onFollow, ValueChanged<CsAnchorNavigationAnchor>? onActiveHrefChange, String? ariaLabel})
const

Properties

activeHref → String?
The active anchor. When set, the component is controlled and ignores scrollSpy for the highlight.
final
anchors → List<CsAnchorNavigationAnchor>
The anchors in page order.
final
ariaLabel → String?
Accessible name of the list (Cloudscape ariaLabelledby). Defaults to CsStrings.tableOfContents.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onActiveHrefChange → ValueChanged<CsAnchorNavigationAnchor>?
Called when the active anchor changes.
final
onFollow → ValueChanged<CsAnchorNavigationAnchor>?
Called when an anchor is followed (tap, Enter or Space).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scrollOnFollow → bool
Scroll to the section through scrollSpy when an anchor is followed.
final
scrollSpy → CsAnchorScrollSpy?
Follows the scroll position when activeHref is null, and scrolls to a section on follow.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<CsAnchorNavigation>
Creates the mutable state for this widget at a given location in the tree.
override
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
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

Operators

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