File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -1555,14 +1555,14 @@ class _RenderDecoration extends RenderBox with SlottedContainerRenderObjectMixin
15551555 case TextDirection .rtl: // origin is on the right
15561556 startX = labelOffset.dx + labelWidth * (1.0 - scale);
15571557 floatStartX = startX;
1558- if (prefixIcon != null && ! decoration.alignLabelWithHint) {
1558+ if (prefixIcon != null && ! decoration.alignLabelWithHint && isOutlineBorder ) {
15591559 floatStartX += material3 ? _boxSize (prefixIcon).width - contentPadding.left : 0.0 ;
15601560 }
15611561 break ;
15621562 case TextDirection .ltr: // origin on the left
15631563 startX = labelOffset.dx;
15641564 floatStartX = startX;
1565- if (prefixIcon != null && ! decoration.alignLabelWithHint) {
1565+ if (prefixIcon != null && ! decoration.alignLabelWithHint && isOutlineBorder ) {
15661566 floatStartX += material3 ? - _boxSize (prefixIcon).width + contentPadding.left : 0.0 ;
15671567 }
15681568 break ;
Original file line number Diff line number Diff line change @@ -2842,6 +2842,25 @@ void main() {
28422842 expect (tester.getBottomLeft (find.text ('text' )).dx, 48.0 );
28432843 expect (getBorderWeight (tester), 2.0 );
28442844 });
2845+
2846+ testWidgets ('Floating label for filled input decoration is aligned with text' , (WidgetTester tester) async {
2847+ await tester.pumpWidget (
2848+ buildInputDecorator (
2849+ useMaterial3: useMaterial3,
2850+ decoration: const InputDecoration (
2851+ prefixIcon: Icon (Icons .ac_unit),
2852+ labelText: 'label' ,
2853+ filled: true ,
2854+ ),
2855+ isFocused: true ,
2856+ ),
2857+ );
2858+
2859+ expect (tester.getSize (find.byType (InputDecorator )), const Size (800.0 , 56.0 ));
2860+ expect (tester.getTopLeft (find.text ('label' )).dx, 48.0 );
2861+ expect (tester.getBottomLeft (find.text ('text' )).dx, 48.0 );
2862+ expect (getBorderWeight (tester), 2.0 );
2863+ });
28452864 });
28462865
28472866 group ('3 point interpolation alignment' , () {
You can’t perform that action at this time.
0 commit comments