nschairer / keyboard_height_plugin

Flutter plugin that emits keyboard height before it shows (ios/android)
BSD 3-Clause "New" or "Revised" License
8 stars 7 forks source link

[iOS] decrease height value if text suggestion is disabled #5

Open iosephmagno opened 9 months ago

iosephmagno commented 9 months ago

@nschairer Hello! Thanks for this plugin, we currently use it in Presence to workaround flutter janks when keyboard is opened. Basically, we calculate keyboard height and animated the UI manually during keyboard animation.

However, we just noticed that the height value is not correct if user disabled the text suggestion (the text suggestion row's height is still added to keyboard height).

Can you please have a look at this?

nschairer commented 9 months ago

Hi! Yup will take a look at this as soon as possible, thank you for the heads up

nschairer commented 8 months ago

An update on this, I have yet to find a reliable way to detect if the text suggestion box is disabled, there may be some way by manually testing with keyboard heights and comparing to what is rendered, but would like to avoid that if possible

iosephmagno commented 2 months ago

Hello @nschairer, and update on this. As mentioned, not being able to determine if suggestion bars is enabled/disable, lead to wrong calculation of keyboard height. An idea to fix this would be to use the platform view to get the keyboard height as usual, but override it with MediaQuery.of(context).viewInsets.bottom after keyboard is opened and MediaQuery.of(context).viewInsets.bottom is smaller than plugin's height. So, if user disabled the suggestion bar, the plugin will know it via Dart and it will still return correct value.

iosephmagno commented 2 months ago

@nschairer indeed I tested plugin lately and it seems that it now return correct value with and with text suggestion bar. Need to double check this.