Bruno Leroux 411566a2e2
Allow label to be used to compute InputDecorator Intrinsic width (#178101)
## Description

This PR adds `InputDecorator.maintainLabelSize` (similar to
`InputDecorator.maintainHintSize`) to allow the label to be used in the
intrinsic width calculation (if could be used for the intrinsic height
calculation later if needed).

I opted for this flag (and defaulting to false) because changing the
default calculation would probably break various usages.
See
https://github.com/flutter/flutter/issues/178099#issuecomment-3496116095
for why this change will be helpful to simplify and fix DropdownMenu
implementation.


## Before

The label might be cut off:

<img width="126" height="71" alt="Screenshot 2025-11-05 at 20 16 43"
src="https://github.com/user-attachments/assets/61d9f817-5c58-43f9-9307-976f9c124ec7"
/>

## After

The label is entirely visible because it is part of the intrinsic width
calculation:

<img width="126" height="71" alt="Screenshot 2025-11-05 at 20 16 09"
src="https://github.com/user-attachments/assets/47360e17-3cde-4f05-8a6b-cc9e86644ffc"
/>


## Related Issue

Fixes [DropdownMenu menu panel does not close when pressing ESC and
requestFocusOnTap is
false](https://github.com/flutter/flutter/issues/177993)
Part of https://github.com/flutter/flutter/issues/123797
 
## Tests

- Adds 4 tests.
- Updates 1 non-related test where I spotted some nits.
2025-11-06 21:45:20 +00:00
..