Bruno Leroux a46bf190ef
Fix date picker flickering (#167976)
## Description

This PR fixes a `DatePicker` flickering issue observed on some devices
with a small display.

### Before

When the date picker input dialog is shown the virtual keyboard opens
and reduces the available height. The current logic reacts by removing
the picker `TextField`. Because there is no more `TextField` the virtual
keyboard is hidden and the available height increases, at that moment
the `TextField` is shown again. Due to autofocus the virtual keyboard
opens which leads to the removal of the `TextField` and so on.


https://github.com/user-attachments/assets/deb70f2e-1c8b-47a9-9db6-47bc521e4eb7


### After

When there is not enough vertical space for the input date picker
dialog, the header is hidden instead of hiding the `TextField`.


https://github.com/user-attachments/assets/14051ee9-3b9a-4467-a4a0-4ee91b4979ea



## Related Issue

[Fixes DatePickerDialog text input causes keyboard to open and close on
a 480p Android
emulator](https://github.com/flutter/flutter/issues/140311).

## Tests

Adds 2 tests.
2025-04-29 15:03:09 +00:00
..