Flutter:如何为列表项选中时添加侧滑切换动画?
Flutter 笔记列表与详情页双向侧滑动画实现需求
我在Flutter应用中做了一个笔记列表,希望实现点击列表项查看详情时触发侧滑动画(效果为横向滑入),返回时动画反向播放。目前通过Provider更新selectedNote来切换列表视图(NotesStreamWidget)与详情视图,需要为该视图切换添加双向侧滑动画。
现有代码如下:
SafeArea( child: Column( children: [ const DisplayProfileWidget(), ListContainerWidget( child: selectedNote == null ? const NotesStreamWidget() // 点击列表项时通过Provider设置选中笔记,切换为详情视图 : Column( mainAxisSize: MainAxisSize.max, children: [ const Expanded( child: NoteHeaderWidget(), ), Expanded( flex: 3, child: Text( selectedNote.title.toUpperCase(), style: const TextStyle( fontSize: 20, fontWeight: FontWeight.bold, ), ), ), ], ), ), ], ), ),
切换前后界面截图:
- 列表视图:

- 详情视图:

内容的提问来源于stack exchange,提问作者DarkSide77
相关产品推荐
相关产品推荐

