mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Make SnackBar animate itself.
This commit is contained in:
parent
396f7da77f
commit
ebbaec976b
@ -51,8 +51,8 @@ class StockHome extends StatefulComponent {
|
||||
bool _isSearching = false;
|
||||
String _searchQuery;
|
||||
|
||||
SnackBarStatus _snackBarStatus;
|
||||
bool _isSnackBarShowing = false; // Should it be showing?
|
||||
SnackBarStatus _snackBarStatus = SnackBarStatus.inactive;
|
||||
bool _isSnackBarShowing = false;
|
||||
|
||||
void _handleSearchBegin() {
|
||||
navigator.pushState(this, (_) {
|
||||
|
||||
@ -46,16 +46,6 @@ enum DrawerStatus {
|
||||
|
||||
typedef void DrawerStatusChangedCallback(DrawerStatus status);
|
||||
|
||||
// TODO(mpcomplete): find a better place for this.
|
||||
class AnimatedColor extends AnimatedType<Color> {
|
||||
AnimatedColor(Color begin, { Color end, Curve curve: linear })
|
||||
: super(begin, end: end, curve: curve);
|
||||
|
||||
void setFraction(double t) {
|
||||
value = lerpColor(begin, end, t);
|
||||
}
|
||||
}
|
||||
|
||||
class Drawer extends AnimatedComponent {
|
||||
Drawer({
|
||||
String key,
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:sky/animation/animated_value.dart';
|
||||
import 'package:sky/animation/animation_performance.dart';
|
||||
import 'package:sky/painting/text_style.dart';
|
||||
import 'package:sky/theme/typography.dart' as typography;
|
||||
@ -69,11 +70,11 @@ class SnackBar extends AnimatedComponent {
|
||||
}
|
||||
}
|
||||
|
||||
AnimatedType<Point> _position;
|
||||
AnimatedValue<Point> _position;
|
||||
AnimationPerformance _performance;
|
||||
|
||||
void initState() {
|
||||
_position = new AnimatedType<Point>(new Point(0.0, 50.0), end: Point.origin);
|
||||
_position = new AnimatedValue<Point>(new Point(0.0, 50.0), end: Point.origin);
|
||||
_performance = new AnimationPerformance()
|
||||
..duration = _kSlideInDuration
|
||||
..variable = _position
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user