PrismTabs class
Tabs that adapt to the window instead of overflowing.
Below PrismTokens.breakpointCompact the tab strip scrolls horizontally and
snaps the selected tab into view, because five labels do not fit on a phone
and a TabBar that silently clips them is worse than one that scrolls. Above
it the strip fills the width and the labels get equal space.
The strip is a proper tab list to assistive tech — each tab announces its position ("2 of 4") and selection state — and changing tabs moves focus to the new panel rather than leaving it stranded on the strip.
PrismTabs(
tabs: const [
PrismTab(label: 'Today', icon: Icons.today_outlined),
PrismTab(label: 'Upcoming', icon: Icons.schedule_outlined),
],
index: index,
onChanged: (next) => setState(() => index = next),
children: const [TodayView(), UpcomingView()],
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- PrismTabs
Constructors
Properties
-
children
→ List<
Widget> -
The panel for each tab. Must be the same length as tabs.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
The selected tab.
final
- keepAlive → bool
-
Whether to keep off-screen panels alive, preserving their state. Costs
memory, so it is off by default.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
onChanged
→ ValueChanged<
int> -
Called when a different tab is picked.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollThreshold → double?
-
Width below which the strip scrolls. Defaults to
PrismTokens.breakpointCompact.final - semanticLabel → String?
-
Accessible name for the tab list.
final
-
tabs
→ List<
PrismTab> -
The tabs, left to right.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< PrismTabs> -
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