Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected Ink Splash with Material3 when navigating #119897

Closed
mk-dev-1 opened this issue Feb 3, 2023 · 21 comments
Closed

Unexpected Ink Splash with Material3 when navigating #119897

mk-dev-1 opened this issue Feb 3, 2023 · 21 comments
Assignees
Labels
d: api docs Issues with https://api.flutter.dev/ f: material design flutter/packages/flutter/material repository. f: routes Navigator, Router, and related APIs. found in release: 3.7 Found to occur in 3.7 found in release: 3.8 Found to occur in 3.8 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on platform-android Android applications specifically r: fixed Issue is closed as already fixed in a newer version team-design Owned by Design Languages team triaged-design Triaged by Design Languages team

Comments

@mk-dev-1
Copy link

mk-dev-1 commented Feb 3, 2023

Steps to Reproduce

  1. Execute flutter run on the code sample
  2. Tap the ListTile to navigate to the second screen
  3. Hit Go back to return to the start screen

Expected results:
Standard navigation back to start screen with ListTile not being highlighted.

Actual results:
ListTile remains highlighted for a brief moment and returns to the expected state afterwards.

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        useMaterial3: true,
        primarySwatch: Colors.blue,
      ),
      home: const HomeScreen(),
    );
  }
}

class HomeScreen extends StatelessWidget {
  const HomeScreen({
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Home'),
      ),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ListTile(
              title: const Text("Title"),
              subtitle: const Text("Tap me!"),
              onTap: () => Navigator.of(context).push(
                MaterialPageRoute(
                  builder: (context) => Scaffold(
                    body: Center(
                      child: Column(
                        mainAxisSize: MainAxisSize.min,
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          const Text("Screen 2"),
                          TextButton(
                              onPressed: () => Navigator.of(context).pop(),
                              child: const Text('Go back'))
                        ],
                      ),
                    ),
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
Logs
No issues found! (ran in 1.4s)
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.1, on macOS 13.0.1 22A400 darwin-arm64, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.74.3)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
@TahaTesser TahaTesser added the in triage Presently being triaged by the triage team label Feb 3, 2023
@TahaTesser
Copy link
Member

TahaTesser commented Feb 3, 2023

Hi @mk-dev-1
Is it reproducible with useMaterial3: false?

Can you also please share a screen recording? I'm not really sure what you mean by "Unexpected highlighting".

@TahaTesser TahaTesser added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 3, 2023
@mk-dev-1
Copy link
Author

mk-dev-1 commented Feb 4, 2023

I can only see the behavior with useMaterial3: true. false seems to be perfectly fine. Question is what is the expected behavior? Maybe it actually is designed like this in material3?

Please find below two screen recordings for comparison:

with.material3.webm
without.material3.webm

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 4, 2023
@danagbemava-nc danagbemava-nc changed the title Unexpected highlighting of ListTile with Material3 when navigating Unexpected Ink Splash with Material3 when navigating Feb 6, 2023
@danagbemava-nc
Copy link
Member

I can reproduce the issue only on android. The issue happens with InkWell and might affect every widget that uses InkWell internally.

I tested with ListTile and a few buttons and the bug reproduced there as well.

This bug did not reproduce on flutter 3.3.10 but Material 3 in that version of flutter was pretty minimal so I can't definitively say that this is a regression.

Labeling for further investigation.

recordings
Android iOS
telegram-cloud-document-4-5983591176559659795.mp4
RPReplay_Final1675690391.MP4
code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        useMaterial3: true,
        primarySwatch: Colors.blue,
      ),
      home: const HomeScreen(),
    );
  }
}

class HomeScreen extends StatelessWidget {
  const HomeScreen({
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    const hs = SizedBox(height: 20);
    return Scaffold(
      appBar: AppBar(
        title: const Text('Home'),
      ),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            InkWell(
              onTap: () => navigate(context),
              child: const Padding(
                padding: EdgeInsets.all(16),
                child: Text("Tap Me - InkWell"),
              ),
            ),
            hs,
            TextButton(
              onPressed: () => navigate(context),
              child: const Text("Tap Me - TextButton"),
            ),
            hs,
            ElevatedButton(
              onPressed: () => navigate(context),
              child: const Text("Tap Me - ElevatedButton"),
            ),
            hs,
            ListTile(
              onTap: () => navigate(context),
              title: const Text('Tap Me - ListTile'),
            )
          ],
        ),
      ),
    );
  }

  void navigate(BuildContext context) {
    Navigator.of(context).push(
      MaterialPageRoute(
        builder: (context) => const SecondPage(),
      ),
    );
  }
}

class SecondPage extends StatelessWidget {
  const SecondPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(appBar: AppBar());
  }
}
flutter doctor -v
[✓] Flutter (Channel stable, 3.7.1, on macOS 13.1 22C65 darwin-arm64, locale en-GB)
    • Flutter version 3.7.1 on channel stable at /Users/nexus/dev/sdks/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7048ed95a5 (5 days ago), 2023-02-01 09:07:31 -0800
    • Engine revision 800594f1f4
    • Dart version 2.19.1
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (version 2022.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[!] Android Studio (version 2022.1)
    • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9477386/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] IntelliJ IDEA Community Edition (version 2022.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

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

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.1 22C65 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 109.0.5414.119

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 2 categories.
[!] Flutter (Channel master, 3.8.0-4.0.pre, on macOS 13.1 22C65 darwin-arm64, locale en-GB)
    • Flutter version 3.8.0-4.0.pre on channel master at /Users/nexus/dev/sdks/flutters
    ! Warning: `flutter` on your path resolves to /Users/nexus/dev/sdks/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutters. Consider adding /Users/nexus/dev/sdks/flutters/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /Users/nexus/dev/sdks/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutters. Consider adding /Users/nexus/dev/sdks/flutters/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b8f5394a5c (30 hours ago), 2023-02-04 23:06:19 -0800
    • Engine revision 2a104cdfcd
    • Dart version 3.0.0 (build 3.0.0-204.0.dev)
    • DevTools version 2.21.1
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (version 2022.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[!] Android Studio (version 2022.1)
    • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9477386/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] IntelliJ IDEA Community Edition (version 2022.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

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

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.1 22C65 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 109.0.5414.119

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 3 categories.

@danagbemava-nc danagbemava-nc added platform-android Android applications specifically framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. f: routes Navigator, Router, and related APIs. has reproducible steps The issue has been confirmed reproducible and is ready to work on found in release: 3.7 Found to occur in 3.7 found in release: 3.8 Found to occur in 3.8 and removed in triage Presently being triaged by the triage team labels Feb 6, 2023
@VadimMalykhin
Copy link

Upgrade to beta channel >=3.8.0 to run a modified code sample that solve your issue.

Add the code below to your theme

ThemeData(
  useMaterial3: true,
  pageTransitionsTheme: const PageTransitionsTheme(
    builders: <TargetPlatform, PageTransitionsBuilder>{
      TargetPlatform.android: ZoomPageTransitionsBuilder(
        allowEnterRouteSnapshotting: false,
      ),
    },
  ),
),
Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(
    MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData.dark(useMaterial3: true).copyWith(
        primaryColor: Colors.blue,
        pageTransitionsTheme: const PageTransitionsTheme(
          builders: <TargetPlatform, PageTransitionsBuilder>{
            TargetPlatform.android: ZoomPageTransitionsBuilder(
              allowEnterRouteSnapshotting: false,
            ),
          },
        ),
      ),
      home: const HomeScreen(),
    ),
  );
}

class HomeScreen extends StatelessWidget {
  const HomeScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Home'),
      ),
      body: Column(
        children: <Widget>[
          ListTile(
            title: const Text('ListTile'),
            subtitle: const Text('Tap me!'),
            onTap: () => _onTap(context),
          ),
          ElevatedButton(
            onPressed: () => _onTap(context),
            child: const Text('ElevatedButton'),
          ),
          FilledButton(
            onPressed: () => _onTap(context),
            child: const Text('FilledButton'),
          ),
          OutlinedButton(
            onPressed: () => _onTap(context),
            child: const Text('OutlinedButton'),
          ),
          TextButton(
            onPressed: () => _onTap(context),
            child: const Text('TextButton'),
          ),
        ],
      ),
    );
  }

  void _onTap(BuildContext context) {
    Navigator.of(context).push(
      MaterialPageRoute(builder: (context) => const NewScreen()),
    );
  }
}

class NewScreen extends StatelessWidget {
  const NewScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Screen 2'),
      ),
      body: Center(
        child: TextButton(
          onPressed: () => Navigator.of(context).pop(),
          child: const Text('Go back'),
        ),
      ),
    );
  }
}
Or change page transition builder to custom

Something like this

class FadePageTransitionsBuilder extends PageTransitionsBuilder {
  @override
  Widget buildTransitions<T>(
    PageRoute<T> route,
    BuildContext context,
    Animation<double> animation,
    Animation<double> secondaryAnimation,
    Widget child,
  ) {
    return FadeTransition(
      opacity: animation,
      child: child,
    );
  }
}
ThemeData(
  useMaterial3: true,
  pageTransitionsTheme: const PageTransitionsTheme(
    builders: <TargetPlatform, PageTransitionsBuilder>{
      TargetPlatform.android: FadePageTransitionsBuilder(),
    },
  ),
),
flutter --version
Flutter 3.8.0-10.1.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 1a0a03a41d (32 hours ago) • 2023-02-16 22:03:58 -0600
Engine • revision 639e313f99
Tools • Dart 3.0.0 (build 3.0.0-218.1.beta) • DevTools 2.21.1

@TahaTesser
Copy link
Member

As @VadimMalykhin pointed allowEnterRouteSnapshotting is causing this behavior, I can confirm when setting allowEnterRouteSnapshotting to false, it works. None of the other transitions reproduce this behavior.

Based on the docs, it seems to be working as intended as animations snapshotted during the transition and this can be disabled in the PageTransitionsTheme. We can document this.

cc: @AlexV525 Do you agree?

@AlexV525
Copy link
Member

cc @Time1ess who invented the parameter.

@Time1ess
Copy link
Contributor

For Android, ZoomPageTransitionsBuilder is used by default for page transition. Say we are navigating from page A to page B, the implementation of this transition builder snapshots both page A and page B and use the snapshots during the page transition animation, this is for better performance and new, CMIW @jonahwilliams. The intention of my PR for adding the allowEnterRouteSnapshotting is that we found this behavior is not OK for some cases in a Google internal app, as this means users won't be able to see the animation (but the animation is actually running) in the page until the transition completes, and after the transition completes, the animation could be in some unexpected state (e.g. middle of the whole duration). So I filed a PR for adding this parameter, so when navigating from page A to page B, only the page A will be snapshotted, while page B won't have a snapshot, all its content will be present as it is, the idea is that users focus on the enter route than the current route during page transition, so snapshotting current route only could still yield better performance while preserve acceptable user experience.

@DaniyalDolare
Copy link

DaniyalDolare commented May 12, 2023

I am getting the same issue of Ink Splash of InkWell while navigating back to a page.
I am running on latest flutter 3.10 stable
Platform: android

Code Sample
void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: const Text("Test"),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            InkWell(
              splashColor: Colors.red,
              onTap: () {
                Navigator.push(
                    context,
                    MaterialPageRoute(
                        builder: (context) => const SecondPage()));
              },
              child: const Padding(
                padding: EdgeInsets.all(20.0),
                child: Text(
                  'Go to Second Page',
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

class SecondPage extends StatelessWidget {
  const SecondPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.purple[200],
      body: Center(
        child: ElevatedButton(
            onPressed: () {
              Navigator.pop(context);
            },
            child: const Text("Go back")),
      ),
    );
  }
}

But when i set useMeterial3 to false, it works fine, no issues.
Also when I add this, it works fine and no issues.

ThemeData(
  colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
  useMaterial3: true,
  pageTransitionsTheme: const PageTransitionsTheme(
    builders: <TargetPlatform, PageTransitionsBuilder>{
      TargetPlatform.android: ZoomPageTransitionsBuilder(
        allowEnterRouteSnapshotting: false,
      ),
    },
  ),
),

Is there any ceveat of setting allowEnterRouteSnapshotting to false.

Pls look into this issue.
@TahaTesser @AlexV525 @Time1ess

See video

  1. When using material 3 (issue comes here)
Screenrecording_20230512_154327.mp4
  1. When removed material 3 (issue solved but no material 3)
Screenrecording_20230512_154514.mp4
  1. When using material 3 and setting allowEnterRouteSnapshotting to false (issue solved with m3)
Screenrecording_20230512_164502.mp4

@TahaTesser
Copy link
Member

cc: @bleroux

@bleroux
Copy link
Contributor

bleroux commented May 17, 2023

Since #100812 zoom page transition is the default on Android.
#106621 introduces a performance improvement to the zoom page transition. There were some trade-offs related to using animations during a transition, which is the case in this issue.

A flag was introduced to opt-out and use the previous behavior on a per route basis,
see https://master-api.flutter.dev/flutter/widgets/PageRoute/allowSnapshotting.html
(and this particular comment: “Generally this means that animations that occur on the entering/exiting route while the route animation plays may appear frozen”).

#118086 introduces a global flag to disable the snapshotting for entering transitions.
#122019 introduces another global flag to disable the snapshotting for both entering and exiting..

I also filed some documentation updates in #121701 to make this more visible.

I plan to file a website issue to make this visible in the following page: https://docs.flutter.dev/release/breaking-changes/page-transition-replaced-by-ZoomPageTransitionBuilder

Maybe there are some other places where we can mention this? All ideas are welcome.

@flutter-triage-bot flutter-triage-bot bot added the team-android Owned by Android platform team label Jul 8, 2023
@bleroux bleroux removed their assignment Aug 2, 2023
@bleroux
Copy link
Contributor

bleroux commented Aug 2, 2023

Unassigning myself as I'm not sure if and where more documentation can be added.
See for #119897 (comment) for a summary of work related to this issue.

@reidbaker reidbaker added triaged-android Triaged by Android platform team fyi-framework For the attention of Framework team and removed team-android Owned by Android platform team labels Aug 24, 2023
@flutter-triage-bot flutter-triage-bot bot removed the triaged-android Triaged by Android platform team label Aug 24, 2023
@flutter-triage-bot
Copy link

The triaged-android label is irrelevant if there is no team-android label or fyi-android label.

@Piinks Piinks added team-design Owned by Design Languages team team-framework Owned by Framework team labels Aug 30, 2023
@Piinks
Copy link
Contributor

Piinks commented Aug 30, 2023

For triage clarity - any issue falling under material design should be given a team-design label.

@Piinks Piinks added triaged-framework Triaged by Framework team and removed team-framework Owned by Framework team triaged-framework Triaged by Framework team fyi-framework For the attention of Framework team labels Aug 30, 2023
@HansMuller HansMuller added the triaged-design Triaged by Design Languages team label Sep 6, 2023
@bleroux bleroux assigned bleroux and unassigned TahaTesser Sep 26, 2023
@bleroux
Copy link
Contributor

bleroux commented Sep 26, 2023

Closing this issue since several related PRs landed. Especially #121701 which adds an example to deactivate snapshotting globally.

Since #100812 zoom page transition is the default on Android.
#106621 introduces a performance improvement to the zoom page transition. There were some trade-offs related to using animations during a transition, which is the case in this issue.

A flag was introduced to deactivate snapshotting on a per route basis,
see https://master-api.flutter.dev/flutter/widgets/PageRoute/allowSnapshotting.html
(and this particular comment: “Generally this means that animations that occur on the entering/exiting route while the route animation plays may appear frozen”).

Several PRs introduced global flags to deactivate snapshotting :
#118086 introduces a global flag to disable the snapshotting for entering transitions.
#122019 introduces another global flag to disable the snapshotting for both entering and exiting.

@bleroux bleroux closed this as completed Sep 26, 2023
@bleroux bleroux added the r: fixed Issue is closed as already fixed in a newer version label Sep 26, 2023
@ellet0
Copy link
Contributor

ellet0 commented Sep 27, 2023

Same issue here but it happen even with useMaterial3 false

@feinstein
Copy link
Contributor

I got this behavior in my app and it's not obvious what's going on and IMO most people won't find on a google search what's going on and how to fix it.

Documentation and flags doesn't seem to be the a reasonable solution IMHO, things should just work in the expected way, and InkWell is a very common widget to not work as expected in Android.

Can we have the animations not animate, but their timers/tickers continue to advance in time, so when we go back the animations will have finished? I believe this solves the performance issue and the InkWell animating on back navigation.

Another suggestion (which I honestly don't know if it's feasible) is to implement the zoom transition as a shader instead. I don't know if it's possible, but it could have a better performance, allowing us to not need to disable animations.

cc @jonahwilliams

@JonathanPeterCole
Copy link
Contributor

In my experience the current default behaviour more often than not results in noticeable side-effects which hurts the native feel. Setting allowEnterRouteSnapshotting to false makes the snapshotting almost imperceptible in most cases, but it's probably not very clear to new Flutter devs how to do this, so I feel like making this the default would improve the experience.

Regarding the performance of the transition itself, it's worth noting that as of Android 13 there's a new transition for native apps. When this change is brought to Flutter it could have a different performance impact than the zoom transition. It looks like this new transition is currently being tracked under #116526.

screen-20231001-170121.mp4

Interestingly the native transition seems to involve some form of snapshotting for blending the screens together, as can be seen in this screenshot where the scrollbar from the exiting screen and the photo on the entering screen are stretched (on a screen with an animation playing, eg an ink sparkle, the stretched portion is not animated):

Screenshot

mid-transition

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
d: api docs Issues with https://api.flutter.dev/ f: material design flutter/packages/flutter/material repository. f: routes Navigator, Router, and related APIs. found in release: 3.7 Found to occur in 3.7 found in release: 3.8 Found to occur in 3.8 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on platform-android Android applications specifically r: fixed Issue is closed as already fixed in a newer version team-design Owned by Design Languages team triaged-design Triaged by Design Languages team
Projects
Status: Issue closed with comment
Status: Done
Development

No branches or pull requests