animating-flutter-widgets
Skill7 starsChanged 8 months agoMITView on GitHub
Declarative animation patterns using flutter_animate v4.5.x with composable effects (fade, scale, slide, shimmer, shake, blur), GLSL fragment shaders, and scroll-synchronized animations. Use this skill for adding UI animations and transitions, building staggered or sequenced effects, creating custom animation effects, fixing animation jank or performance issues, implementing shimmer loading states, or adding scroll-driven animations. Supports delays, curves, adaptive effects, and easy extension method chaining (.animate()).
In this repository41 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- skill-creatorSkill
- flutter-dbSkill
- flutter-routingSkill
- flutter-state-managementSkill
- configuring-codemagicSkill
- applying-effective-dartSkill
- deploying-with-fastlaneSkill
- integrating-firebaseSkill
- implementing-fl-chartSkill
- integrating-google-adsSkill
- routing-with-autorouteSkill
- implementing-flutter-blocSkill
- configuring-deep-linksSkill
- persisting-data-with-driftSkill
- building-flutter-production-appsSkill
- generating-flutter-uiSkill
- routing-with-gorouterSkill
- managing-hive-storageSkill
- using-flutter-hooksSkill
- running-flutter-isolatesSkill
- managing-flutter-provider-stateSkill
- implementing-responsive-layoutsSkill
- implementing-riverpodSkill
- managing-secure-storageSkill
- flutter-setupSkill
- managing-shared-preferencesSkill
- implementing-flutter-social-authSkill
- flutter-testingSkill
- using-fpdartSkill
- generating-freezed-modelsSkill
- configuring-github-actionsSkill
- building-jaspr-web-appsSkill
- testing-with-marionetteSkill
- implementing-openapi-in-dartSkill
- integrating-revenuecatSkill
- integrating-sentrySkill
- developing-serverpod-backendSkill
- building-shadcn-flutter-uiSkill
- integrating-supabaseSkill
- converting-ts-to-dartSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 0 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
Prefer the .animate() extension method on any widget over explicit Animate builder blocks.
- Very specific: line 37
Always use the provided num extensions for Duration assignments.
- Very specific: line 43
When effects need to run sequentially rather than in parallel, use the .then() pseudo-effect.
- Very specific: line 59
When target: 1, the animation rests at its end values.
- Very specific: line 81
If you need to extract the raw 0.0 to 1.0 double value (e.g.
- Very specific: line 113
Extension Priority: Always default to the .animate() extension chaining syntax for generating animations unless directly generating an …
- Very specific: line 114
State Simplicity: Do not define AnimationController inside a StatefulWidget if the goal can be solely achieved using flutter_animate's …
- Very specific: line 115
Reuse Effects: If building a Design System, extract List<Effect> arrays into global constants to guarantee application-wide transition …
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Flutter Animate Implementation (v4.5.x)
Goal
Implement performant, composable, and declarative animations in Flutter using the flutter_animate package. The goal is to reduce boilerplate by using .animate() extension methods on widgets rather than manually orchestrating AnimationController and StatefulWidget mechanics.
Instructions
1. The Core Extension Syntax
Prefer the .animate() extension method on any widget over explicit Animate builder blocks.
Correct Usage:
// 🌟 Best Practice: Extension chaining
Text("Hello World!")
.animate()
.fade(duration: 500.ms)
.scale(curve: Curves.easeOutBack);Avoid (unless strictly necessary):
// ❌ Avoid explicit nesting unless building a highly complex reusable list
Animate(
effects: [FadeEffect(), ScaleEffect()],
child: Text("Hello World!"),
)2. Time Extensions (num)
Always use the provided num extensions for Duration assignments. This improves readability.
500.ms(Milliseconds)2.seconds(Seconds)1.5.minutes(Minutes)
3. Orchestration & Sequencing (.then())
When effects need to run sequentially rather than in parallel, use the .then() pseudo-effect. It establishes a new baseline time equal to the previous effect's completion time.
Column(
children: [
Text("Step 1").animate().fadeIn(duration: 400.ms).slideX(),
Text("Step 2").animate()
.fadeIn(duration: 400.ms)
.then(delay: 200.ms) // Step 2 slides 200ms AFTER its own fade completes
.slideY(),
],
)4. Reactive State Animations (target)
The most powerful feature of flutter_animate. Completely eliminate AnimatedContainer or AnimatedOpacity by using the target property.
When target: 1, the animation rests at its end values. When target: 0, the animation reverses cleanly to its begin values.
// Inside a build method that listens to State or Riverpod
bool isHovered = ref.watch(hoverStateProvider);
MyButton()
.animate(target: isHovered ? 1 : 0) // 🌟 Drives the animation entirely by State
.fade(end: 0.8)
.scaleXY(end: 1.1, curve: Curves.easeOutExpo);5. Infinite Loops & Callbacks
To repeat an animation indefinitely, utilize the onPlay callback to manipulate the internal controller.
Icon(Icons.warning)
.animate(onPlay: (controller) => controller.repeat(reverse: true))
.fadeOut(curve: Curves.easeInOut);6. Value Listeners & Custom Effects
If you need to extract the raw 0.0 to 1.0 double value (e.g. to drive a custom painter or a complex color lerp), use .listen() or .custom().
Listen (Side-Effects):
Text("Hello").animate().fadeIn(duration: 1.seconds)
.listen(callback: (value) => print('Current alpha: $value'));CustomEffect (Building from interpolation):
Text("Color Shift").animate().custom(
duration: 300.ms,
builder: (context, value, child) => Container(
// Extrapolates colors cleanly entirely within the animation pipeline
color: Color.lerp(Colors.red, Colors.blue, value),
child: child,
)
);7. Logical Toggles & UI Swapping
ToggleEffect: Yields aboolbased on whether the animation has finished its duration. Useful for flipping raw properties (likeAbsorbPointerlocks).SwapEffect: Replaces the entire rendered Widget at the very end of the animation timeline.
// The button fades out, and is instantly replaced by a Loader widget when the fade completes.
SubmitButton().animate()
.fadeOut(duration: 300.ms)
.swap(builder: (context, child) => const CircularProgressIndicator());Constraints
- Extension Priority: Always default to the
.animate()extension chaining syntax for generating animations unless directly generating anAnimateList. - State Simplicity: Do not define
AnimationControllerinside aStatefulWidgetif the goal can be solely achieved usingflutter_animate'starget:oronPlay:properties. - Reuse Effects: If building a Design System, extract
List<Effect>arrays into global constants to guarantee application-wide transition consistency.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

