Modified the computeMinIntrinsicHeight method to calculate the height properly (#75513)
This commit is contained in:
@@ -1268,13 +1268,12 @@ class _RenderDecoration extends RenderBox {
|
||||
final double containerHeight = contentPadding.top
|
||||
+ (label == null ? 0.0 : decoration.floatingLabelHeight)
|
||||
+ _lineHeight(width, <RenderBox?>[prefix, input, suffix])
|
||||
+ subtextHeight
|
||||
+ contentPadding.bottom
|
||||
+ densityOffset.dy;
|
||||
final double minContainerHeight = decoration.isDense! || expands
|
||||
? 0.0
|
||||
: kMinInteractiveDimension;
|
||||
return math.max(containerHeight, minContainerHeight);
|
||||
return math.max(containerHeight, minContainerHeight) + subtextHeight;
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -4548,4 +4548,29 @@ void main() {
|
||||
expect(errorDetails?.toString(), contains("InputDecorator's children reported a negative baseline"));
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user