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
9bf1793a
Unverified
Commit
9bf1793a
authored
Jul 28, 2020
by
Kate Lovett
Committed by
GitHub
Jul 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix crossSize for baseline (#62074)
parent
80237ef8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
1 deletion
+55
-1
flex.dart
packages/flutter/lib/src/rendering/flex.dart
+1
-1
basic_test.dart
packages/flutter/test/widgets/basic_test.dart
+54
-0
No files found.
packages/flutter/lib/src/rendering/flex.dart
View file @
9bf1793a
...
...
@@ -854,7 +854,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
child
.
size
.
height
-
distance
,
maxSizeBelowBaseline
,
);
crossSize
=
ma
xSizeAboveBaseline
+
maxSizeBelowBaseline
;
crossSize
=
ma
th
.
max
(
maxSizeAboveBaseline
+
maxSizeBelowBaseline
,
crossSize
)
;
}
}
final
FlexParentData
childParentData
=
child
.
parentData
as
FlexParentData
;
...
...
packages/flutter/test/widgets/basic_test.dart
View file @
9bf1793a
...
...
@@ -270,6 +270,60 @@ void main() {
closeTo
(
aboveBaseline1
-
aboveBaseline2
,
.
001
),
);
});
testWidgets
(
'baseline aligned children account for a larger, no-baseline child size'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/58898
final
UniqueKey
key1
=
UniqueKey
();
final
UniqueKey
key2
=
UniqueKey
();
const
double
fontSize1
=
54
;
const
double
fontSize2
=
14
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Container
(
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
baseline
,
textBaseline:
TextBaseline
.
alphabetic
,
children:
<
Widget
>[
Text
(
'big text'
,
key:
key1
,
style:
const
TextStyle
(
fontSize:
fontSize1
),
),
Text
(
'one
\n
two
\n
three
\n
four
\n
five
\n
six
\n
seven'
,
key:
key2
,
style:
const
TextStyle
(
fontSize:
fontSize2
),
),
const
FlutterLogo
(
size:
250
),
],
),
),
),
),
);
final
RenderBox
textBox1
=
tester
.
renderObject
(
find
.
byKey
(
key1
));
final
RenderBox
textBox2
=
tester
.
renderObject
(
find
.
byKey
(
key2
));
final
RenderBox
rowBox
=
tester
.
renderObject
(
find
.
byType
(
Row
));
// The two Texts are baseline aligned, so some portion of them extends
// both above and below the baseline. The first has a huge font size, so
// it extends higher above the baseline than usual. The second has many
// lines, but being aligned by the first line's baseline, they hang far
// below the baseline. The FlutterLogo extends further than both Texts,
// so the size of the parent row should contain the FlutterLogo as well.
const
double
ahemBaselineLocation
=
0.8
;
// https://web-platform-tests.org/writing-tests/ahem.html
const
double
aboveBaseline1
=
fontSize1
*
ahemBaselineLocation
;
const
double
aboveBaseline2
=
fontSize2
*
ahemBaselineLocation
;
expect
(
rowBox
.
size
.
height
,
greaterThan
(
textBox1
.
size
.
height
));
expect
(
rowBox
.
size
.
height
,
greaterThan
(
textBox2
.
size
.
height
));
expect
(
rowBox
.
size
.
height
,
250
);
expect
(
tester
.
getTopLeft
(
find
.
byKey
(
key1
)).
dy
,
0
);
expect
(
tester
.
getTopLeft
(
find
.
byKey
(
key2
)).
dy
,
closeTo
(
aboveBaseline1
-
aboveBaseline2
,
.
001
),
);
});
});
test
(
'UnconstrainedBox toString'
,
()
{
...
...
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