一,可以在项目中添加默认的跳转动画:
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
defaultTransition: Transition.downToUp,
home: HomePage(),
);
添加defaultTransiton属性,里面有几种动画。
二,可以为单个页面添加跳转动画:
body: Center(
child: ElevatedButton(
child: Text('go to other'),
onPressed: () {
Get.to(OtherPage(),transition: Transition.rightToLeftWithFade);
},
),
),