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
66316433
Commit
66316433
authored
Mar 29, 2016
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2984 from Hixie/table
More table fixes
parents
992fc76e
bdfeaaa4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
3 deletions
+26
-3
table.dart
packages/flutter/lib/src/rendering/table.dart
+6
-3
table_test.dart
packages/flutter/test/rendering/table_test.dart
+20
-0
No files found.
packages/flutter/lib/src/rendering/table.dart
View file @
66316433
...
...
@@ -491,7 +491,7 @@ class RenderTable extends RenderBox {
assert
(
_rows
==
0
);
return
;
}
for
(
RenderBox
oldChild
in
cells
)
{
for
(
RenderBox
oldChild
in
_children
)
{
if
(
oldChild
!=
null
)
dropChild
(
oldChild
);
}
...
...
@@ -503,8 +503,8 @@ class RenderTable extends RenderBox {
assert
(
cells
!=
null
);
assert
(
cells
.
length
%
columns
==
0
);
// remove cells that are moving away
for
(
int
y
=
0
;
y
<
_
column
s
;
y
+=
1
)
{
for
(
int
x
=
0
;
x
<
_
row
s
;
x
+=
1
)
{
for
(
int
y
=
0
;
y
<
_
row
s
;
y
+=
1
)
{
for
(
int
x
=
0
;
x
<
_
column
s
;
x
+=
1
)
{
int
xyOld
=
x
+
y
*
_columns
;
int
xyNew
=
x
+
y
*
columns
;
if
(
_children
[
xyOld
]
!=
null
&&
(
x
>=
columns
||
xyNew
>=
cells
.
length
||
_children
[
xyOld
]
!=
cells
[
xyNew
]))
...
...
@@ -567,6 +567,8 @@ class RenderTable extends RenderBox {
assert
(
_children
.
length
==
rows
*
columns
);
final
int
xy
=
x
+
y
*
columns
;
RenderBox
oldChild
=
_children
[
xy
];
if
(
oldChild
==
value
)
return
;
if
(
oldChild
!=
null
)
dropChild
(
oldChild
);
_children
[
xy
]
=
value
;
...
...
@@ -759,6 +761,7 @@ class RenderTable extends RenderBox {
RenderBox
child
=
_children
[
xy
];
if
(
child
!=
null
)
{
TableCellParentData
childParentData
=
child
.
parentData
;
assert
(
childParentData
!=
null
);
childParentData
.
x
=
x
;
childParentData
.
y
=
y
;
switch
(
childParentData
.
verticalAlignment
??
defaultVerticalAlignment
)
{
...
...
packages/flutter/test/rendering/table_test.dart
View file @
66316433
...
...
@@ -71,4 +71,24 @@ void main() {
table
.
rows
=
4
;
expect
(
child
.
attached
,
isFalse
);
});
test
(
'Table test: replacing cells'
,
()
{
RenderTable
table
;
RenderBox
child1
=
new
RenderPositionedBox
();
RenderBox
child2
=
new
RenderPositionedBox
();
RenderBox
child3
=
new
RenderPositionedBox
();
table
=
new
RenderTable
();
table
.
setFlatChildren
(
3
,
<
RenderBox
>[
child1
,
new
RenderPositionedBox
(),
child2
,
new
RenderPositionedBox
(),
child3
,
new
RenderPositionedBox
()]);
expect
(
table
.
rows
,
equals
(
2
));
layout
(
table
);
table
.
setFlatChildren
(
3
,
<
RenderBox
>[
new
RenderPositionedBox
(),
child1
,
new
RenderPositionedBox
(),
child2
,
new
RenderPositionedBox
(),
child3
]);
layout
(
table
);
table
.
setFlatChildren
(
3
,
<
RenderBox
>[
new
RenderPositionedBox
(),
child1
,
new
RenderPositionedBox
(),
child2
,
new
RenderPositionedBox
(),
child3
]);
layout
(
table
);
expect
(
table
.
columns
,
equals
(
3
));
expect
(
table
.
rows
,
equals
(
2
));
});
}
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