Unverified Commit e74fedcb authored by Kate Lovett's avatar Kate Lovett Committed by GitHub

Fix InputDecorator intrinsic height reporting (#55408)

parent 8df0d686
......@@ -1243,11 +1243,16 @@ class _RenderDecoration extends RenderBox {
double subtextHeight = _lineHeight(width, <RenderBox>[helperError, counter]);
if (subtextHeight > 0.0)
subtextHeight += subtextGap;
return contentPadding.top
final Offset densityOffset = decoration.visualDensity.baseSizeAdjustment;
final double containerHeight = contentPadding.top
+ (label == null ? 0.0 : decoration.floatingLabelHeight)
+ _lineHeight(width, <RenderBox>[prefix, input, suffix])
+ subtextHeight
+ contentPadding.bottom;
final double minContainerHeight = decoration.isDense || expands
? 0.0
: kMinInteractiveDimension + densityOffset.dy;
return math.max(containerHeight, minContainerHeight);
}
@override
......
......@@ -7417,6 +7417,48 @@ void main() {
final RenderBox renderBox = tester.renderObject(find.byType(TextField));
expect(renderBox.size.height, lessThan(kMinInteractiveDimension));
});
group('intrinsics', () {
Widget _buildTest({ bool isDense }) {
return MaterialApp(
home: Scaffold(
body: CustomScrollView(
slivers: <Widget>[
SliverFillRemaining(
hasScrollBody: false,
child: Column(
children: <Widget>[
TextField(
decoration: InputDecoration(
isDense: isDense,
)
),
Container(
height: 1000,
),
],
)
)
],
)
)
);
}
testWidgets('By default, intrinsic height is at least kMinInteractiveDimension high', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/54729
// If the intrinsic height does not match that of the height after
// performLayout, this will fail.
tester.pumpWidget(_buildTest(isDense: false));
});
testWidgets('When isDense, intrinsic height can go below kMinInteractiveDimension height', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/54729
// If the intrinsic height does not match that of the height after
// performLayout, this will fail.
tester.pumpWidget(_buildTest(isDense: true));
});
});
});
testWidgets("Arrow keys don't move input focus", (WidgetTester tester) async {
final TextEditingController controller1 = TextEditingController();
......
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