I'm using the sample below (taken from the CupertinoTabScaffold documentation page).
There is a "slide" transition when pushing a new route inside the tab, but when I click on a tabbar item, the content is brutally replaced. How can I have a transition when switching between tabs?
I would like implement something like that: https://github.com/Interactive-Studio/TransitionableTab
CupertinoTabScaffold(
tabBar: CupertinoTabBar(
items: [
BottomNavigationBarItem(
icon: Icon(CupertinoIcons.home),
title: Text("Tab 0"),
),
BottomNavigationBarItem(
icon: Icon(CupertinoIcons.news),
title: Text("Tab 1"),
),
],
),
tabBuilder: (BuildContext context, …
Run Code Online (Sandbox Code Playgroud) 我正在尝试为推送路线创建淡入淡出过渡,为此创建了一个自定义路线,例如
class CustomPageRoute<T> extends MaterialPageRoute<T> {
CustomPageRoute({WidgetBuilder builder, RouteSettings settings})
: super(builder: builder, settings: settings);
@override
Widget buildTransitions(BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation, Widget child) {
return FadeTransition(opacity:animation, child: child, );
}
}
Run Code Online (Sandbox Code Playgroud)
并通过按下按钮调用它
onPressed: () {
Navigator.push(context, CustomPageRoute(builder: (context) {
return FirstScreen();
}));
}
Run Code Online (Sandbox Code Playgroud)
但这给出了一个带有滑动+淡入淡出的奇怪动画。如何避免这里的滑动动画?
这是我的代码的输出:
将新页面转移到焦点的默认颤动动画是从底部向上滑动.如何更改此行为并从右侧或左侧滑入新页面?
Navigator.push(
context,
new PageRouteBuilder(
pageBuilder: (BuildContext context, _, __) {
return new SearchView();
}
)
);
Run Code Online (Sandbox Code Playgroud) 我正在尝试 flutter 应用程序,我想通过幻灯片导航导航到我的下一个屏幕。新屏幕应该来自正确的动画。在 ios 中它是默认的,但在 android 中它没有发生。
有什么方法可以实现吗?