1. 程式人生 > 其它 >flutter dialog中軟鍵盤遮擋解決衝突

flutter dialog中軟鍵盤遮擋解決衝突

技術標籤:Flutter

在dialog中程式碼軟鍵盤衝突的解決方案;

主要價格這行程式碼:

padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),

完整程式碼:

SingleChildScrollView(
        primary: true,
        reverse: true,
        physics: BouncingScrollPhysics(),
        padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
      )

未解決前:

解決後:

如果底部的bottom會彈窗,在Scaffold中設定

resizeToAvoidBottomPadding: false