Created
September 1, 2018 06:01
-
-
Save letsar/b755dea7ebdbf605c0bd0f8c0fec2771 to your computer and use it in GitHub Desktop.
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 SlidableDrawerDelegateDemo extends StatefulWidget { | |
@override | |
_SlidableDrawerDelegateDemoState createState() => | |
new _SlidableDrawerDelegateDemoState(); | |
} | |
class _SlidableDrawerDelegateDemoState extends State<SlidableDrawerDelegateDemo> | |
with TickerProviderStateMixin { | |
AnimationController _controller; | |
@override | |
void initState() { | |
super.initState(); | |
_controller = AnimationController(duration: _kDuration, vsync: this); | |
} | |
Future<Null> _playAnimation() async { | |
try { | |
await _controller.forward().orCancel; | |
await _controller.reverse().orCancel; | |
} on TickerCanceled { | |
// the animation got canceled, probably because we were disposed | |
} | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('Slidable Drawer Delegate Animation'), | |
), | |
body: GestureDetector( | |
behavior: HitTestBehavior.opaque, | |
onTap: () => _playAnimation(), | |
child: Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: Center( | |
child: SlidableDrawerDelegateAnimation( | |
controller: _controller.view, | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment