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
74f3e6dd
Unverified
Commit
74f3e6dd
authored
Jul 14, 2020
by
Todd Volkert
Committed by
GitHub
Jul 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add assert to Table to check for rows with null children (#61457)
parent
06a35b33
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
table.dart
packages/flutter/lib/src/widgets/table.dart
+9
-0
table_test.dart
packages/flutter/test/widgets/table_test.dart
+24
-0
No files found.
packages/flutter/lib/src/widgets/table.dart
View file @
74f3e6dd
...
...
@@ -113,6 +113,15 @@ class Table extends RenderObjectWidget {
})
:
assert
(
children
!=
null
),
assert
(
defaultColumnWidth
!=
null
),
assert
(
defaultVerticalAlignment
!=
null
),
assert
(()
{
if
(
children
.
any
((
TableRow
row
)
=>
row
.
children
==
null
))
{
throw
FlutterError
(
'One of the rows of the table had null children.
\n
'
'The children property of TableRow must not be null.'
);
}
return
true
;
}()),
assert
(()
{
if
(
children
.
any
((
TableRow
row
)
=>
row
.
children
.
any
((
Widget
cell
)
=>
cell
==
null
)))
{
throw
FlutterError
(
...
...
packages/flutter/test/widgets/table_test.dart
View file @
74f3e6dd
...
...
@@ -956,5 +956,29 @@ void main() {
},
);
testWidgets
(
'Table widget requires all TableRows to have non-null children'
,
(
WidgetTester
tester
)
async
{
FlutterError
error
;
try
{
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Table
(
children:
const
<
TableRow
>[
TableRow
(
children:
<
Widget
>[
Text
(
'Some Text'
)]),
TableRow
(),
],
),
),
);
}
on
FlutterError
catch
(
e
)
{
error
=
e
;
}
finally
{
expect
(
error
,
isNotNull
);
expect
(
error
.
toStringDeep
(),
contains
(
'The children property of TableRow must not be null.'
));
}
});
// 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