首页 > 解决方案 > Hiding widgets when the keyboard is active

问题描述

How do you hide certain widgets when the keyboard is activated? I have an app that overflows when a textfield is activated and instead of just compressing everything I would like to hide several of the widgets that are not necessary when filling out the fields.

标签: flutterflutter-layout

解决方案


I'd first suggest to use SingleChildScrollView as parent. It allows you to show the whole view and make it scrollable when keyboard appears.

If you still want to hide elements, you can know if keyboard is on screen by checking if MediaQuery.of(context).viewInsets.bottom > 100.


推荐阅读