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
class _MyHomePageState extends State<MyHomePage> | |
with SingleTickerProviderStateMixin { | |
AnimationController _controller; | |
@override | |
void initState() { | |
super.initState(); | |
_controller = AnimationController( | |
vsync: this, duration: const Duration(milliseconds: 100), value: 1.0); |
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
/* | |
FrontView Slide Animation | |
*/ | |
Animation<Offset> _getSlideAnimation() { | |
return Tween(begin: Offset(0.85, 0.0), end: Offset(0, 0)).animate( | |
CurvedAnimation(parent: widget._controller, curve: Curves.linear)); | |
} | |
/* |
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
@override | |
Widget build(BuildContext context) { | |
return LayoutBuilder( | |
builder: activityContainer, | |
); | |
} | |
Widget activityContainer(BuildContext context, BoxConstraints constraint) { | |
final ThemeData _theme = Theme.of(context); | |
return Container( |
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
Widget _frontView() { | |
return SlideTransition( | |
position: _getSlideAnimation(), | |
child: ScaleTransition( | |
alignment: Alignment.centerLeft, | |
scale: _getScaleAnimation(), | |
child: _frontViewBody(), | |
)); | |
} |
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
void _startAnimation(AnimationController _controller) { | |
_controller.fling( | |
velocity:isBackpanelVisible(widget._controller) ? -1.0 : 1.0); | |
} | |
bool isBackpanelVisible(AnimationController _controller) { | |
final AnimationStatus status =_controller.status; | |
return status == AnimationStatus.completed || | |
status == AnimationStatus.forward; | |
} |