Ank*_*kla 2 android ios flutter
我正在尝试 flutter 应用程序,我想通过幻灯片导航导航到我的下一个屏幕。新屏幕应该来自正确的动画。在 ios 中它是默认的,但在 android 中它没有发生。
有什么方法可以实现吗?
感谢每一个人,但在尝试了几次并在这里和那里搜索之后,我找到了解决方案。
Navigator.of(context).push(new PageRouteBuilder(
opaque: true,
transitionDuration: const Duration(durationInMillis),
pageBuilder: (BuildContext context, _, __) {
return new NextPage();
},
transitionsBuilder: (_, Animation<double> animation, __, Widget child) {
return new SlideTransition(
child: child,
position: new Tween<Offset>(
begin: const Offset(dx, dy),
end: Offset.zero,
).animate(animation),
);
}
));
Run Code Online (Sandbox Code Playgroud)
这里如果 dx>0.0 和 dy=0.0 然后从右边导航如果 dy>0.0 和 dx=0.0 然后从底部导航并且 durationInMillis 是动画的速度。谢谢。
归档时间: |
|
查看次数: |
4290 次 |
最近记录: |