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
...
@@ -377,7 +377,6 @@ class _ExpandingBottomSheetState extends State<ExpandingBottomSheet> with Ticker
key:
_expandingBottomSheetKey
,
key:
_expandingBottomSheetKey
,
duration:
const
Duration
(
milliseconds:
225
),
duration:
const
Duration
(
milliseconds:
225
),
curve:
Curves
.
easeInOut
,
curve:
Curves
.
easeInOut
,
vsync:
this
,
alignment:
FractionalOffset
.
topLeft
,
alignment:
FractionalOffset
.
topLeft
,
child:
WillPopScope
(
child:
WillPopScope
(
onWillPop:
_onWillPop
,
onWillPop:
_onWillPop
,
...
...
packages/flutter/lib/src/widgets/animated_size.dart
View file @
a21a22a6
...
@@ -7,6 +7,7 @@ import 'package:flutter/scheduler.dart';
...
@@ -7,6 +7,7 @@ import 'package:flutter/scheduler.dart';
import
'basic.dart'
;
import
'basic.dart'
;
import
'framework.dart'
;
import
'framework.dart'
;
import
'ticker_provider.dart'
;
/// Animated widget that automatically transitions its size over a given
/// Animated widget that automatically transitions its size over a given
/// duration whenever the given child's size changes.
/// duration whenever the given child's size changes.
...
@@ -35,7 +36,6 @@ import 'framework.dart';
...
@@ -35,7 +36,6 @@ import 'framework.dart';
/// color: Colors.amberAccent,
/// color: Colors.amberAccent,
/// child: AnimatedSize(
/// child: AnimatedSize(
/// curve: Curves.easeIn,
/// curve: Curves.easeIn,
/// vsync: this,
/// duration: const Duration(seconds: 1),
/// duration: const Duration(seconds: 1),
/// child: FlutterLogo(size: _size),
/// child: FlutterLogo(size: _size),
/// ),
/// ),
...
@@ -49,21 +49,27 @@ import 'framework.dart';
...
@@ -49,21 +49,27 @@ import 'framework.dart';
/// See also:
/// See also:
///
///
/// * [SizeTransition], which changes its size based on an [Animation].
/// * [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.
/// Creates a widget that animates its size to match that of its child.
///
///
/// The [curve] and [duration] arguments must not be null.
/// The [curve] and [duration] arguments must not be null.
const
AnimatedSize
({
const
AnimatedSize
({
Key
?
key
,
Key
?
key
,
Widget
?
child
,
this
.
child
,
this
.
alignment
=
Alignment
.
center
,
this
.
alignment
=
Alignment
.
center
,
this
.
curve
=
Curves
.
linear
,
this
.
curve
=
Curves
.
linear
,
required
this
.
duration
,
required
this
.
duration
,
this
.
reverseDuration
,
this
.
reverseDuration
,
required
this
.
vsync
,
// TODO(jsimmons): deprecate when customers tests are updated.
TickerProvider
?
vsync
,
// ignore: avoid_unused_constructor_parameters
this
.
clipBehavior
=
Clip
.
hardEdge
,
this
.
clipBehavior
=
Clip
.
hardEdge
,
})
:
assert
(
clipBehavior
!=
null
),
})
:
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 alignment of the child within the parent when the parent is not yet
/// the same size as the child.
/// the same size as the child.
...
@@ -100,14 +106,54 @@ class AnimatedSize extends SingleChildRenderObjectWidget {
...
@@ -100,14 +106,54 @@ class AnimatedSize extends SingleChildRenderObjectWidget {
/// If not specified, defaults to [duration].
/// If not specified, defaults to [duration].
final
Duration
?
reverseDuration
;
final
Duration
?
reverseDuration
;
/// The [TickerProvider] for this widget.
final
TickerProvider
vsync
;
/// {@macro flutter.material.Material.clipBehavior}
/// {@macro flutter.material.Material.clipBehavior}
///
///
/// Defaults to [Clip.hardEdge], and must not be null.
/// Defaults to [Clip.hardEdge], and must not be null.
final
Clip
clipBehavior
;
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
@override
RenderAnimatedSize
createRenderObject
(
BuildContext
context
)
{
RenderAnimatedSize
createRenderObject
(
BuildContext
context
)
{
return
RenderAnimatedSize
(
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