Fix M3 text field height + initial step for input decorator M3 test migration (#142981)
## Description This PR main purpose is to make progress on the M3 test migration for `InputDecorator` (see https://github.com/flutter/flutter/issues/139076). Before this PR more than 80 of the 156 tests defined in `input_decorator_test.dart` fail on M3. Migrating all those tests in one shot is not easy at all because many failures are related to wrong positionning due to M3 typography changes. Another reason is that several M3 specific changes are required in order to get a proper M3 compliant text field, for instance: - https://github.com/flutter/flutter/issues/142972 - https://github.com/flutter/flutter/issues/141354 Most of the tests were relying on an helper function (`buildInputDecorator`) which had a `useMaterial3` parameter. Unfortunately when `useMaterial3: true `was passed to this function it forced `useMaterial3: false` at the top level but overrided it at a lower level, which was very misleading because people could assume that the tests are ok with M3 (but in fact they were run using M2 typography but have some M3 logic in use). I considered various way to make this change and I finally decided to run all existing tests only on M2 for the moment. Next step will be to move most of those tests to M3. In this PR, I migrated two of these existing tests for illustration. Because many of the existing tests are checking input decorator height, I think it would also make sense to fix https://github.com/flutter/flutter/issues/142972 first. That's why I choosed to include a fix to https://github.com/flutter/flutter/issues/142972 in this PR. A M3 filled `TextField` on Android: | Before this PR | After this PR | |--------|--------| | ![image](https://github.com/flutter/flutter/assets/840911/403225b7-4c91-4aee-b19c-0490447ae7e3) | ![image](https://github.com/flutter/flutter/assets/840911/e96cf786-a9f5-4e15-bcdd-078350ff1608) | ## Related Issue Fixes https://github.com/flutter/flutter/issues/142972 Related to https://github.com/flutter/flutter/issues/139076 ## Tests Updates many existing tests + adds 2 tests related to the fix for https://github.com/flutter/flutter/issues/142972 + adds 1 tests for the M3 migration + move 1 tests related to M3
Showing
This diff is collapsed.
Please register or sign in to comment