質問: flutterを使用してナビゲーションアニメーションを変更する方法 flutterのページ間を移動するときにデフォルトのアニメーションを変更する方法はありますか?
回答: cupertinopageroute を使用してこれを実現できます。以下のコードを確認してください。import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; void main() => runapp(new myapp()); class myapp extends statelesswidget { @override widget build(buildcontext context) { return new materialapp( title: 'transition animation demo', theme: new themedata( primaryswatch: colors.blue, ), home: new firstpage(), ); } } class firstpage extends statefulwidget { @override _firstpagestate createstate() => new _firstpagestate(); } class _firstpagestate extends state<firstpage> { @override widget build(buildcontext context) { return new scaffold( appbar: new appbar( title: new text('first page'), ), body: new center( child: new raisedbutton( child: new text('goto second page'), onpressed: () { navigator.of(context).push(new secondpageroute()); }, ), ), ); } } class secondpageroute extends cupertinopageroute { secondpageroute() : super(builder: (buildcontext context) => new secondpage()); // optional if you wish to have some extra animation while routing @override widget buildpage(buildcontext context, animation<double> animation, animation<double> secondaryanimation) { return new fadetransition(opacity: animation, child: new secondpage()); } } class secondpage extends statefulwidget { @override _secondpagestate createstate() => new _secondpagestate(); } class _secondpagestate extends state<secondpage> { @override widget build(buildcontext context) { return new scaffold( appbar: new appbar( title: new text('second page'), ), body: new center( child: new text('this is the second page'), ), ); } } アニメーションの一部の再生( // optional if you wish to have some extra animation while routing @override widget buildpage(buildcontext context, animation<double> animation, animation<double> secondaryanimation) { return new rotationtransition( turns: animation, child: new scaletransition( scale: animation, child: new fadetransition( opacity: animation, child: new secondpage(), ), )); }