StacDefaultNavigationController class
A Stac widget that provides a controller for managing navigation state
(current selected index) and exposes a NavigationScope to descendants.
This is the generic replacement for StacDefaultBottomNavigationController
and works with any navigation widget — bottomNavigationBar,
navigationBar, etc. — combined with StacNavigationView for the body.
{@tool snippet} Dart Example:
StacDefaultNavigationController(
length: 3,
initialIndex: 0,
child: StacScaffold(
appBar: StacAppBar(title: StacText('Navigation')),
body: StacNavigationView(
children: const [
StacCenter(child: StacText('Home')),
StacCenter(child: StacText('Search')),
StacCenter(child: StacText('Profile')),
],
),
bottomNavigationBar: StacNavigationBar(
destinations: [
StacNavigationDestination(icon: StacIcon(icon: 'home'), label: 'Home'),
StacNavigationDestination(icon: StacIcon(icon: 'search'), label: 'Search'),
StacNavigationDestination(icon: StacIcon(icon: 'account_circle'), label: 'Profile'),
],
),
),
)
{@end-tool}
{@tool snippet} JSON Example:
{
"type": "defaultNavigationController",
"length": 3,
"initialIndex": 0,
"child": { "type": "scaffold", ... }
}
{@end-tool}
- Inheritance
-
- Object
- StacElement
- StacWidget
- StacDefaultNavigationController
- Available extensions
- Annotations
-
- @JsonSerializable.new()
Constructors
-
Creates a StacDefaultNavigationController with the specified properties.
const
-
Creates a StacDefaultNavigationController from JSON.
factory
Properties
- child → StacWidget
-
The child widget that will be wrapped by this controller.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialIndex → int?
-
The initial index of the selected destination.
final
-
jsonData
→ Map<
String, dynamic> ? -
Raw JSON data for this widget
finalinherited
- length → int
-
The number of navigation destinations.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → String
-
Widget type identifier.
no setteroverride
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parse(
BuildContext context) → Widget? -
Available on StacWidget?, provided by the StacWidgetParser extension
-
parsePreferredSizeWidget(
BuildContext context) → PreferredSizeWidget? -
Available on StacWidget?, provided by the StacWidgetParser extension
Parses a widget for a slot that needs a PreferredSizeWidget, such as a scaffold'sappBaror an app bar'sbottom. -
toJson(
) → Map< String, dynamic> -
Converts this widget to JSON.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited