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

Footer do not stick to iOS Keyboard #26

Open
loic-hamdi opened this issue Apr 22, 2022 · 7 comments
Open

Footer do not stick to iOS Keyboard #26

loic-hamdi opened this issue Apr 22, 2022 · 7 comments

Comments

@loic-hamdi
Copy link

When I try the repo example on iOS physical device, I have the keyboard & footer that shows at a different speed.
How can I please fix this?

RPReplay_Final1650598264.mov
@meetdagm
Copy link

having the same issue did you figure out a solution? @zzterrozz @drogel could you please help?

@loic-hamdi
Copy link
Author

No solution found unfortunately

@drogel
Copy link
Owner

drogel commented Nov 13, 2022

It's possible that the keyboard attachable animations don't align perfectly on some iOS versions. Let me give you a super brief context about this package that will hopefully help:

  • Up until late 2021, Flutter offered no API to animate widgets based on keyboard appearance. You could detect whether or not the keyboard was shown or hidden, but there was no first-party way of performing widget animations that matched the keyboard animations.
  • This was reported for the first time in this GitHub issue on the Flutter repo (Soft keyboard animation unsynchronized with Flutter resize animation flutter/flutter#19279). Since there was no way to do it, I developed keyboard_attachable by inspecting the Android and iOS animations, frame by frame, and I basically reverse-engineered the keyboard animations so that I could implement almost the same animations in Flutter. In this GitHub issue, I shared more details in a comment (Soft keyboard animation unsynchronized with Flutter resize animation flutter/flutter#19279 (comment)), but I stated that this was clearly a workaround for the limited API that Flutter offered back then.
  • The package fidelity on pre-iOS 15 was good enough, but I think from iOS 15 and on the keyboard animations are slightly different, so there might be mismatching.
  • Flutter provided first-party support for this on late 2021. In particular this is the PR that provides support for keyboard animations [iOS] Support keyboard animation on iOS flutter/engine#29281. This renders my keyboard_attachable basically useless, since it was a workaround in the first place, and now there's API support for listening to these kind of animations and responding to them accordingly.

In hindsight, I should probably just deprecate the package and redirect people to that part of the API, so that they know that they are better solutions for these kind of things nowadays. I'll review if that's a reasonable option. If you decide to use keyboard_attachable for whatever reason, keep in mind the package was a workaround in the first place. Although its code is very very simple and it should be fairly straightforward to fork it and twist it to your needs.

@drogelfever
Copy link

Hey!

Just a quick update, we may have a way to update the keyboard animations to the new iOS keyboard animation 🎉

I've created a branch for testing and experimentation with a version of the iOS animation that matches the new iOS keyboard animation better.

https://github.com/drogel/keyboard_attachable/tree/experiment/updated_ios_keyboard_animation_tweens

Take a look if you are interested. I'll see if the fidelity is good enough and test it a bit more, see what I can do.

Thanks!

@loic-hamdi
Copy link
Author

RPReplay_Final1668543560.mp4

@drogelfever still doesn't look "attached" when I try the experiment/updated_ios_keyboard_animation_tweens branch example.
Do you have a different result?

@drogel
Copy link
Owner

drogel commented Nov 15, 2022

Hi @loic-hamdi thanks for testing!

Yes, I see you've got a bezel-less iPhone there, and I suspect I might have to do some more changes to support a smoother animation on bezel-less phones. I tested those changes against an iPhone SE simulator, which has bezels, and the fidelity seemed decent. Although simulators are not ideal to test this, I had no physical device around me today.

Just FYI achieving pixel-perfect fidelity on this is going to be very very challenging. Keep in mind this package relies on a hardcoded curve for the keyboard animation, since we've got no platform API access to the iOS keyboard curve. All I've done so far is just implement the curve found in this Flutter Engine PR in Dart. This curve, in turn, is based on this GitHub project

This is what I've got for a bezeled iPhone. I need to review the behaviour on bezel-less iPhones because your clip indeed displays a non-optimal result. Thanks!

Screen.Recording.2022-11-15.at.19.44.33.mov

@peyman-se
Copy link

Do we have any solution for android? THe merged PR back in 2021 is for iOS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants