PlinthTableOfContents class

A jump list built from a page's headings, matching Mantine's TableOfContents.

Headings are passed in, not discovered. Mantine's version reads them out of the DOM; Flutter has no document to walk, and crawling the widget tree for PlinthTitles would be both fragile and unable to see anything not yet built inside a lazy list. So the list is explicit — which also means it can name sections that aren't headings at all.

Give an item a PlinthTocItem.targetKey matching a key on the heading itself and tapping it scrolls there; otherwise handle onSelected yourself.

PlinthTableOfContents(
  items: const [
    PlinthTocItem(label: 'Introduction'),
    PlinthTocItem(label: 'Installing', order: 2),
  ],
  activeIndex: _visibleSection,
)
Inheritance

Constructors

PlinthTableOfContents({Key? key, required List<PlinthTocItem> items, int? activeIndex, ValueChanged<int>? onSelected, PlinthSize size = PlinthSize.sm, String? color, double indent = 14, bool withRail = true, Duration? scrollDuration})
const

Properties

activeIndex → int?
Which entry is currently on screen. The caller decides — it's the only part that knows where the page is scrolled to.
final
color → String?
final
hashCode → int
The hash code for this object.
no setterinherited
indent → double
Pixels of indent per heading level below the shallowest.
final
items → List<PlinthTocItem>
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onSelected → ValueChanged<int>?
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scrollDuration → Duration?
Null takes the value from the theme, which is what almost every caller wants. It cannot be a default here: a default must be const and a theme lookup is not.
final
size → PlinthSize
final
withRail → bool
Draws the vertical rule that marks the active entry.
final

Methods

build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
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
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