Sample1 | Sample2 | Sample3 |
---|---|---|
We handle all animations Implicitly, This is power of the ImplicitlyAnimatedWidget, just like AnimatedContainer. It means you don't need to do anything, just change any value and the animation is handled under the hood, if you are curious about it, check the source code, reading the source code is the best way to learn things.
we added an optional argument in the FlChart
class called swapAnimationDuration
, this is a Duration class that you can set the duration of the animation. the default value is 150 ms
, you can change it to fit your requirements.
LineChart(
swapAnimationDuration: Duration(milliseconds: 150),
LineChartData(
isShowingMainData ? sampleData1() : sampleData2(),
),
)
If you want to disable animation, I you should set the duration 0
.