@@ -6,6 +6,7 @@ import 'package:sky/animation/animation_performance.dart';
6
6
import 'package:sky/painting/text_style.dart' ;
7
7
import 'package:sky/theme/typography.dart' as typography;
8
8
import 'package:sky/widgets/animated_component.dart' ;
9
+ import 'package:sky/widgets/animated_container.dart' ;
9
10
import 'package:sky/widgets/basic.dart' ;
10
11
import 'package:sky/widgets/default_text_style.dart' ;
11
12
import 'package:sky/widgets/material.dart' ;
@@ -35,7 +36,7 @@ class SnackBarAction extends Component {
35
36
}
36
37
}
37
38
38
- class SnackBar extends AnimatedComponent {
39
+ class SnackBar extends Component {
39
40
40
41
SnackBar ({
41
42
String key,
@@ -52,41 +53,8 @@ class SnackBar extends AnimatedComponent {
52
53
bool showing;
53
54
Function onHidden;
54
55
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 );
90
58
91
59
Widget build () {
92
60
List <Widget > children = [
@@ -102,10 +70,13 @@ class SnackBar extends AnimatedComponent {
102
70
]..addAll (actions);
103
71
104
72
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 (
109
80
level: 2 ,
110
81
color: const Color (0xFF323232 ),
111
82
type: MaterialType .canvas,
0 commit comments