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
629d3252
Unverified
Commit
629d3252
authored
Jan 19, 2018
by
Hans Muller
Committed by
GitHub
Jan 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: InputDecorator fails with null border, non-null labelText (#14166)
parent
2e4522f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
input_decorator.dart
packages/flutter/lib/src/material/input_decorator.dart
+2
-1
input_decorator_test.dart
packages/flutter/test/material/input_decorator_test.dart
+19
-0
No files found.
packages/flutter/lib/src/material/input_decorator.dart
View file @
629d3252
...
...
@@ -998,7 +998,8 @@ class _RenderDecoration extends RenderBox {
final
double
t
=
decoration
.
floatingLabelProgress
;
// The center of the outline border label ends up a little below the
// center of the top border line.
final
double
floatingY
=
decoration
.
border
.
isOutline
?
-
labelHeight
*
0.25
:
contentPadding
.
top
;
final
bool
isOutlineBorder
=
decoration
.
border
!=
null
&&
decoration
.
border
.
isOutline
;
final
double
floatingY
=
isOutlineBorder
?
-
labelHeight
*
0.25
:
contentPadding
.
top
;
final
double
scale
=
lerpDouble
(
1.0
,
0.75
,
t
);
final
double
dx
=
textDirection
==
TextDirection
.
rtl
?
labelOffset
.
dx
+
label
.
size
.
width
*
(
1.0
-
scale
)
// origin is on the right
...
...
packages/flutter/test/material/input_decorator_test.dart
View file @
629d3252
...
...
@@ -913,4 +913,23 @@ void main() {
"InputDecorator-[<'key'>](decoration: InputDecoration(border: UnderlineInputBorder()), baseStyle: TextStyle(<all styles inherited>), isFocused: false, isEmpty: false)"
,
);
});
testWidgets
(
'InputDecorator with null border and label'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/14165
await
tester
.
pumpWidget
(
buildInputDecorator
(
// isEmpty: false (default)
// isFocused: false (default)
decoration:
const
InputDecoration
(
labelText:
'label'
,
border:
null
,
),
),
);
expect
(
tester
.
getSize
(
find
.
byType
(
InputDecorator
)),
const
Size
(
800.0
,
56.0
));
expect
(
getBorderWeight
(
tester
),
0.0
);
expect
(
tester
.
getTopLeft
(
find
.
text
(
'label'
)).
dy
,
12.0
);
expect
(
tester
.
getBottomLeft
(
find
.
text
(
'label'
)).
dy
,
24.0
);
});
}
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