Skip to content

Instantly share code, notes, and snippets.

@letsar
Created September 1, 2018 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save letsar/b755dea7ebdbf605c0bd0f8c0fec2771 to your computer and use it in GitHub Desktop.
Save letsar/b755dea7ebdbf605c0bd0f8c0fec2771 to your computer and use it in GitHub Desktop.
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