cxxnullptr
V2EX  ›  Flutter

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

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

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

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

    相关 issue:

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

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