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
ad507723
Unverified
Commit
ad507723
authored
Jun 12, 2019
by
chunhtai
Committed by
GitHub
Jun 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix Applying decoration for a table row widget will cause render exception (#34285)
parent
c40c687b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
1 deletion
+40
-1
table.dart
packages/flutter/lib/src/rendering/table.dart
+4
-1
table_test.dart
packages/flutter/test/widgets/table_test.dart
+36
-0
No files found.
packages/flutter/lib/src/rendering/table.dart
View file @
ad507723
...
...
@@ -518,6 +518,8 @@ class RenderTable extends RenderBox {
/// the table, unlike decorations for individual cells, which might not fill
/// either.
List
<
Decoration
>
get
rowDecorations
=>
List
<
Decoration
>.
unmodifiable
(
_rowDecorations
??
const
<
Decoration
>[]);
// _rowDecorations and _rowDecorationPainters need to be in sync. They have to
// either both be null or have same length.
List
<
Decoration
>
_rowDecorations
;
List
<
BoxPainter
>
_rowDecorationPainters
;
set
rowDecorations
(
List
<
Decoration
>
value
)
{
...
...
@@ -703,7 +705,7 @@ class RenderTable extends RenderBox {
if
(
_rowDecorationPainters
!=
null
)
{
for
(
BoxPainter
painter
in
_rowDecorationPainters
)
painter
?.
dispose
();
_rowDecorationPainters
=
null
;
_rowDecorationPainters
=
List
<
BoxPainter
>(
_rowDecorations
.
length
)
;
}
for
(
RenderBox
child
in
_children
)
child
?.
detach
();
...
...
@@ -1137,6 +1139,7 @@ class RenderTable extends RenderBox {
}
assert
(
_rowTops
.
length
==
rows
+
1
);
if
(
_rowDecorations
!=
null
)
{
assert
(
_rowDecorations
.
length
==
_rowDecorationPainters
.
length
);
final
Canvas
canvas
=
context
.
canvas
;
for
(
int
y
=
0
;
y
<
rows
;
y
+=
1
)
{
if
(
_rowDecorations
.
length
<=
y
)
...
...
packages/flutter/test/widgets/table_test.dart
View file @
ad507723
...
...
@@ -5,6 +5,7 @@
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/material.dart'
;
class
TestStatefulWidget
extends
StatefulWidget
{
const
TestStatefulWidget
({
Key
key
})
:
super
(
key:
key
);
...
...
@@ -67,6 +68,41 @@ void main() {
await
run
(
TextDirection
.
rtl
);
});
testWidgets
(
'Table widget can be detached and re-attached'
,
(
WidgetTester
tester
)
async
{
final
Widget
table
=
Table
(
key:
GlobalKey
(),
children:
const
<
TableRow
>[
TableRow
(
decoration:
BoxDecoration
(
color:
Colors
.
yellow
),
children:
<
Widget
>[
Placeholder
()],
),
],
);
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Center
(
child:
table
,
),
),
);
// Move table to a different location to simulate detaching and re-attaching effect.
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Center
(
child:
Center
(
child:
table
),
),
),
);
expect
(
tester
.
takeException
(),
isNull
);
});
testWidgets
(
'Table widget - column offset (LTR)'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
Directionality
(
...
...
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