-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[iOS] Support keyboard animation on iOS #29281
Conversation
Great PR Keyboard animation has a curve |
@luckysmg Thank you for putting in all this effort. I hope it won't take too much time for this PR to be merged. Congrats. According to the video, it animates and pushes the available area smoothly. Please forgive me if these are already included but I want to emphasize two important features :
|
Yes.The keyboard animation has a curve with rawValue 7 |
It looks like it's a coincidence. I think it is better to use curves if there are any (this is just a couple of lines of code) |
yeah,i will add that code later😁
发自我的iPhone
…------------------ Original ------------------
From: Nikita Dauhashei ***@***.***>
Date: Fri,Oct 22,2021 1:02 PM
To: flutter/engine ***@***.***>
Cc: WenJingRui ***@***.***>, Author ***@***.***>
Subject: Re: [flutter/engine] Support keyboard animation on iOS (PR #29281)
Yes.The keyboard animation has a curve with rawValue 7 But I found that the animation still sync with keyboard animation when I didn't set the animation curve. I think Apple did something in iOS SDK to sync this animation curve implicitly @nikitadol
It looks like it's a coincidence. I think it is better to use curves if there are any (this is just a couple of lines of code)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
I know,but I don't know how use this in UIViewAnimationOptions in [UIView animateWithDuration:(NSTimeInterval) delay:(NSTimeInterval) options:(UIViewAnimationOptions) animations:^{
} completion:^(BOOL finished) {
}] Because the keyboard animation curve is not a public value with 7.So I'm not sure how to write it. |
For iOS >= 10 let curve = UIView.AnimationCurve(rawValue: curveValue)!
let animator = UIViewPropertyAnimator(
duration: duration,
curve: curve
) {
self.keyboardAnimationView.frame = CGRect(0, insetBottomEndValue, 0, 0)
}
animator.startAnimation()
animator.addCompletion { finalPosition in
if (finalPosition == .end) {
self.keyboardAnimationLink.invalidate()
self.keyboardAnimationLink = nil
}
} |
Got it , I will try it. Thx |
I have tested the new animation api.If use new API,the code will be a lot. |
You are using If Apple decides to remove it in iOS 16, then no one can build the Flutter app until this code is updated And if it does update, then everyone will have to update the Flutter version (although this can take months or years) I mean, Apple marked this API out of date 2 years ago for a reason |
Yes,if flutter team agrees the plan in this code (refresh with displaylink and get interpolation in a view),I will add new animation API immediately。I will never use a deprecated API in this PR after flutter team agrees this plan😄 |
I thought about it..I just use new API directly for review😄...@nikitadol |
@luckysmg it looks really better 👍 Did you try to make flutter view as subview of root view and update constant of constraint with parallel update of viewMetrics in onDisplay method? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
This PR introduces an issue for SafeArea widgets when maintainBottomViewPadding is set to true - the bottom viewPadding is not respected at all times during the animation. SafeArea contains the following test:
However, it is possible for padding.bottom to be > 0.0 whilst viewInsets.bottom != 0.0 during animation. I would suggest something more like:
I have not tested this fix extensively, but it appears to work fine for iOS |
Hey @joellurcook , nice detective work. I recommend first filing an issue to describes the problem (with animations a screen recording can help communicate the problem). Then put your proposed change in a PR and link the issue. That's the proper method to get eyeballs on your problem/suggestion. |
Hi, i just wonder how to not use this? for me all good and feel smooth, but my client not really like the animation |
What conflict,could you give me a demo code?
发自我的iPhone
…------------------ Original ------------------
From: rizzi ***@***.***>
Date: Wed,Feb 23,2022 2:20 PM
To: flutter/engine ***@***.***>
Cc: WenJingRui ***@***.***>, Mention ***@***.***>
Subject: Re: [flutter/engine] [iOS] Support keyboard animation on iOS (PR#29281)
it make confict when the container and keyboard change toggle show hide @luckysmg I want close it animation
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@nizwar as my test, wrap with MediaQuery can do |
Hi @dhnghia22 ,maybe this is the same issue like flutter/flutter#97609 in framework side |
Hi @luckysmg This is a pretty neat update to the iOS Flutter experience. However, it is causing issues for my chat application. As you can see in the attached video, the smooth keyboard animation is quite visibly janky (even in release mode). This jank was not there when the animation was not smooth (i.e. before you submitted your fix). Is there some way to address the jank? If not, is it possible to not use the smooth animation at all (like previously). RPReplay_Final1654775077.MP4 |
I still got this problem when upgrade to flutter 3.0.3 RPReplay_Final1656216934.MP4On video below, AlertDialog move up when keyboard appear, and dialog have unexpected animation when display when keyboard dismiss. Anyway to fix it.
flutter --version
|
Hi @aurangzaibsiddiqui However, if you wrap something you need to change with a Here is the simple code using for framework side. class TextFieldPage extends StatefulWidget {
const TextFieldPage({Key? key}) : super(key: key);
@override
State<TextFieldPage> createState() => _TextFieldPageState();
}
class _TextFieldPageState extends State<TextFieldPage> {
@override
Widget build(BuildContext context) {
print("page build");
return Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
const Spacer(),
const Text('Keyboard animation', style: TextStyle(fontSize: 26)),
const Spacer(),
Builder(builder: (BuildContext builderCtx) {
print('builder build');
return SizedBox(
/// If you use context, the whole page will be rebuild, you will see log "page build" and "builder build",
/// but use builderCtx (after change you need to hot restart or recreate this page)
/// you will only see log "builder build"
height: 60 + MediaQuery.of(builderCtx).padding.bottom,
child: const CupertinoTextField(
decoration: BoxDecoration(color: Colors.red),
));
}),
],
),
);
}
}
|
This pull request was opened against a branch other than main. Since Flutter pull requests should not normally be opened against branches other than main, I have changed the base to main. If this was intended, you may modify the base back to master. See the Release Process for information about how other branches get updated. Reviewers: Use caution before merging pull requests to branches other than main, unless this is an intentional hotfix/cherrypick. |
This PR supports
FlutterViewController
switch keyboard with smooth animationBefore:
no_animation.MP4
What I have done:
with_animation.MP4
List which issues are fixed by this PR. You must list at least one issue.
flutter/flutter#19279
flutter/flutter#92248
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
Pre-launch Checklist
writing and running engine tests.
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.