Switch SlideTransition over to using Offset (#12369)
Previously, we used `Alignment`, which was difficult to understand. Now, we just use an `Offset` scaled to the child's size, which is much easier to understand.
This commit is contained in:
@@ -47,9 +47,9 @@ class NavigationIconView {
|
||||
return new FadeTransition(
|
||||
opacity: _animation,
|
||||
child: new SlideTransition(
|
||||
position: new AlignmentTween(
|
||||
begin: const Alignment(0.0, 0.4), // Slightly down.
|
||||
end: Alignment.center,
|
||||
position: new Tween<Offset>(
|
||||
begin: const Offset(0.0, 0.02), // Slightly down.
|
||||
end: Offset.zero,
|
||||
).animate(_animation),
|
||||
child: new IconTheme(
|
||||
data: new IconThemeData(
|
||||
|
||||
@@ -25,7 +25,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
|
||||
|
||||
AnimationController _controller;
|
||||
Animation<double> _drawerContentsOpacity;
|
||||
Animation<Alignment> _drawerDetailsPosition;
|
||||
Animation<Offset> _drawerDetailsPosition;
|
||||
bool _showDrawerContents = true;
|
||||
|
||||
@override
|
||||
@@ -39,9 +39,9 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
|
||||
parent: new ReverseAnimation(_controller),
|
||||
curve: Curves.fastOutSlowIn,
|
||||
);
|
||||
_drawerDetailsPosition = new AlignmentTween(
|
||||
begin: const Alignment(0.0, -2.0),
|
||||
end: Alignment.center,
|
||||
_drawerDetailsPosition = new Tween<Offset>(
|
||||
begin: const Offset(0.0, -1.0),
|
||||
end: Offset.zero,
|
||||
).animate(new CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: Curves.fastOutSlowIn,
|
||||
|
||||
Reference in New Issue
Block a user