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
a21a22a6
Unverified
Commit
a21a22a6
authored
Apr 22, 2021
by
Jason Simmons
Committed by
GitHub
Apr 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert AnimatedSize to a StatefulWidget (#80554)
parent
44c284ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
9 deletions
+54
-9
expanding_bottom_sheet.dart
...utter_gallery/lib/demo/shrine/expanding_bottom_sheet.dart
+0
-1
animated_size.dart
packages/flutter/lib/src/widgets/animated_size.dart
+54
-8
No files found.
dev/integration_tests/flutter_gallery/lib/demo/shrine/expanding_bottom_sheet.dart
View file @
a21a22a6
...
...
@@ -377,7 +377,6 @@ class _ExpandingBottomSheetState extends State<ExpandingBottomSheet> with Ticker
key:
_expandingBottomSheetKey
,
duration:
const
Duration
(
milliseconds:
225
),
curve:
Curves
.
easeInOut
,
vsync:
this
,
alignment:
FractionalOffset
.
topLeft
,
child:
WillPopScope
(
onWillPop:
_onWillPop
,
...
...
packages/flutter/lib/src/widgets/animated_size.dart
View file @
a21a22a6
...
...
@@ -7,6 +7,7 @@ import 'package:flutter/scheduler.dart';
import
'basic.dart'
;
import
'framework.dart'
;
import
'ticker_provider.dart'
;
/// Animated widget that automatically transitions its size over a given
/// duration whenever the given child's size changes.
...
...
@@ -35,7 +36,6 @@ import 'framework.dart';
/// color: Colors.amberAccent,
/// child: AnimatedSize(
/// curve: Curves.easeIn,
/// vsync: this,
/// duration: const Duration(seconds: 1),
/// child: FlutterLogo(size: _size),
/// ),
...
...
@@ -49,21 +49,27 @@ import 'framework.dart';
/// See also:
///
/// * [SizeTransition], which changes its size based on an [Animation].
class
AnimatedSize
extends
S
ingleChildRenderObject
Widget
{
class
AnimatedSize
extends
S
tateful
Widget
{
/// Creates a widget that animates its size to match that of its child.
///
/// The [curve] and [duration] arguments must not be null.
const
AnimatedSize
({
Key
?
key
,
Widget
?
child
,
this
.
child
,
this
.
alignment
=
Alignment
.
center
,
this
.
curve
=
Curves
.
linear
,
required
this
.
duration
,
this
.
reverseDuration
,
required
this
.
vsync
,
// TODO(jsimmons): deprecate when customers tests are updated.
TickerProvider
?
vsync
,
// ignore: avoid_unused_constructor_parameters
this
.
clipBehavior
=
Clip
.
hardEdge
,
})
:
assert
(
clipBehavior
!=
null
),
super
(
key:
key
,
child:
child
);
super
(
key:
key
);
/// The widget below this widget in the tree.
///
/// {@macro flutter.widgets.ProxyWidget.child}
final
Widget
?
child
;
/// The alignment of the child within the parent when the parent is not yet
/// the same size as the child.
...
...
@@ -100,14 +106,54 @@ class AnimatedSize extends SingleChildRenderObjectWidget {
/// If not specified, defaults to [duration].
final
Duration
?
reverseDuration
;
/// The [TickerProvider] for this widget.
final
TickerProvider
vsync
;
/// {@macro flutter.material.Material.clipBehavior}
///
/// Defaults to [Clip.hardEdge], and must not be null.
final
Clip
clipBehavior
;
@override
_AnimatedSizeState
createState
()
=>
_AnimatedSizeState
();
}
class
_AnimatedSizeState
extends
State
<
AnimatedSize
>
with
SingleTickerProviderStateMixin
{
@override
Widget
build
(
BuildContext
context
)
{
return
_AnimatedSize
(
child:
widget
.
child
,
alignment:
widget
.
alignment
,
curve:
widget
.
curve
,
duration:
widget
.
duration
,
reverseDuration:
widget
.
reverseDuration
,
vsync:
this
,
clipBehavior:
widget
.
clipBehavior
,
);
}
}
class
_AnimatedSize
extends
SingleChildRenderObjectWidget
{
const
_AnimatedSize
({
Key
?
key
,
Widget
?
child
,
this
.
alignment
=
Alignment
.
center
,
this
.
curve
=
Curves
.
linear
,
required
this
.
duration
,
this
.
reverseDuration
,
required
this
.
vsync
,
this
.
clipBehavior
=
Clip
.
hardEdge
,
})
:
assert
(
clipBehavior
!=
null
),
super
(
key:
key
,
child:
child
);
final
AlignmentGeometry
alignment
;
final
Curve
curve
;
final
Duration
duration
;
final
Duration
?
reverseDuration
;
/// The [TickerProvider] for this widget.
final
TickerProvider
vsync
;
final
Clip
clipBehavior
;
@override
RenderAnimatedSize
createRenderObject
(
BuildContext
context
)
{
return
RenderAnimatedSize
(
...
...
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