PrismAdaptiveScaffold class
A responsive scaffold that adapts its navigation to the window class.
- Compact (< 600px): bottom navigation bar.
- Medium (600–839px): navigation rail on the leading edge.
- Expanded / ExtraLarge (840px+): navigation rail with labels and a
wider menu, optionally an
endDrawer-style secondary panel.
This is the maintained replacement for the discontinued
flutter_adaptive_scaffold.
PrismAdaptiveScaffold(
destinations: [
AdaptiveDestination(icon: Icons.home_outlined, selectedIcon: Icons.home, label: 'Home'),
AdaptiveDestination(icon: Icons.search_outlined, selectedIcon: Icons.search, label: 'Search'),
],
bodyBuilder: (index) => Center(child: Text('Page $index')),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- PrismAdaptiveScaffold
Constructors
-
PrismAdaptiveScaffold({Key? key, required List<
AdaptiveDestination> destinations, required Widget bodyBuilder(int index), int currentIndex = 0, ValueChanged<int> ? onDestinationSelected, PreferredSizeWidget? appBar, Widget? floatingActionButton, Color? backgroundColor, double? railWidth, bool useExtendedRail = true, NavigationRailLabelType? railLabelType, Duration? transitionDuration}) -
Creates an adaptive scaffold.
const
Properties
- appBar → PreferredSizeWidget?
-
Optional app bar.
final
- backgroundColor → Color?
-
Background color for the scaffold and navigation surfaces.
final
- bodyBuilder → Widget Function(int index)
-
Builds the body for the currently selected currentIndex.
final
-
Label behavior for the bottom navigation bar.
final
- currentIndex → int
-
The index of the currently selected destination.
final
-
destinations
→ List<
AdaptiveDestination> -
The list of navigation destinations.
final
- floatingActionButton → Widget?
-
Optional floating action button.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
onDestinationSelected
→ ValueChanged<
int> ? -
Called when the user selects a destination.
final
- railLabelType → NavigationRailLabelType?
-
Label behavior for the rail. Defaults based on window class.
final
- railWidth → double?
-
Width of the navigation rail on medium/expanded layouts.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- transitionDuration → Duration?
-
Duration for animated transitions between body pages. Defaults to
PrismTokens.durationMedium.
final
- useExtendedRail → bool
-
Whether the rail expands to show labels (expanded+ only).
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