[bug]: Predictive Back Gestures not working with NavigationService
Closed this issue · 8 comments
Describe the bug
Support for predictive back gestures was added to Stable in v3.17 and it works while using the default Flutter navigator. However when using the NavigationService in stacked_services
the animation isn't triggered and the view is popped.
What operating system do you use?
Windows
Information about the installed tooling
[!] Flutter (Channel stable, 3.19.2, on Microsoft Windows [Version 10.0.22631.3235], locale en-US)
• Flutter version 3.19.2 on channel stable at C:\Users\thebb\fvm\default
! Warning: flutter
on your path resolves to C:\Users\thebb\fvm\versions\stable\bin\flutter, which is not inside
your current Flutter SDK checkout at C:\Users\thebb\fvm\default. Consider adding C:\Users\thebb\fvm\default\bin to
the front of your path.
! Warning: dart
on your path resolves to C:\Users\thebb\fvm\versions\stable\bin\dart, which is not inside your
current Flutter SDK checkout at C:\Users\thebb\fvm\default. Consider adding C:\Users\thebb\fvm\default\bin to the
front of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7482962148 (2 weeks ago), 2024-02-27 16:51:22 -0500
• Engine revision 04817c99c9
• Dart version 3.3.0
• DevTools version 2.31.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.
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\thebb\AppData\Local\Android\sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.2)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.7.34018.315
• Windows 10 SDK version 10.0.22621.0
[✓] Android Studio (version 2023.1)
• Android Studio at C:\Program Files\Android\Android Studio
• 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
• Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)
[✓] VS Code (version 1.88.0-insider)
• VS Code at C:\Users\thebb\AppData\Local\Programs\Microsoft VS Code Insiders
• Flutter extension version 3.84.0
[✓] Connected device (4 available)
• Pixel 7 Pro (mobile) • 31031FDH3000Y5 • android-arm64 • Android 14 (API 34)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.3235]
• Chrome (web) • chrome • web-javascript • Google Chrome 122.0.6261.112
• Edge (web) • edge • web-javascript • Microsoft Edge 122.0.2365.80
[✓] Network resources
• All expected network resources are available.
Steps to reproduce the issue
- Create a new Flutter app
- Add
stacked_services
as a dependency and callNavigationService.back()
from any viewmodel.
Expected behavior
No response
Screenshots
No response
Additional Context
No response
Hey, just to be clear, the problem here is that when you call back on the navigation service it stays on the same view and doesn't go back?
Oh nope, the navigation itself works fine with the service but there's no predictive back animation like there is for a flutter app using the contextual navigation. As far as I know it has already been implemented right? Please correct me if I'm wrong
Sorry man, I'm not up to date with those animations, I don't even know what it's supposed to do haha.
I don't know what's expected. It might be implemented, if you're seeing it on a default stable Flutter project.
Got it 😂 And well the animations work when using contextual navigation but not when using the service from stacked so I'm not sure. I'll add a video for reference for what the animation looks like
296241818-96e4be68-6d3f-4e89-842e-53bd5b5bfaf5.webm
Ooooh interesting, I've never seen that and I only use Android devices 😅 that looks really cool.
We don't do anything special, we just call the built-in navigator functions under the hood.
Let's keep it open, maybe one of us can look at it when we have some time.
Thanks for filing the issue.
Got it, thanks!
I'm not sure what exactly changed but the gesture animation seems to work now? 😅 So I'll close the Issue, if someone else can't access it in the future they can reopen it
Okay, so apparently the gesture animation is triggered when on the initial page but not when you navigate to a second page. I also tried using the contextual navigation but that doesn't show the animation either so I guess it's not implemented in Flutter natively yet (Atleast not completely)