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
dc331d39
Unverified
Commit
dc331d39
authored
Mar 22, 2022
by
LongCatIsLooong
Committed by
GitHub
Mar 22, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[RenderAnimatedSize] Resume interrupted resizing animation on attach (#100519)
parent
74f08c73
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
106 additions
and
0 deletions
+106
-0
animated_size.dart
packages/flutter/lib/src/rendering/animated_size.dart
+16
-0
single_child_scroll_view.dart
...ges/flutter/lib/src/widgets/single_child_scroll_view.dart
+6
-0
animated_size_test.dart
packages/flutter/test/widgets/animated_size_test.dart
+84
-0
No files found.
packages/flutter/lib/src/rendering/animated_size.dart
View file @
dc331d39
...
...
@@ -174,6 +174,22 @@ class RenderAnimatedSize extends RenderAligningShiftedBox {
_controller
.
resync
(
vsync
);
}
@override
void
attach
(
PipelineOwner
owner
)
{
super
.
attach
(
owner
);
switch
(
state
)
{
case
RenderAnimatedSizeState
.
start
:
case
RenderAnimatedSizeState
.
stable
:
break
;
case
RenderAnimatedSizeState
.
changed
:
case
RenderAnimatedSizeState
.
unstable
:
// Call markNeedsLayout in case the RenderObject isn't marked dirty
// already, to resume interrupted resizing animation.
markNeedsLayout
();
break
;
}
}
@override
void
detach
()
{
_controller
.
stop
();
...
...
packages/flutter/lib/src/widgets/single_child_scroll_view.dart
View file @
dc331d39
...
...
@@ -678,6 +678,12 @@ class _RenderSingleChildViewport extends RenderBox with RenderObjectWithChildMix
);
}
@override
void
debugFillProperties
(
DiagnosticPropertiesBuilder
properties
)
{
super
.
debugFillProperties
(
properties
);
properties
.
add
(
DiagnosticsProperty
<
Offset
>(
'offset'
,
_paintOffset
));
}
@override
Rect
describeSemanticsClip
(
RenderObject
child
)
{
assert
(
axis
!=
null
);
...
...
packages/flutter/test/widgets/animated_size_test.dart
View file @
dc331d39
...
...
@@ -349,5 +349,89 @@ void main() {
await
pumpWidget
(
const
Size
(
222
,
222
),
const
Duration
(
milliseconds:
10
));
expect
(
tester
.
renderObject
<
RenderBox
>(
find
.
byType
(
IntrinsicHeight
)).
size
,
const
Size
(
222
,
222
));
});
testWidgets
(
're-attach with interrupted animation'
,
(
WidgetTester
tester
)
async
{
const
Key
key1
=
ValueKey
<
String
>(
'key1'
);
const
Key
key2
=
ValueKey
<
String
>(
'key2'
);
late
StateSetter
setState
;
Size
childSize
=
const
Size
.
square
(
100
);
final
Widget
animatedSize
=
Center
(
key:
GlobalKey
(
debugLabel:
'animated size'
),
// This SizedBox creates a relayout boundary so _cleanRelayoutBoundary
// does not mark the descendant render objects below the relayout boundary
// dirty.
child:
SizedBox
.
fromSize
(
size:
const
Size
.
square
(
200
),
child:
Center
(
child:
AnimatedSize
(
duration:
const
Duration
(
seconds:
1
),
child:
StatefulBuilder
(
builder:
(
BuildContext
context
,
StateSetter
stateSetter
)
{
setState
=
stateSetter
;
return
SizedBox
.
fromSize
(
size:
childSize
);
},
),
),
),
),
);
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Row
(
children:
<
Widget
>[
SizedBox
(
key:
key1
,
height:
200
,
child:
animatedSize
,
),
const
SizedBox
(
key:
key2
,
height:
200
,
)
],
),
)
);
setState
(()
{
childSize
=
const
Size
.
square
(
150
);
});
// Kick off the resizing animation.
await
tester
.
pump
();
// Immediately reparent the AnimatedSize subtree to a different parent
// with the same incoming constraints.
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Row
(
children:
<
Widget
>[
const
SizedBox
(
key:
key1
,
height:
200
,
),
SizedBox
(
key:
key2
,
height:
200
,
child:
animatedSize
,
)
],
),
)
);
expect
(
tester
.
renderObject
<
RenderBox
>(
find
.
byType
(
AnimatedSize
)).
size
,
const
Size
.
square
(
100
),
);
await
tester
.
pumpAndSettle
();
// The animatedSize widget animates to the right size.
expect
(
tester
.
renderObject
<
RenderBox
>(
find
.
byType
(
AnimatedSize
)).
size
,
const
Size
.
square
(
150
),
);
});
});
}
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