cxxnullptr
V2EX  ›  Flutter

Flutter 如何优雅的实现一个 KeyboardBar?

  •  
  •   cxxnullptr · Apr 28, 2024 · 1826 views
    This topic created in 769 days ago, the information mentioned may be changed or developed.

    参考 这个回答, 我用 Scaffold + bottomSheet 简单实现了一个,但有个问题,就是使用 image_picker 选取图片后,自定义的 KeyboardBarbottomSheet)会被键盘遮住一部分,具体可以看我提的 issue

    参考 这个回答 重新实现了一下,也是一模一样的问题,似乎是 Flutter 的 MediaQuery.of(context).viewInsets.bottom 出现了 BUG 。

    相关 issue:

    现在 App 着急上线,但不知道 Flutter 什么时候能修复这个 BUG ,是否还有其它方式能实现相同的功能呢?

    2 replies    2024-04-28 13:09:58 +08:00
    binhb
        1
    binhb  
       Apr 28, 2024
    选取完图片你把键盘隐藏掉,不就避免了吗
    (如果键盘需要打开的话,让输入框重新 focus )
    cxxnullptr
        2
    cxxnullptr  
    OP
       Apr 28, 2024
    @binhb 是个好的思路,我尝试一下,感谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3211 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 03:06 · PVG 11:06 · LAX 20:06 · JFK 23:06
    ♥ Do have faith in what you're doing.