AnimatedResponsiveTransition class
A widget that animates smoothly between different responsive layouts when the screen type changes (e.g., during window resize on Desktop/Web).
Performance Design
- Uses AnimatedSwitcher internally — Flutter's optimized animation engine
- Layout is selected via a single ScreenType comparison (O(1))
- No animation triggers on sub-pixel changes — only on ScreenType change
- Uses
RepaintBoundaryto isolate animated subtree repaints
Example
AnimatedResponsiveTransition(
duration: Duration(milliseconds: 300),
transition: ResponsiveTransitionType.fadeSlide,
mobile: CompactCard(),
tablet: MediumCard(),
desktop: ExpandedCard(),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- AnimatedResponsiveTransition
Constructors
- AnimatedResponsiveTransition({Key? key, required Widget mobile, Widget? tablet, Widget? smallDesktop, Widget? desktop, Widget? largeDesktop, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut, ResponsiveTransitionType transition = ResponsiveTransitionType.fade, AnimatedSwitcherTransitionBuilder? customTransitionBuilder, AnimatedSwitcherLayoutBuilder? layoutBuilder})
-
Creates an AnimatedResponsiveTransition.
const
Properties
- curve → Curve
-
The animation curve. Default: Curves.easeInOut.
final
- customTransitionBuilder → AnimatedSwitcherTransitionBuilder?
-
Optional builder for a custom transition. If provided, overrides transition.
final
- desktop → Widget?
-
Widget for desktop screens. Falls back to smallDesktop → tablet → mobile.
final
- duration → Duration
-
Duration of the transition animation. Default: 300ms.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- largeDesktop → Widget?
-
Widget for large desktop screens. Falls back to desktop chain.
final
- layoutBuilder → AnimatedSwitcherLayoutBuilder?
-
Optional layout builder for the animated switcher.
final
- mobile → Widget
-
Widget for mobile/watch screens. Required as the fallback.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- smallDesktop → Widget?
-
Widget for small desktop screens. Falls back to tablet → mobile.
final
- tablet → Widget?
-
Widget for tablet screens. Falls back to mobile.
final
- transition → ResponsiveTransitionType
-
The type of transition animation. Default: ResponsiveTransitionType.fade.
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