Unverified Commit 1cdb6c80 authored by Danny Valente's avatar Danny Valente Committed by GitHub

Modified the computeMinIntrinsicHeight method to calculate the height properly (#75513)

parent aff4e554
...@@ -1268,13 +1268,12 @@ class _RenderDecoration extends RenderBox { ...@@ -1268,13 +1268,12 @@ class _RenderDecoration extends RenderBox {
final double containerHeight = contentPadding.top final double containerHeight = contentPadding.top
+ (label == null ? 0.0 : decoration.floatingLabelHeight) + (label == null ? 0.0 : decoration.floatingLabelHeight)
+ _lineHeight(width, <RenderBox?>[prefix, input, suffix]) + _lineHeight(width, <RenderBox?>[prefix, input, suffix])
+ subtextHeight
+ contentPadding.bottom + contentPadding.bottom
+ densityOffset.dy; + densityOffset.dy;
final double minContainerHeight = decoration.isDense! || expands final double minContainerHeight = decoration.isDense! || expands
? 0.0 ? 0.0
: kMinInteractiveDimension; : kMinInteractiveDimension;
return math.max(containerHeight, minContainerHeight); return math.max(containerHeight, minContainerHeight) + subtextHeight;
} }
@override @override
......
...@@ -4548,4 +4548,29 @@ void main() { ...@@ -4548,4 +4548,29 @@ void main() {
expect(errorDetails?.toString(), contains("InputDecorator's children reported a negative baseline")); expect(errorDetails?.toString(), contains("InputDecorator's children reported a negative baseline"));
expect(errorDetails?.toString(), contains('RenderStack')); expect(errorDetails?.toString(), contains('RenderStack'));
}); });
testWidgets('min intrinsic height for TextField with no content padding', (WidgetTester tester) async {
// Regression test for: https://github.com/flutter/flutter/issues/75509
await tester.pumpWidget(MaterialApp(
home: Material(
child: Center(
child: IntrinsicHeight(
child: Column(
children: const <Widget>[
TextField(
decoration: InputDecoration(
labelText: 'Label Text',
helperText: 'Helper Text',
contentPadding: EdgeInsets.zero,
),
),
],
),
),
),
),
));
expect(tester.takeException(), isNull);
});
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment