VuIndexScope class

Instruments a tab surface driven by a plain index and setState, where no controller exists — Material 3 NavigationBar, BottomNavigationBar, IndexedStack, or a PageView you drive yourself.

VuIndexScope(
  selectedIndex: _navIndex,
  names: const ['Home', 'Search', 'Profile'],
  group: 'bottom_nav',
  child: NavigationBar(
    selectedIndex: _navIndex,
    onDestinationSelected: (i) => setState(() => _navIndex = i),
    destinations: const [...],
  ),
)

Emits when selectedIndex changes between builds, so it works no matter how the app mutates the index.

By default the selected label is folded into screen.name (Page>Tab). Set foldIntoScreenName to false when nested branch routes already identify the destination (e.g. HomeBranch / SearchBranch) — you still get tab_switch spans with navigation.tab.*, without a redundant composite.

Inheritance

Constructors

VuIndexScope({Key? key, required int selectedIndex, required List<String> names, required Widget child, String? group, String trigger = NavigationConstants.triggerTap, bool foldIntoScreenName = true})
const

Properties

child → Widget
final
foldIntoScreenName → bool
Whether to append the selected label to screen.name. Disable for shells whose per-branch routes already name the screen.
final
group → String?
Distinguishes this surface when a screen has more than one.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
names → List<String>
Labels per index. When foldIntoScreenName is true, names[selectedIndex] becomes the screen.name segment.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectedIndex → int
The currently selected destination index.
final
trigger → String
Reported as navigation.trigger. This widget sees only an index delta — there is no indexIsChanging to read — so it reports tap unless told otherwise.
final

Methods

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