'Animation when changing child widget by index
I am new in Flutter, and so I have a list of widgets,
final List<Widget> _backgrounds = [
const BackgroundDesign(index: 0),
const BackgroundDesign(index: 1),
const BackgroundDesign(index: 2),
const BackgroundDesign(index: 3)
];
this code and navigator:
IndexedStack(children: [
Center(
child: _backgrounds.elementAt(_selectedIndex),
)
],),
It changes _selectedIndex on click, so the result looks like this:

So what i am trying to achieve is _backgrounds.elementAt(_selectedIndex) to be changed with fade animation. Is there any solution for this? Thank you.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
