@@ -6,6 +6,7 @@ import 'package:sky/animation/animation_performance.dart';
66import 'package:sky/painting/text_style.dart' ;
77import 'package:sky/theme/typography.dart' as typography;
88import 'package:sky/widgets/animated_component.dart' ;
9+ import 'package:sky/widgets/animated_container.dart' ;
910import 'package:sky/widgets/basic.dart' ;
1011import 'package:sky/widgets/default_text_style.dart' ;
1112import 'package:sky/widgets/material.dart' ;
@@ -35,7 +36,7 @@ class SnackBarAction extends Component {
3536 }
3637}
3738
38- class SnackBar extends AnimatedComponent {
39+ class SnackBar extends Component {
3940
4041 SnackBar ({
4142 String key,
@@ -52,41 +53,8 @@ class SnackBar extends AnimatedComponent {
5253 bool showing;
5354 Function onHidden;
5455
55- void syncFields (SnackBar source) {
56- content = source.content;
57- actions = source.actions;
58- onHidden = source.onHidden;
59- if (showing != source.showing) {
60- showing = source.showing;
61- showing ? _show () : _hide ();
62- }
63- }
64-
65- AnimatedType <Point > _position;
66- AnimationPerformance _performance;
67-
68- void initState () {
69- _position = new AnimatedType <Point >(new Point (0.0 , 50.0 ), end: Point .origin);
70- _performance = new AnimationPerformance ()
71- ..duration = _kSlideInDuration
72- ..variable = _position
73- ..addListener (_checkCompleted);
74- watch (_performance);
75- if (showing)
76- _show ();
77- }
78-
79- void _show () {
80- _performance.play ();
81- }
82- void _hide () {
83- _performance.reverse ();
84- }
85- void _checkCompleted () {
86- if (! _performance.isAnimating && _performance.isDismissed && onHidden != null ) {
87- onHidden ();
88- }
89- }
56+ Point get _position =>
57+ showing ? Point .origin : new Point (0.0 , 50.0 );
9058
9159 Widget build () {
9260 List <Widget > children = [
@@ -102,10 +70,13 @@ class SnackBar extends AnimatedComponent {
10270 ]..addAll (actions);
10371
10472 Matrix4 transform = new Matrix4 .identity ();
105- transform.translate (_position.value.x, _position.value.y);
106- return new Transform (
107- transform: transform,
108- child: new Material (
73+ transform.translate (_position.x, _position.y);
74+ print ("transform: $_position " );
75+ return new AnimatedContainer (
76+ director: director,
77+ transform: transform,
78+ duration: _kSlideInDuration,
79+ child: new Material (
10980 level: 2 ,
11081 color: const Color (0xFF323232 ),
11182 type: MaterialType .canvas,
0 commit comments