3

要在更改屏幕时播放动画,我正在使用page_transition: ^1.1.5

这是一个例子:

Navigator.push(context, PageTransition(type: PageTransitionType.rightToLeft, child: HandymanDocumentsOverview(), duration: Duration(milliseconds: 150)));

昨天我安装firebase_core: ^0.5.0并更新了所有其他 Firebase 依赖项。不知何故,感觉动画速度Navigator.pop(context);比以前慢了很多,甚至不匹配第一个动画速度。有谁知道如何解决这个问题?

编辑这里是我的flutter doctor -v

[✓] Flutter (Channel stable, 1.22.0, on Mac OS X 10.15.4 19E287, locale de-DE)
    • Flutter version 1.22.0 at /Users/bastianmeyer/flutter
    • Framework revision d408d302e2 (3 days ago), 2020-09-29 11:49:17 -0700
    • Engine revision 5babba6c4d
    • Dart version 2.10.0

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/bastianmeyer/Library/Android/sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0, Build version 12A7209
    • CocoaPods version 1.9.1

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.0.1
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] VS Code (version 1.49.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.15.0

[✓] Connected device (1 available)
    • iPhone SE (2nd generation) (mobile) • FC1FC561-C5E6-4E13-AEE5-B5D9308C29B5 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)
4

3 回答 3

4

您正在使用的包尚未更新以设置reverseTransitionDuration最近添加到颤振的包。您可以对此问题进行投票以引起人们的注意。

于 2020-10-24T16:43:46.387 回答
1

更新:应该不再是版本问题1.1.7+3.

于 2020-12-09T11:02:06.737 回答
0

这是指定正向和反向持续时间的一种方法:

Navigator.of(context).push(
  PageRouteBuilder(
    transitionDuration: Duration(milliseconds: 800), // Forward Duration
    reverseTransitionDuration: Duration(milliseconds: 800), // Reverse Duration
    pageBuilder: (BuildContext context,
        Animation<double> animation,
        Animation<double> secondaryAnimation) {
      return NewScreen();
    },
    transitionsBuilder: (BuildContext context,
        Animation<double> animation,
        Animation<double> secondaryAnimation,
        Widget child) {
      return FadeTransition(
        opacity: animation,
        child: child,
      );
    },
  ),
);
于 2021-07-29T16:39:03.160 回答