Sequence class
Shows one widget at a time from an ordered sequence.
Use a SequenceController to move to the next or previous child, or to select a child by index. Without a transition builder, navigation changes the visible child immediately.
A directional transition wraps both participating children. Its animation
runs from 0 (hidden) to 1 (visible), so the destination runs forward
while the source runs in reverse. Paint and compositing transitions such as
fades, slides, and scales generally impose less work than transitions that
lay out their child on every animation frame.
final controller = SequenceController();
Sequence(
controller: controller,
nextTransition: (child, animation) => FadeTransition(
opacity: animation,
child: child,
),
children: const [
Text('First'),
Text('Second'),
],
)
See the Sequence guide for navigation, transitions, and child lifecycle behavior.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- Sequence
Constructors
-
Sequence({required List<
Widget> children, SequenceTransitionBuilder? nextTransition, SequenceTransitionBuilder? previousTransition, SequenceController? controller, Duration duration = const Duration(milliseconds: 300), Duration reverseDuration = const Duration(milliseconds: 300), bool keepMounted = false, AlignmentGeometry alignment = AlignmentDirectional.topStart, Key? key}) -
Creates a widget that displays one child from
childrenat a time.const
Properties
- alignment → AlignmentGeometry
-
How differently sized children are aligned during a transition.
final
-
children
→ List<
Widget> -
Widgets displayed by the sequence.
final
- controller → SequenceController?
-
Controller used to navigate and observe the selected children index.
final
- duration → Duration
-
Duration used to animate the destination from hidden to visible.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- keepMounted → bool
-
Whether inactive children remain mounted.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- nextTransition → SequenceTransitionBuilder?
-
Transition used when navigating to a higher index.
final
- previousTransition → SequenceTransitionBuilder?
-
Transition used when navigating to a lower index.
final
- reverseDuration → Duration
-
Duration used to animate the source from visible to hidden.
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< Sequence> -
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