flutter - 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.
解决方案
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
.
推荐阅读
- c# - 需要一些指导来了解 EF Core 在内部对此查询的作用
- python-3.x - AWS Lambda 和 S3 上的电话簿搜索
- c++ - C++ 有没有办法从另一个应用程序的值中找到一个内存地址?
- .net-core - Azure 服务总线 - 在 Web API 中使用多个发件人
- azure - 如何将“资源→容器”移动到 Azure Pipelines YAML 文件中的模板?
- c# - runtime:node 的语言工作者重新启动重试次数已超过。关闭并主动回收 Functions Host 以恢复
- angular - 如何使用 flex Layout 将 Angular 路由器的子组件的最小高度设置为 100%
- node.js - 无法在 azure 应用服务上查看 gzipped html 页面
- php - Laravel 使用会话从购物车中删除/删除项目或产品
- ios - Apple ARKit 坐标空间与 VRM 模型不匹配