DynamicScrollSpyWidget class

A widget that implements a scroll spy functionality with a navigation bar and content area.

The widget displays a list of headings in a navigation bar on the left side and corresponding content on the right side. As the user scrolls through the content, the widget automatically highlights the corresponding heading in the navigation bar. Users can also click on headings to scroll to the corresponding content.

Example usage:

DynamicScrollSpyWidget(
  headingList: ['Section 1', 'Section 2', 'Section 3'],
  contentList: [
    Container(child: Text('Content 1')),
    Container(child: Text('Content 2')),
    Container(child: Text('Content 3')),
  ],
  navigationFlex: 1,
  contentFlex: 3,
  headingStyle: TextStyle(fontSize: 16),
  activeHeadingStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
)
Inheritance

Constructors

DynamicScrollSpyWidget.new({required List<String> headingList, required List<Widget> contentList, TextStyle? headingStyle, TextStyle? activeHeadingStyle, EdgeInsets? contentPadding, EdgeInsets? headingPadding, double? headingSpacing, double? contentSpacing, dynamic onHeadingSelected(int index)?, dynamic onContentVisible(int index)?, int navigationFlex = 1, int contentFlex = 3, Key? key})
Creates a DynamicScrollSpyWidget.
const

Properties

activeHeadingStyle TextStyle?
Style for the heading text when active (currently visible in viewport).
final
contentFlex int
Flex value for the content area section (default: 3).
final
contentList List<Widget>
List of widgets corresponding to each heading.
final
contentPadding EdgeInsets?
Padding around each content widget.
final
contentSpacing double?
Spacing between content items.
final
hashCode int
The hash code for this object.
no setterinherited
headingList List<String>
List of headings to show in the navigation bar.
final
headingPadding EdgeInsets?
Padding around each heading in the navigation bar.
final
headingSpacing double?
Spacing between headings in the navigation bar.
final
headingStyle TextStyle?
Style for the heading text when not active.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
Flex value for the navigation bar section (default: 1).
final
onContentVisible → dynamic Function(int index)?
Callback function called when a content item becomes most visible in the viewport.
final
onHeadingSelected → dynamic Function(int index)?
Callback function called when a heading is selected/clicked.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<DynamicScrollSpyWidget>
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