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
5ea987db
Unverified
Commit
5ea987db
authored
Sep 12, 2018
by
Jonah Williams
Committed by
GitHub
Sep 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust floating label height when font size is larrrrgeee (#21248)
parent
e9e2ca16
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
input_decorator.dart
packages/flutter/lib/src/material/input_decorator.dart
+1
-1
text_field_test.dart
packages/flutter/test/material/text_field_test.dart
+27
-0
No files found.
packages/flutter/lib/src/material/input_decorator.dart
View file @
5ea987db
...
@@ -1835,7 +1835,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
...
@@ -1835,7 +1835,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
contentPadding
=
decorationContentPadding
??
EdgeInsets
.
zero
;
contentPadding
=
decorationContentPadding
??
EdgeInsets
.
zero
;
}
else
if
(!
border
.
isOutline
)
{
}
else
if
(!
border
.
isOutline
)
{
// 4.0: the vertical gap between the inline elements and the floating label.
// 4.0: the vertical gap between the inline elements and the floating label.
floatingLabelHeight
=
4.0
+
0.75
*
inlineLabelStyle
.
fontSize
;
floatingLabelHeight
=
(
4.0
+
0.75
*
inlineLabelStyle
.
fontSize
)
*
MediaQuery
.
textScaleFactorOf
(
context
)
;
if
(
decoration
.
filled
==
true
)
{
// filled == null same as filled == false
if
(
decoration
.
filled
==
true
)
{
// filled == null same as filled == false
contentPadding
=
decorationContentPadding
??
(
decorationIsDense
contentPadding
=
decorationContentPadding
??
(
decorationIsDense
?
const
EdgeInsets
.
fromLTRB
(
12.0
,
8.0
,
12.0
,
8.0
)
?
const
EdgeInsets
.
fromLTRB
(
12.0
,
8.0
,
12.0
,
8.0
)
...
...
packages/flutter/test/material/text_field_test.dart
View file @
5ea987db
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
import
'dart:async'
;
import
'dart:async'
;
import
'dart:io'
show
Platform
;
import
'dart:io'
show
Platform
;
import
'dart:ui'
as
ui
show
window
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
@@ -2942,4 +2943,30 @@ void main() {
...
@@ -2942,4 +2943,30 @@ void main() {
semantics
.
dispose
();
semantics
.
dispose
();
});
});
testWidgets
(
'floating label does not overlap with value at large textScaleFactors'
,
(
WidgetTester
tester
)
async
{
final
TextEditingController
controller
=
TextEditingController
(
text:
'Just some text'
);
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
DefaultTextStyle
(
style:
const
TextStyle
(
fontSize:
12.0
,
fontFamily:
'Ahem'
),
child:
MediaQuery
(
data:
MediaQueryData
.
fromWindow
(
ui
.
window
).
copyWith
(
textScaleFactor:
4.0
),
child:
Center
(
child:
TextField
(
decoration:
const
InputDecoration
(
labelText:
'Label'
,
border:
UnderlineInputBorder
()),
controller:
controller
,
),
),
),
),
),
),
);
await
tester
.
tap
(
find
.
byType
(
TextField
));
final
Rect
labelRect
=
tester
.
getRect
(
find
.
text
(
'Label'
));
final
Rect
fieldRect
=
tester
.
getRect
(
find
.
text
(
'Just some text'
));
expect
(
labelRect
.
bottom
,
lessThanOrEqualTo
(
fieldRect
.
top
));
});
}
}
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