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
fbfaffe1
Unverified
Commit
fbfaffe1
authored
Apr 10, 2018
by
Jonah Williams
Committed by
GitHub
Apr 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not add run spacing if there are no run metrics (#16290)
* do not add run spacing if there are no run metrics
parent
38970f5f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
12 deletions
+43
-12
wrap.dart
packages/flutter/lib/src/rendering/wrap.dart
+3
-1
wrap_test.dart
packages/flutter/test/widgets/wrap_test.dart
+40
-11
No files found.
packages/flutter/lib/src/rendering/wrap.dart
View file @
fbfaffe1
...
...
@@ -629,7 +629,9 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin<RenderBox, Wr
}
if
(
childCount
>
0
)
{
mainAxisExtent
=
math
.
max
(
mainAxisExtent
,
runMainAxisExtent
);
crossAxisExtent
+=
runCrossAxisExtent
+
runSpacing
;
crossAxisExtent
+=
runCrossAxisExtent
;
if
(
runMetrics
.
isNotEmpty
)
crossAxisExtent
+=
runSpacing
;
runMetrics
.
add
(
new
_RunMetrics
(
runMainAxisExtent
,
runCrossAxisExtent
,
childCount
));
}
...
...
packages/flutter/test/widgets/wrap_test.dart
View file @
fbfaffe1
...
...
@@ -710,7 +710,7 @@ void main() {
),
),
);
expect
(
tester
.
renderObject
<
RenderBox
>(
find
.
byType
(
Wrap
)).
size
,
equals
(
const
Size
(
270.0
,
25
8
.0
)));
expect
(
tester
.
renderObject
<
RenderBox
>(
find
.
byType
(
Wrap
)).
size
,
equals
(
const
Size
(
270.0
,
25
0
.0
)));
verify
(
tester
,
<
Offset
>[
const
Offset
(
0.0
,
0.0
),
const
Offset
(
22.0
,
0.0
),
...
...
@@ -853,17 +853,46 @@ void main() {
});
testWidgets
(
'Object exactly matches container width'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
Wrap
(
direction:
Axis
.
horizontal
,
textDirection:
TextDirection
.
ltr
,
spacing:
10.0
,
runSpacing:
10.0
,
children:
const
<
Widget
>[
const
SizedBox
(
width:
800.0
,
height:
0.0
),
],
));
await
tester
.
pumpWidget
(
new
Column
(
children:
<
Widget
>[
new
Wrap
(
direction:
Axis
.
horizontal
,
textDirection:
TextDirection
.
ltr
,
spacing:
10.0
,
runSpacing:
10.0
,
children:
const
<
Widget
>[
const
SizedBox
(
width:
800.0
,
height:
10.0
),
],
),
],
)
);
expect
(
tester
.
renderObject
<
RenderBox
>(
find
.
byType
(
Wrap
)).
size
,
equals
(
const
Size
(
800.0
,
60
0.0
)));
expect
(
tester
.
renderObject
<
RenderBox
>(
find
.
byType
(
Wrap
)).
size
,
equals
(
const
Size
(
800.0
,
1
0.0
)));
verify
(
tester
,
<
Offset
>[
const
Offset
(
0.0
,
0.0
)]);
await
tester
.
pumpWidget
(
new
Column
(
children:
<
Widget
>[
new
Wrap
(
direction:
Axis
.
horizontal
,
textDirection:
TextDirection
.
ltr
,
spacing:
10.0
,
runSpacing:
10.0
,
children:
const
<
Widget
>[
const
SizedBox
(
width:
800.0
,
height:
10.0
),
const
SizedBox
(
width:
800.0
,
height:
10.0
),
],
),
],
)
);
expect
(
tester
.
renderObject
<
RenderBox
>(
find
.
byType
(
Wrap
)).
size
,
equals
(
const
Size
(
800.0
,
30.0
)));
verify
(
tester
,
<
Offset
>[
const
Offset
(
0.0
,
0.0
),
const
Offset
(
0.0
,
20.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