AnimatedSwitcher with IndexedStack

前端 未结 3 1144
抹茶落季
抹茶落季 2021-01-05 00:35

I have to use IndexedStack to maintain the state of my widgets for my BottomNavigationBar. Now i want to use AnimatedSwitcher (or an alternative) to create an animation when

3条回答
  •  庸人自扰
    2021-01-05 01:30

    This is a cleaner way to use IndexedStack with animations , I created a FadeIndexedStack widget.

    https://gist.github.com/diegoveloper/1cd23e79a31d0c18a67424f0cbdfd7ad

    Usage

    body: FadeIndexedStack(  
        //this is optional
        //duration: Duration(seconds: 1),
        children: _tabs.map((t) => t.widget).toList(),  
        index: _currentIndex,  
      ),  
    
    

提交回复
热议问题