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 AnimatedBuilder( | |
animation: _animationController, | |
builder: (context, child) { | |
return Container( | |
width: 70.0, | |
height: 35.0, | |
decoration: BoxDecoration( | |
borderRadius: BorderRadius.circular(20.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
Animation _circleAnimation; | |
AnimationController _animationController; | |
@override | |
void initState() { | |
super.initState(); | |
_animationController = | |
AnimationController(vsync: this, duration: Duration(milliseconds: 60)); | |
_circleAnimation = AlignmentTween( |
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
library custom_switch; | |
import 'package:flutter/material.dart'; | |
class CustomSwitch extends StatefulWidget { | |
final bool value; | |
final ValueChanged<bool> onChanged; | |
final Color activeColor; | |
const CustomSwitch({Key key, this.value, this.onChanged, this.activeColor}) |
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) { | |
final width = MediaQuery.of(context).size.width; | |
final height = MediaQuery.of(context).size.height; | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('Animated Screen'), | |
), | |
body: Center( | |
child: AnimatedBuilder( |
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 AnimatedScreen extends StatefulWidget { | |
@override | |
_AnimatedScreenState createState() => _AnimatedScreenState(); | |
} | |
class _AnimatedScreenState extends State<AnimatedScreen> | |
with TickerProviderStateMixin { | |
Animation _containerRadiusAnimation, | |
_containerSizeAnimation, | |
_containerColorAnimation; |
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 Scaffold( | |
appBar: AppBar( | |
title: Text('Example Animations'), | |
), | |
body: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
firstChild(), |
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 | |
void dispose() { | |
super.dispose(); | |
_arrowAnimationController?.dispose(); | |
_heartAnimationController?.dispose(); | |
} |
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 Scaffold( | |
appBar: AppBar( | |
title: Text('Example Animations'), | |
), | |
body: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
firstChild(), |
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 HomeScreen extends StatefulWidget { | |
@override | |
_HomeScreenState createState() => _HomeScreenState(); | |
} | |
class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin { | |
Animation _arrowAnimation, _heartAnimation; | |
AnimationController _arrowAnimationController, _heartAnimationController; | |
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 firstChild() { | |
return Row( | |
mainAxisAlignment: MainAxisAlignment.spaceAround, | |
children: <Widget>[ | |
AnimatedBuilder( | |
animation: _arrowAnimationController, | |
builder: (context, child) => Transform.rotate( | |
angle: _arrowAnimation.value, | |
child: Icon( | |
Icons.expand_more, |