Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
48ba488d
Unverified
Commit
48ba488d
authored
Sep 17, 2020
by
renyou
Committed by
GitHub
Sep 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "TextField constrained layout bug (#65966)" (#66027)
This reverts commit
10a66b19
.
parent
d15da04f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
57 deletions
+6
-57
input_decorator.dart
packages/flutter/lib/src/material/input_decorator.dart
+6
-6
input_decorator_test.dart
packages/flutter/test/material/input_decorator_test.dart
+0
-51
No files found.
packages/flutter/lib/src/material/input_decorator.dart
View file @
48ba488d
...
...
@@ -1032,12 +1032,11 @@ class _RenderDecoration extends RenderBox {
counterHeight
,
helperErrorHeight
,
);
final
Offset
densityOffset
=
decoration
.
visualDensity
.
baseSizeAdjustment
;
boxToBaseline
[
input
]
=
_layoutLineBox
(
input
,
boxConstraints
.
deflate
(
EdgeInsets
.
only
(
top:
contentPadding
.
top
+
topHeight
+
densityOffset
.
dy
/
2
,
bottom:
contentPadding
.
bottom
+
bottomHeight
+
densityOffset
.
dy
/
2
,
top:
contentPadding
.
top
+
topHeight
,
bottom:
contentPadding
.
bottom
+
bottomHeight
,
)).
copyWith
(
minWidth:
inputWidth
,
maxWidth:
inputWidth
,
...
...
@@ -1066,12 +1065,13 @@ class _RenderDecoration extends RenderBox {
prefixHeight
-
boxToBaseline
[
prefix
],
suffixHeight
-
boxToBaseline
[
suffix
],
);
final
double
fixBelowInput
=
fixBelowBaseline
<=
0.0
?
0.0
:
math
.
max
(
final
double
fixBelowInput
=
math
.
max
(
0
,
fixBelowBaseline
-
(
inputHeight
-
inputInternalBaseline
),
);
// Calculate the height of the input text container.
final
Offset
densityOffset
=
decoration
.
visualDensity
.
baseSizeAdjustment
;
final
double
prefixIconHeight
=
prefixIcon
==
null
?
0
:
prefixIcon
.
size
.
height
;
final
double
suffixIconHeight
=
suffixIcon
==
null
?
0
:
suffixIcon
.
size
.
height
;
final
double
fixIconHeight
=
math
.
max
(
prefixIconHeight
,
suffixIconHeight
);
...
...
@@ -1087,8 +1087,8 @@ class _RenderDecoration extends RenderBox {
);
final
double
minContainerHeight
=
decoration
.
isDense
||
decoration
.
isCollapsed
||
expands
?
0.0
:
kMinInteractiveDimension
;
final
double
maxContainerHeight
=
boxConstraints
.
maxHeight
-
bottomHeight
;
:
kMinInteractiveDimension
+
densityOffset
.
dy
;
final
double
maxContainerHeight
=
boxConstraints
.
maxHeight
-
bottomHeight
+
densityOffset
.
dy
;
final
double
containerHeight
=
expands
?
maxContainerHeight
:
math
.
min
(
math
.
max
(
contentHeight
,
minContainerHeight
),
maxContainerHeight
);
...
...
packages/flutter/test/material/input_decorator_test.dart
View file @
48ba488d
...
...
@@ -4235,55 +4235,4 @@ void main() {
expect
(
tester
.
getSize
(
find
.
text
(
labelText
)).
width
,
labelWidth
);
expect
(
getOpacity
(
tester
,
prefixText
),
1.0
);
});
testWidgets
(
'given enough space, constrained and unconstrained heights result in the same size widget'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/65572
final
UniqueKey
keyUnconstrained
=
UniqueKey
();
final
UniqueKey
keyConstrained
=
UniqueKey
();
Widget
getInputDecorator
(
VisualDensity
visualDensity
)
{
return
MaterialApp
(
home:
Material
(
child:
Builder
(
builder:
(
BuildContext
context
)
{
return
Theme
(
data:
Theme
.
of
(
context
).
copyWith
(
visualDensity:
visualDensity
),
child:
Center
(
child:
Row
(
children:
<
Widget
>[
SizedBox
(
width:
35.0
,
child:
TextField
(
key:
keyUnconstrained
,
),
),
SizedBox
(
width:
35.0
,
// 48 is the height that this TextField would take when
// laid out with no constraints.
height:
48.0
,
child:
TextField
(
key:
keyConstrained
,
),
),
],
),
),
);
},
),
),
);
}
await
tester
.
pumpWidget
(
getInputDecorator
(
VisualDensity
.
standard
));
final
double
constrainedHeight
=
tester
.
getSize
(
find
.
byKey
(
keyConstrained
)).
height
;
final
double
unConstrainedHeight
=
tester
.
getSize
(
find
.
byKey
(
keyUnconstrained
)).
height
;
expect
(
constrainedHeight
,
equals
(
unConstrainedHeight
));
await
tester
.
pumpWidget
(
getInputDecorator
(
VisualDensity
.
compact
));
final
double
constrainedHeightCompact
=
tester
.
getSize
(
find
.
byKey
(
keyConstrained
)).
height
;
final
double
unConstrainedHeightCompact
=
tester
.
getSize
(
find
.
byKey
(
keyUnconstrained
)).
height
;
expect
(
constrainedHeightCompact
,
equals
(
unConstrainedHeightCompact
));
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment