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
3577da53
Unverified
Commit
3577da53
authored
Jul 20, 2020
by
chunhtai
Committed by
GitHub
Jul 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "fix intrinsic height and width for widget span (#61485)" (#61876)
This reverts commit
fc09119d
.
parent
3f793102
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
97 deletions
+0
-97
paragraph.dart
packages/flutter/lib/src/rendering/paragraph.dart
+0
-6
paragraph_test.dart
packages/flutter/test/rendering/paragraph_test.dart
+0
-91
No files found.
packages/flutter/lib/src/rendering/paragraph.dart
View file @
3577da53
...
...
@@ -382,8 +382,6 @@ class RenderParagraph extends RenderBox
RenderBox
child
=
firstChild
;
final
List
<
PlaceholderDimensions
>
placeholderDimensions
=
List
<
PlaceholderDimensions
>(
childCount
);
int
childIndex
=
0
;
if
(
_applyTextScaleFactorToWidgetSpan
)
height
=
height
/
textScaleFactor
;
while
(
child
!=
null
)
{
// Height and baseline is irrelevant as all text will be laid
// out in a single line.
...
...
@@ -402,8 +400,6 @@ class RenderParagraph extends RenderBox
RenderBox
child
=
firstChild
;
final
List
<
PlaceholderDimensions
>
placeholderDimensions
=
List
<
PlaceholderDimensions
>(
childCount
);
int
childIndex
=
0
;
if
(
_applyTextScaleFactorToWidgetSpan
)
height
=
height
/
textScaleFactor
;
while
(
child
!=
null
)
{
final
double
intrinsicWidth
=
child
.
getMinIntrinsicWidth
(
height
);
final
double
intrinsicHeight
=
child
.
getMinIntrinsicHeight
(
intrinsicWidth
);
...
...
@@ -422,8 +418,6 @@ class RenderParagraph extends RenderBox
RenderBox
child
=
firstChild
;
final
List
<
PlaceholderDimensions
>
placeholderDimensions
=
List
<
PlaceholderDimensions
>(
childCount
);
int
childIndex
=
0
;
if
(
_applyTextScaleFactorToWidgetSpan
)
width
=
width
/
textScaleFactor
;
while
(
child
!=
null
)
{
final
double
intrinsicHeight
=
child
.
getMinIntrinsicHeight
(
width
);
final
double
intrinsicWidth
=
child
.
getMinIntrinsicWidth
(
intrinsicHeight
);
...
...
packages/flutter/test/rendering/paragraph_test.dart
View file @
3577da53
...
...
@@ -326,97 +326,6 @@ void main() {
expect
(
paragraph
.
locale
,
const
Locale
(
'ja'
,
'JP'
));
});
test
(
'can compute IntrinsicHeight for widget span'
,
()
{
// Regression test for https://github.com/flutter/flutter/issues/59316
const
double
screenWidth
=
100.0
;
const
String
sentence
=
'one two'
;
List
<
RenderBox
>
renderBoxes
=
<
RenderBox
>[
RenderParagraph
(
const
TextSpan
(
text:
sentence
),
textDirection:
TextDirection
.
ltr
),
];
RenderParagraph
paragraph
=
RenderParagraph
(
const
TextSpan
(
children:
<
InlineSpan
>
[
WidgetSpan
(
child:
Text
(
sentence
))
]
),
textScaleFactor:
1.0
,
children:
renderBoxes
,
textDirection:
TextDirection
.
ltr
,
applyTextScaleFactorToWidgetSpan:
true
,
);
layout
(
paragraph
,
constraints:
const
BoxConstraints
(
maxWidth:
screenWidth
));
final
double
singleLineHeight
=
paragraph
.
computeMaxIntrinsicHeight
(
screenWidth
);
expect
(
singleLineHeight
,
14.0
);
pumpFrame
();
renderBoxes
=
<
RenderBox
>[
RenderParagraph
(
const
TextSpan
(
text:
sentence
),
textDirection:
TextDirection
.
ltr
),
];
paragraph
=
RenderParagraph
(
const
TextSpan
(
children:
<
InlineSpan
>
[
WidgetSpan
(
child:
Text
(
sentence
))
]
),
textScaleFactor:
2.0
,
children:
renderBoxes
,
textDirection:
TextDirection
.
ltr
,
applyTextScaleFactorToWidgetSpan:
true
,
);
layout
(
paragraph
,
constraints:
const
BoxConstraints
(
maxWidth:
screenWidth
));
final
double
maxIntrinsicHeight
=
paragraph
.
computeMaxIntrinsicHeight
(
screenWidth
);
final
double
minIntrinsicHeight
=
paragraph
.
computeMinIntrinsicHeight
(
screenWidth
);
// intrinsicHeight = singleLineHeight * textScaleFactor * two lines.
expect
(
maxIntrinsicHeight
,
singleLineHeight
*
2.0
*
2
);
expect
(
maxIntrinsicHeight
,
minIntrinsicHeight
);
},
skip:
isBrowser
);
// https://github.com/flutter/flutter/issues/61020
test
(
'can compute IntrinsicWidth for widget span'
,
()
{
// Regression test for https://github.com/flutter/flutter/issues/59316
const
double
screenWidth
=
1000.0
;
const
double
fixedHeight
=
1000.0
;
const
String
sentence
=
'one two'
;
List
<
RenderBox
>
renderBoxes
=
<
RenderBox
>[
RenderParagraph
(
const
TextSpan
(
text:
sentence
),
textDirection:
TextDirection
.
ltr
),
];
RenderParagraph
paragraph
=
RenderParagraph
(
const
TextSpan
(
children:
<
InlineSpan
>
[
WidgetSpan
(
child:
Text
(
sentence
))
]
),
textScaleFactor:
1.0
,
children:
renderBoxes
,
textDirection:
TextDirection
.
ltr
,
applyTextScaleFactorToWidgetSpan:
true
,
);
layout
(
paragraph
,
constraints:
const
BoxConstraints
(
maxWidth:
screenWidth
));
final
double
widthForOneLine
=
paragraph
.
computeMaxIntrinsicWidth
(
fixedHeight
);
expect
(
widthForOneLine
,
98.0
);
pumpFrame
();
renderBoxes
=
<
RenderBox
>[
RenderParagraph
(
const
TextSpan
(
text:
sentence
),
textDirection:
TextDirection
.
ltr
),
];
paragraph
=
RenderParagraph
(
const
TextSpan
(
children:
<
InlineSpan
>
[
WidgetSpan
(
child:
Text
(
sentence
))
]
),
textScaleFactor:
2.0
,
children:
renderBoxes
,
textDirection:
TextDirection
.
ltr
,
applyTextScaleFactorToWidgetSpan:
true
,
);
layout
(
paragraph
,
constraints:
const
BoxConstraints
(
maxWidth:
screenWidth
));
final
double
maxIntrinsicWidth
=
paragraph
.
computeMaxIntrinsicWidth
(
fixedHeight
);
// maxIntrinsicWidth = widthForOneLine * textScaleFactor
expect
(
maxIntrinsicWidth
,
widthForOneLine
*
2.0
);
},
skip:
isBrowser
);
// https://github.com/flutter/flutter/issues/61020
test
(
'inline widgets test'
,
()
{
const
TextSpan
text
=
TextSpan
(
text:
'a'
,
...
...
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