在本机android开发中,通常使用 FragmentTransaction
创建导航动画,其中actionBar 's position stays fixed (but actionBar's内容已更改),actionBar下的片段执行过渡动画(如幻灯片放入或缩小) .
简单来说, AppBar
和身体执行不同的过渡动画 . 在颤动中,创建这样的动画的最佳做法是什么?
目前我可以想到在 Scaffold.body
中使用导航并使用 Stream
StreamBuilder
开始 AppBar
重绘的解决方案 . 类似下面的代码 .
Scaffold(
appBar: StreamBuilder<Int>(
stream: Bloc.of(context).currentFragmentId
builder: //Some logic to decide which AppBar is appropriate
),
body: Navigator(
//Navigation between fragments
),
)
但这真的很奇怪 . 那么有最好的做法吗?请告诉我!