Comments (4)
hmm... swapping through a list of items probably doesn't fit the core goals of the library, but it would be easy enough to do with a CustomEffect
. I can see value to adding a CrossfadeEffect
though. I might take a stab at that today.
Something like:
foo.animate()
.crossfade(builder: () => etc, opaque: true)
I also likely won't support animating the size (at least initially), since it seems pretty situational, and I have to imagine it must cause some issues with adaptive layouts. I could look into adding it later behind a flag if there's demand.
from flutter_animate.
Added CrossfadeEffect
in 40a5c67
Kept it simple for now, but feedback is welcome.
from flutter_animate.
Wow, that was impressively quick - thanks mate! 🎉
I'm still very interested in the list of things. For example: fading through a list of products based on scroll position.
Just making sure I understood your response correctly.
swapping through a list of items probably doesn't fit the core goals of the library
Do you mean that the common pattern is item.animate().doSomething(), i.e. animations are geared towards individual items rather than sets of items? Or do you mean something else?
In case of the former, I could naively see a similar approach to AnimateList work. Something akin to:
[a,b,c].animate(target: 2).fadeTo()
Anyway, since I'm still interested in lists of things, I took your CustomEffect suggestion to heart and gave it a spin. Were you thinking of something like:
int value = 0;
@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container().animate(target: value / 4).custom(
begin: 0,
end: 4,
builder: (context, value, _) {
return Stack(
children: [
Container(height: 40, width: 40, color: Colors.red)
.animate(target: value != 0 ? 0 : 1)
.fade(),
Container(height: 40, width: 40, color: Colors.green)
.animate(target: value != 1 ? 0 : 1)
.fade(),
Container(height: 40, width: 40, color: Colors.blue)
.animate(target: value != 2 ? 0 : 1)
.fade(),
Container(height: 40, width: 40, color: Colors.yellow)
.animate(target: value != 3 ? 0 : 1)
.fade(),
],
);
},
),
TextButton(
child: Text('+ ($value)'),
onPressed: () {
setState(() {
value = (value + 1) % 4;
});
}),
],
),
);
}
? It does work, which is nice. I guess, the artisanal arithmetic makes changing the list a bit awful but nothing I couldn't abstract away. I'm mostly curious if you had a more straight forward solution in mind. Thanks!
from flutter_animate.
Right, Animate is really aimed at targeting a widget, and manipulating it visually, whereas this is getting into a more state based feature. You could certainly leverage Animate to do the transitions, or even build something more robust using a CustomEffect (as per your proof of concept) or an Effect subclass, but it's unlikely that this will be rolled into the core library.
from flutter_animate.
Related Issues (20)
- Add An Equivalent to `AnimatedSwitcher` HOT 7
- Combining 2 scaleXY is buggy HOT 1
- Can't get animation to run when calling set state HOT 2
- animate has no property controller on widget list HOT 1
- How do I restart an animation when a widget gets rebuilt?
- Animate custom property with minimal boilerplate (Similar to Implict Widgets) HOT 2
- feature request: clone "xyz extension" documentation to chaining methods HOT 3
- Animate widgets Bug on app release mode
- Allow onInit to prevent play
- max for repeat play only once HOT 1
- Having two Widgets with the same AnimationController can cause errors
- Add an `AnimationLimiter` kinda feature.
- Setting autoPlay to false but defining an onPlay callback tints the console yellow
- Kindly Add VISUAL (gif) images on the pub.dev page, for most common animations woth example
- [Question] Why is this behaviour happening?
- The `flip` effect
- How to use different animations delay on appear than on going away HOT 1
- Cannot Nest multiple animated instances in order to separately control two animations in a single widget
- Target ignores the reset of a bloc state and triggers the animation HOT 1
- hi i have a issue with using arabic text HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_animate.