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
12bab134
Unverified
Commit
12bab134
authored
May 21, 2018
by
Hans Muller
Committed by
GitHub
May 21, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle the case where InputDecorator is constrained to 0x0 (#17777)
parent
eba194f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
input_decorator.dart
packages/flutter/lib/src/material/input_decorator.dart
+4
-3
input_decorator_test.dart
packages/flutter/test/material/input_decorator_test.dart
+20
-0
No files found.
packages/flutter/lib/src/material/input_decorator.dart
View file @
12bab134
...
...
@@ -764,14 +764,14 @@ class _RenderDecoration extends RenderBox {
if
(
suffixIcon
!=
null
)
suffixIcon
.
layout
(
boxConstraints
,
parentUsesSize:
true
);
final
double
inputWidth
=
constraints
.
maxWidth
-
(
final
double
inputWidth
=
math
.
max
(
0.0
,
constraints
.
maxWidth
-
(
_boxSize
(
icon
).
width
+
contentPadding
.
left
+
_boxSize
(
prefixIcon
).
width
+
_boxSize
(
prefix
).
width
+
_boxSize
(
suffix
).
width
+
_boxSize
(
suffixIcon
).
width
+
contentPadding
.
right
);
+
contentPadding
.
right
)
)
;
boxConstraints
=
boxConstraints
.
copyWith
(
maxWidth:
inputWidth
);
if
(
label
!=
null
)
// The label is not baseline aligned.
...
...
@@ -811,10 +811,11 @@ class _RenderDecoration extends RenderBox {
// The helper or error text can occupy the full width less the space
// occupied by the icon and counter.
boxConstraints
=
boxConstraints
.
copyWith
(
maxWidth:
boxConstraints
.
maxWidth
maxWidth:
math
.
max
(
0.0
,
boxConstraints
.
maxWidth
-
_boxSize
(
icon
).
width
-
_boxSize
(
counter
).
width
-
contentPadding
.
horizontal
,
),
);
layoutLineBox
(
helperError
);
...
...
packages/flutter/test/material/input_decorator_test.dart
View file @
12bab134
...
...
@@ -1408,4 +1408,24 @@ void main() {
],
));
});
testWidgets
(
'InputDecorator constrained to 0x0'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/17710
await
tester
.
pumpWidget
(
new
Material
(
child:
new
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
new
UnconstrainedBox
(
child:
new
ConstrainedBox
(
constraints:
new
BoxConstraints
.
tight
(
Size
.
zero
),
child:
const
InputDecorator
(
decoration:
const
InputDecoration
(
labelText:
'XP'
,
border:
const
OutlineInputBorder
(),
),
),
)),
),
),
);
});
}
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