Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9dc86e2

Browse files
Make animation class
1 parent 19029f6 commit 9dc86e2

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

‎lib/Animations/FadeAnimation.dart‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:simple_animations/simple_animations.dart';
3+
4+
class FadeAnimation extends StatelessWidget {
5+
final double delay;
6+
final Widget child;
7+
8+
FadeAnimation(this.delay, this.child);
9+
10+
@override
11+
Widget build(BuildContext context) {
12+
final tween = MultiTrackTween([
13+
Track("opacity").add(Duration(milliseconds: 500), Tween(begin: 0.0, end: 1.0)),
14+
Track("translateY").add(
15+
Duration(milliseconds: 500), Tween(begin: 130.0, end: 0.0),
16+
curve: Curves.easeOut)
17+
]);
18+
19+
return ControlledAnimation(
20+
delay: Duration(milliseconds: (500 * delay).round()),
21+
duration: tween.duration,
22+
tween: tween,
23+
child: child,
24+
builderWithChild: (context, child, animation) => Opacity(
25+
opacity: animation["opacity"],
26+
child: Transform.translate(
27+
offset: Offset(0, animation["translateY"]),
28+
child: child
29+
),
30+
),
31+
);
32+
}
33+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /