Revert "Fix computeMinIntrinsicHeight in _RenderDecoration (#87404)" … (#89675)
* Revert "Fix computeMinIntrinsicHeight in _RenderDecoration (#87404)" (#89667)
This reverts commit 5cf62e84451c23a8aa8c65d56b001913453f39d7.
* add branch to .ci.yaml enabled_branches
Co-authored-by: Zachary Anderson <zanderso@users.noreply.github.com>
Co-authored-by: Christopher Fujino <christopherfujino@gmail.com>
diff --git a/.ci.yaml b/.ci.yaml
index 7983bed..ef7967e 100755
--- a/.ci.yaml
+++ b/.ci.yaml
@@ -10,6 +10,7 @@
- dev
- beta
- stable
+ - flutter-2.6-candidate.5
platform_properties:
linux:
diff --git a/AUTHORS b/AUTHORS
index ef495b3..71d7f10 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -83,4 +83,3 @@
Karol Czeryna <karol.czeryna@gmail.com>
Callum Moffat <callum@moffatman.com>
Koutaro Mori <koutaro.mo@gmail.com>
-Sergei Smitskoi <sergflutterdev@gmail.com>
diff --git a/packages/flutter/lib/src/material/input_decorator.dart b/packages/flutter/lib/src/material/input_decorator.dart
index 333fed6..67a5749 100644
--- a/packages/flutter/lib/src/material/input_decorator.dart
+++ b/packages/flutter/lib/src/material/input_decorator.dart
@@ -971,17 +971,11 @@
final BoxConstraints boxConstraints = layoutConstraints.loosen();
// Layout all the widgets used by InputDecorator
+ boxToBaseline[prefix] = _layoutLineBox(prefix, boxConstraints);
+ boxToBaseline[suffix] = _layoutLineBox(suffix, boxConstraints);
boxToBaseline[icon] = _layoutLineBox(icon, boxConstraints);
- final BoxConstraints containerConstraints = boxConstraints.copyWith(
- maxWidth: boxConstraints.maxWidth - _boxSize(icon).width,
- );
- boxToBaseline[prefixIcon] = _layoutLineBox(prefixIcon, containerConstraints);
- boxToBaseline[suffixIcon] = _layoutLineBox(suffixIcon, containerConstraints);
- final BoxConstraints contentConstraints = containerConstraints.copyWith(
- maxWidth: containerConstraints.maxWidth - contentPadding.horizontal,
- );
- boxToBaseline[prefix] = _layoutLineBox(prefix, contentConstraints);
- boxToBaseline[suffix] = _layoutLineBox(suffix, contentConstraints);
+ boxToBaseline[prefixIcon] = _layoutLineBox(prefixIcon, boxConstraints);
+ boxToBaseline[suffixIcon] = _layoutLineBox(suffixIcon, boxConstraints);
final double inputWidth = math.max(
0.0,
@@ -1017,14 +1011,18 @@
hint,
boxConstraints.copyWith(minWidth: inputWidth, maxWidth: inputWidth),
);
- boxToBaseline[counter] = _layoutLineBox(counter, contentConstraints);
+ boxToBaseline[counter] = _layoutLineBox(counter, boxConstraints);
// The helper or error text can occupy the full width less the space
// occupied by the icon and counter.
boxToBaseline[helperError] = _layoutLineBox(
helperError,
- contentConstraints.copyWith(
- maxWidth: math.max(0.0, contentConstraints.maxWidth - _boxSize(counter).width),
+ boxConstraints.copyWith(
+ maxWidth: math.max(0.0, boxConstraints.maxWidth
+ - _boxSize(icon).width
+ - _boxSize(counter).width
+ - contentPadding.horizontal,
+ ),
),
);
@@ -1269,45 +1267,15 @@
@override
double computeMinIntrinsicHeight(double width) {
- final double iconHeight = _minHeight(icon, width);
- final double iconWidth = _minWidth(icon, iconHeight);
-
- width = math.max(width - iconWidth, 0.0);
-
- final double prefixIconHeight = _minHeight(prefixIcon, width);
- final double prefixIconWidth = _minWidth(prefixIcon, prefixIconHeight);
-
- final double suffixIconHeight = _minHeight(suffixIcon, width);
- final double suffixIconWidth = _minWidth(suffixIcon, suffixIconHeight);
-
- width = math.max(width - contentPadding.horizontal, 0.0);
-
- final double counterHeight = _minHeight(counter, width);
- final double counterWidth = _minWidth(counter, counterHeight);
-
- final double helperErrorAvailableWidth = math.max(width - counterWidth, 0.0);
- final double helperErrorHeight = _minHeight(helperError, helperErrorAvailableWidth);
- double subtextHeight = math.max(counterHeight, helperErrorHeight);
+ double subtextHeight = _lineHeight(width, <RenderBox?>[helperError, counter]);
if (subtextHeight > 0.0)
subtextHeight += subtextGap;
-
- final double prefixHeight = _minHeight(prefix, width);
- final double prefixWidth = _minWidth(prefix, prefixHeight);
-
- final double suffixHeight = _minHeight(suffix, width);
- final double suffixWidth = _minWidth(suffix, suffixHeight);
-
- final double availableInputWidth = math.max(width - prefixWidth - suffixWidth - prefixIconWidth - suffixIconWidth, 0.0);
- final double inputHeight = _lineHeight(availableInputWidth, <RenderBox?>[input, hint]);
- final double inputMaxHeight = <double>[inputHeight, prefixHeight, suffixHeight].reduce(math.max);
-
final Offset densityOffset = decoration.visualDensity!.baseSizeAdjustment;
- final double contentHeight = contentPadding.top
+ final double containerHeight = contentPadding.top
+ (label == null ? 0.0 : decoration.floatingLabelHeight)
- + inputMaxHeight
+ + _lineHeight(width, <RenderBox?>[prefix, input, suffix])
+ contentPadding.bottom
+ densityOffset.dy;
- final double containerHeight = <double>[iconHeight, contentHeight, prefixIconHeight, suffixIconHeight].reduce(math.max);
final double minContainerHeight = decoration.isDense! || expands
? 0.0
: kMinInteractiveDimension;
diff --git a/packages/flutter/test/material/input_decorator_test.dart b/packages/flutter/test/material/input_decorator_test.dart
index 080eb5c..ee74400 100644
--- a/packages/flutter/test/material/input_decorator_test.dart
+++ b/packages/flutter/test/material/input_decorator_test.dart
@@ -5023,146 +5023,6 @@
expect(tester.takeException(), isNull);
});
- testWidgets('min intrinsic height for TextField with prefix icon', (WidgetTester tester) async {
- // Regression test for: https://github.com/flutter/flutter/issues/87403
- await tester.pumpWidget(MaterialApp(
- home: Material(
- child: Center(
- child: SizedBox(
- width: 100.0,
- child: IntrinsicHeight(
- child: Column(
- children: <Widget>[
- TextField(
- controller: TextEditingController(text: 'input'),
- maxLines: null,
- decoration: const InputDecoration(
- prefixIcon: Icon(Icons.search),
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- ),
- ));
-
- expect(tester.takeException(), isNull);
- });
-
- testWidgets('min intrinsic height for TextField with suffix icon', (WidgetTester tester) async {
- // Regression test for: https://github.com/flutter/flutter/issues/87403
- await tester.pumpWidget(MaterialApp(
- home: Material(
- child: Center(
- child: SizedBox(
- width: 100.0,
- child: IntrinsicHeight(
- child: Column(
- children: <Widget>[
- TextField(
- controller: TextEditingController(text: 'input'),
- maxLines: null,
- decoration: const InputDecoration(
- suffixIcon: Icon(Icons.search),
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- ),
- ));
-
- expect(tester.takeException(), isNull);
- });
-
- testWidgets('min intrinsic height for TextField with prefix', (WidgetTester tester) async {
- // Regression test for: https://github.com/flutter/flutter/issues/87403
- await tester.pumpWidget(MaterialApp(
- home: Material(
- child: Center(
- child: SizedBox(
- width: 100.0,
- child: IntrinsicHeight(
- child: Column(
- children: <Widget>[
- TextField(
- controller: TextEditingController(text: 'input'),
- maxLines: null,
- decoration: const InputDecoration(
- prefix: Text('prefix'),
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- ),
- ));
-
- expect(tester.takeException(), isNull);
- });
-
- testWidgets('min intrinsic height for TextField with suffix', (WidgetTester tester) async {
- // Regression test for: https://github.com/flutter/flutter/issues/87403
- await tester.pumpWidget(MaterialApp(
- home: Material(
- child: Center(
- child: SizedBox(
- width: 100.0,
- child: IntrinsicHeight(
- child: Column(
- children: <Widget>[
- TextField(
- controller: TextEditingController(text: 'input'),
- maxLines: null,
- decoration: const InputDecoration(
- suffix: Text('suffix'),
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- ),
- ));
-
- expect(tester.takeException(), isNull);
- });
-
- testWidgets('min intrinsic height for TextField with icon', (WidgetTester tester) async {
- // Regression test for: https://github.com/flutter/flutter/issues/87403
- await tester.pumpWidget(MaterialApp(
- home: Material(
- child: Center(
- child: SizedBox(
- width: 100.0,
- child: IntrinsicHeight(
- child: Column(
- children: <Widget>[
- TextField(
- controller: TextEditingController(text: 'input'),
- maxLines: null,
- decoration: const InputDecoration(
- icon: Icon(Icons.search),
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- ),
- ));
-
- expect(tester.takeException(), isNull);
- });
-
testWidgets('InputDecorationTheme floatingLabelStyle overrides label widget styles when the widget is a text widget (focused)', (WidgetTester tester) async {
const TextStyle style16 = TextStyle(fontFamily: 'Ahem', fontSize: 16.0);
final TextStyle floatingLabelStyle = style16.merge(const TextStyle(color: Colors.indigo));