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
d27a9427
Unverified
Commit
d27a9427
authored
May 18, 2021
by
Michael Goderbauer
Committed by
GitHub
May 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not crash if table children are replaced before they are layed out (#82765)
parent
e716ac19
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
2 deletions
+34
-2
table.dart
packages/flutter/lib/src/widgets/table.dart
+1
-2
table_test.dart
packages/flutter/test/widgets/table_test.dart
+33
-0
No files found.
packages/flutter/lib/src/widgets/table.dart
View file @
d27a9427
...
...
@@ -392,8 +392,7 @@ class _TableElement extends RenderObjectElement {
@override
void
removeRenderObjectChild
(
RenderBox
child
,
_TableSlot
slot
)
{
final
TableCellParentData
childParentData
=
child
.
parentData
!
as
TableCellParentData
;
renderObject
.
setChild
(
childParentData
.
x
!,
childParentData
.
y
!,
null
);
renderObject
.
setChild
(
slot
.
column
,
slot
.
row
,
null
);
}
final
Set
<
Element
>
_forgottenChildren
=
HashSet
<
Element
>();
...
...
packages/flutter/test/widgets/table_test.dart
View file @
d27a9427
...
...
@@ -1000,5 +1000,38 @@ void main() {
expect
(
table
.
column
(
2
).
last
.
runtimeType
,
isNot
(
toBeReplaced
));
});
testWidgets
(
'Do not crash if a child that has not been layed out in a previous build is removed'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/60488.
Widget
buildTable
(
Key
key
)
{
return
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Table
(
children:
<
TableRow
>[
TableRow
(
children:
<
Widget
>[
KeyedSubtree
(
key:
key
,
child:
const
Text
(
'Hello'
),
),
],
),
],
),
);
}
await
tester
.
pumpWidget
(
buildTable
(
const
ValueKey
<
int
>(
1
)),
null
,
EnginePhase
.
build
,
// Children are not layed out!
);
await
tester
.
pumpWidget
(
buildTable
(
const
ValueKey
<
int
>(
2
)),
);
expect
(
tester
.
takeException
(),
isNull
);
expect
(
find
.
text
(
'Hello'
),
findsOneWidget
);
});
// TODO(ianh): Test handling of TableCell object
}
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