flutter-core:flutter-animations
Master Flutter's animation system with implicit and explicit animations, hero transitions, physics-based motion, and custom transitions. Use when adding animations, creating transitions, implementing hero effects, or building interactive animated experiences.
What this skill does
# Flutter Animations Master Flutter's animation system to create smooth, performant, and delightful user experiences through implicit animations, explicit control, hero transitions, and physics-based motion. ## Overview Flutter's animation framework is built on a fundamental principle: well-designed animations make UIs feel more intuitive, contribute to a polished experience, and provide visual feedback that guides users through your application. The framework offers a comprehensive toolkit ranging from simple, pre-packaged implicit animations to fully customizable explicit animations with physics simulations. Understanding when and how to use each type of animation is crucial for building modern Flutter applications. This skill provides comprehensive guidance on Flutter's animation capabilities, performance optimization techniques, and best practices for creating smooth, responsive animations. ## Animation Philosophy in Flutter Flutter approaches animations through a layered architecture that balances ease of use with powerful control: **Progressive Complexity**: Start with the simplest solution that meets your needs. Flutter encourages using implicit animations for straightforward transitions, explicit animations when you need coordination, and custom implementations only when necessary. This progressive approach ensures you're not adding unnecessary complexity to your codebase. **Declarative Animation**: Unlike imperative animation systems where you manually calculate and set values frame-by-frame, Flutter's declarative approach lets you specify what should change and the framework handles the interpolation. You describe the start and end states, and Flutter smoothly transitions between them. **Composition Over Inheritance**: Flutter's animation classes are designed to compose together. A `CurvedAnimation` wraps an `AnimationController`, a `Tween` transforms values, and these pieces combine to create sophisticated effects without deep inheritance hierarchies. **Performance First**: The animation system is optimized for 60fps (or 120fps on capable devices) by default. The framework provides tools like `RepaintBoundary` and `AnimatedBuilder` to minimize unnecessary rebuilds and ensure smooth performance even on lower-end devices. ## Implicit vs Explicit Animations The choice between implicit and explicit animations is one of the first decisions you'll make when adding motion to your Flutter app. ### Implicit Animations Implicit animations are Flutter widgets that automatically animate property changes over a specified duration. They derive from `ImplicitlyAnimatedWidget` and handle all animation controller management internally. **When to Use Implicit Animations**: - Animating simple property changes (opacity, size, color, position) - One-off transitions triggered by user interaction or state changes - Prototyping animation ideas quickly - When you don't need to coordinate multiple animations together **Common Implicit Animated Widgets**: - `AnimatedContainer` - Animates container properties like size, color, padding, and borders - `AnimatedOpacity` - Fades widgets in and out - `AnimatedPositioned` - Animates position changes within a Stack - `AnimatedAlign` - Animates alignment changes - `AnimatedPadding` - Animates padding transitions - `AnimatedSwitcher` - Cross-fades between different widgets - `TweenAnimationBuilder` - Creates custom implicit animations for any property **Key Advantages**: - Minimal boilerplate code - No need to manage AnimationController lifecycle - Automatic cleanup when widget is disposed - Perfect for UI polish and subtle transitions **Example Use Case**: A button that changes color when pressed, a container that expands when selected, or a widget that fades in when data loads. ### Explicit Animations Explicit animations give you full control over the animation lifecycle through `AnimationController`. You manage when animations start, stop, reverse, and repeat. **When to Use Explicit Animations**: - Coordinating multiple simultaneous animations (staggered effects) - Creating looping or repeating animations - Responding to user gestures in real-time (drag, fling) - Building complex animation choreography - When you need precise control over animation timing **Core Components**: - `AnimationController` - The animation timeline controller - `Tween` - Maps animation values to custom ranges - `CurvedAnimation` - Applies easing curves - `AnimatedBuilder` - Efficiently rebuilds only animated parts - `AnimatedWidget` - Base class for reusable animated widgets **Key Advantages**: - Fine-grained control over timing and playback - Ability to coordinate multiple animations - Support for custom animation curves - Integration with gestures and physics simulations **Example Use Case**: A loading spinner that continuously rotates, a card that flips over with coordinated opacity and rotation changes, or an interactive animation that follows user drag gestures. ## Hero Animations Hero animations, also known as shared element transitions, create visual continuity between screens by animating a widget from one route to another. This pattern is ubiquitous in modern mobile apps - think of tapping a photo thumbnail that smoothly expands into a full-screen view. **How Hero Animations Work**: 1. **Tagging**: Wrap widgets on both the source and destination screens with `Hero` widgets sharing the same `tag` 2. **Detection**: When you push a new route, Flutter's Navigator detects matching hero tags 3. **Animation**: The hero widget flies from its position on the first screen to its position on the second screen 4. **Morphing**: The hero can change size, shape, and position during the transition **Behind the Scenes**: Flutter doesn't actually move the widget between screens. Instead, it: - Creates a copy in an overlay above both routes - Animates the overlay widget's bounds using `RectTween` - Uses `MaterialRectArcTween` for curved motion paths - Removes the overlay and reveals the destination widget when complete **Standard Hero Pattern**: The most common pattern involves an image or card that appears on a list screen and expands to fill the detail screen. The hero tag uniquely identifies which elements should animate together. **Radial Hero Animations**: A variant where the hero transforms from circular to rectangular (or vice versa) while flying between screens. This requires using `MaterialRectCenterArcTween` and `RadialExpansion` to maintain the circular clipping during the animation. **Best Practices**: - Use meaningful, unique tags that won't accidentally match other heroes - Keep the widget tree structure similar between source and destination - Wrap image heroes in `Material(color: Colors.transparent)` for smooth transitions - Use `timeDilation` to slow animations during development and debugging - Ensure heroes have defined sizes on both screens ## Performance Considerations Creating smooth animations requires understanding Flutter's rendering pipeline and avoiding common performance pitfalls. ### The 60fps Target Flutter aims to render frames in 16ms or less (60 frames per second). On devices with 120Hz displays, this target drops to 8ms. Each frame consists of: - **Build phase** (8ms budget): Constructing the widget tree - **Layout/Paint phase** (8ms budget): Measuring and rendering If either phase exceeds its budget, you'll experience jank - visible stuttering or dropped frames. ### Critical Performance Rules **1. Avoid Opacity Widget in Animations** The `Opacity` widget is expensive because it requires rendering the child into an intermediate buffer before applying opacity. For animations: - Use `AnimatedOpacity` instead of wrapping widgets in `Opacity` - Use `FadeInImage` for image fade transitions - Apply opacity directly to decoration colors when possible **2. Optimize AnimatedBuilder Usage** `AnimatedBuilder` rebuilds its subtree on every animation frame. To minimize work: - Pass static wi
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.