Qun Cheng ab70aea3ee
Text should still be centered when search bar height is less than 48 (#128068)
Fixes #127092

This fix can solve the alignment issue in `SearchBar` but we still need to investigate the root cause for the `TextField`. The 
text baseline of `TextField` doesn't change when the height is less than 48 and greater than 40. The problem should be related to the `minContainerHeight` which is 48 by default but the `contentHeight` has become smaller than this min value already. Setting `isDense`/`isCollapsed` to true gives the `minContainerHeight` a smaller number which is 0.0: ff33555b23/packages/flutter/lib/src/material/input_decorator.dart (L1086)

Since [`isDense`](ff33555b23/packages/flutter/lib/src/material/input_decorator.dart (L3907)) is used for the case where the text field has less vertical space, I just use this property in SearchBar.

https://github.com/flutter/flutter/assets/36861262/6ddc8e90-1b47-4dd5-9a57-59b86cafec6d

This is a demo to show the text baseline that doesn't change when we set the text field height under 48.
https://github.com/flutter/flutter/assets/36861262/ce2ee815-f1f5-493a-930e-0540a627bec8
2023-06-02 00:27:22 +00:00
..
2023-06-02 00:23:16 +00:00