Greg Spencer 8ec4c59e55
Fix DropdownMenu throwing TextEditingController disposed error on select (#139385)
## Description

When a DropdownMenu exists within another menu and a MenuItem is selected, the `TextEditingController` of the DropdownMenu is used after it has been disposed.

This PR manages the local `TextController` instance better, making sure that the one used when building is the current one, and handling the case where the `controller` is set on the widget after initial creation.

Also, places where we were setting the text and selection separately were converted to use `TextEditingValue` and set the value atomically.

## Related Issues
 - Fixes https://github.com/flutter/flutter/issues/139266

## Tests
 - Added tests (Created by @josh-burton  in https://github.com/flutter/flutter/pull/139268 - Thanks Josh!)
2023-12-05 01:39:29 +00:00
..