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
4ef20148
Commit
4ef20148
authored
Feb 25, 2016
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2143 from Hixie/move-markNeedsLayout
Fix move() to call markNeedsLayout().
parents
62609669
512b2e19
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
0 deletions
+68
-0
object.dart
packages/flutter/lib/src/rendering/object.dart
+1
-0
mutations_test.dart
packages/flutter/test/rendering/mutations_test.dart
+67
-0
No files found.
packages/flutter/lib/src/rendering/object.dart
View file @
4ef20148
...
@@ -1968,6 +1968,7 @@ abstract class ContainerRenderObjectMixin<ChildType extends RenderObject, Parent
...
@@ -1968,6 +1968,7 @@ abstract class ContainerRenderObjectMixin<ChildType extends RenderObject, Parent
return
;
return
;
_removeFromChildList
(
child
);
_removeFromChildList
(
child
);
_insertIntoChildList
(
child
,
after:
after
);
_insertIntoChildList
(
child
,
after:
after
);
markNeedsLayout
();
}
}
void
attach
()
{
void
attach
()
{
...
...
packages/flutter/test/rendering/mutations_test.dart
0 → 100644
View file @
4ef20148
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:test/test.dart'
;
import
'rendering_tester.dart'
;
class
RenderLayoutTestBox
extends
RenderProxyBox
{
RenderLayoutTestBox
(
this
.
onLayout
);
final
VoidCallback
onLayout
;
void
layout
(
Constraints
constraints
,
{
bool
parentUsesSize:
false
})
{
// Doing this in tests is ok, but if you're writing your own
// render object, you want to override performLayout(), not
// layout(). Overriding layout() would remove many critical
// performance optimizations of the rendering system, as well as
// many bypassing many checked-mode integrity checks.
super
.
layout
(
constraints
,
parentUsesSize:
parentUsesSize
);
onLayout
();
}
bool
get
sizedByParent
=>
true
;
void
performLayout
()
{
}
}
void
main
(
)
{
test
(
'moving children'
,
()
{
RenderBox
child1
,
child2
;
bool
movedChild1
=
false
;
bool
movedChild2
=
false
;
RenderFlex
block
=
new
RenderFlex
();
block
.
add
(
child1
=
new
RenderLayoutTestBox
(()
{
movedChild1
=
true
;
}));
block
.
add
(
child2
=
new
RenderLayoutTestBox
(()
{
movedChild2
=
true
;
}));
expect
(
movedChild1
,
isFalse
);
expect
(
movedChild2
,
isFalse
);
layout
(
block
);
expect
(
movedChild1
,
isTrue
);
expect
(
movedChild2
,
isTrue
);
movedChild1
=
false
;
movedChild2
=
false
;
expect
(
movedChild1
,
isFalse
);
expect
(
movedChild2
,
isFalse
);
pumpFrame
();
expect
(
movedChild1
,
isFalse
);
expect
(
movedChild2
,
isFalse
);
block
.
move
(
child1
,
after:
child2
);
expect
(
movedChild1
,
isFalse
);
expect
(
movedChild2
,
isFalse
);
pumpFrame
();
expect
(
movedChild1
,
isTrue
);
expect
(
movedChild2
,
isTrue
);
movedChild1
=
false
;
movedChild2
=
false
;
expect
(
movedChild1
,
isFalse
);
expect
(
movedChild2
,
isFalse
);
pumpFrame
();
expect
(
movedChild1
,
isFalse
);
expect
(
movedChild2
,
isFalse
);
});
}
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