-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sinasystem
committed
Jun 8, 2022
1 parent
2e852ab
commit a96c2b4
Showing
8 changed files
with
77 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:simple_animations/simple_animations.dart'; | ||
|
||
enum AniProps { opacity, translateY } | ||
|
||
class FadeInAnimation extends StatelessWidget { | ||
final double delay; | ||
final Widget child; | ||
|
||
const FadeInAnimation({Key? key ,required this.delay, required this.child}):super(key: key); | ||
|
||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final tween = MultiTween<AniProps>() | ||
..add(AniProps.opacity, Tween<double>(begin: 0.0, end: 1.0), const Duration(milliseconds: 500)) | ||
..add(AniProps.translateY, Tween<double>(begin: -30.0, end: 0.0), const Duration(milliseconds: 500), | ||
Curves.easeOut); | ||
|
||
|
||
return PlayAnimation<MultiTweenValues<AniProps>>( | ||
delay: Duration(milliseconds: (500 * delay).round()), | ||
duration: tween.duration, | ||
tween: tween, | ||
child: child, | ||
builder: (context, child, value) => Opacity( | ||
opacity: value.get(AniProps.opacity), | ||
child: Transform.translate( | ||
offset: Offset(0, value.get(AniProps.translateY),), child: child), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters