- provide animationController

master
NikhilVadoliya 4 years ago
parent 124225e272
commit e984f7eba5

@ -36,9 +36,7 @@ class _MyAppState extends State<MyApp> {
appBarPadding: const EdgeInsets.only(top: 20), appBarPadding: const EdgeInsets.only(top: 20),
sliderMenuOpenSize: 200, sliderMenuOpenSize: 200,
sliderMenuCloseSize: 60, sliderMenuCloseSize: 60,
// slideDirection: SlideDirection.TOP_TO_BOTTOM,
appBarHeight: 60, appBarHeight: 60,
// isShadow: true,
title: Text( title: Text(
title, title,
style: TextStyle(fontSize: 22, fontWeight: FontWeight.w700), style: TextStyle(fontSize: 22, fontWeight: FontWeight.w700),

@ -58,11 +58,6 @@ class SliderMenuContainer extends StatefulWidget {
class SliderMenuContainerState extends State<SliderMenuContainer> class SliderMenuContainerState extends State<SliderMenuContainer>
with TickerProviderStateMixin { with TickerProviderStateMixin {
double _slideBarXOffset = 0;
double _slideBarYOffset = 0;
bool _isSlideBarOpen = false;
// AnimationController _animationButtonController;
AnimationController _animationDrawerController; AnimationController _animationDrawerController;
Animation animation; Animation animation;
@ -71,67 +66,24 @@ class SliderMenuContainerState extends State<SliderMenuContainer>
/// check whether drawer is open /// check whether drawer is open
bool get isDrawerOpen => _animationDrawerController.isCompleted; bool get isDrawerOpen => _animationDrawerController.isCompleted;
AnimationController get animationController => _animationDrawerController;
/// Toggle drawer /// Toggle drawer
void toggle() { void toggle() {
_animationDrawerController.isCompleted _animationDrawerController.isCompleted
? _animationDrawerController.reverse() ? _animationDrawerController.reverse()
: _animationDrawerController.forward(); : _animationDrawerController.forward();
/*setState(() {
_isSlideBarOpen
? _animationButtonController.reverse()
: _animationButtonController.forward();
if (widget.sliderOpen == SliderOpen.LEFT_TO_RIGHT ||
widget.sliderOpen == SliderOpen.RIGHT_TO_LEFT) {
_slideBarXOffset = _isSlideBarOpen
? widget.sliderMenuCloseOffset
: widget.sliderMenuOpenOffset;
} else {
_slideBarYOffset = _isSlideBarOpen
? widget.sliderMenuCloseOffset
: widget.sliderMenuOpenOffset;
}
_isSlideBarOpen = !_isSlideBarOpen;
});*/
} }
/// Open drawer /// Open drawer
void openDrawer() { void openDrawer() => _animationDrawerController.forward();
_animationDrawerController.forward();
/*setState(() {
_animationButtonController.forward();
if (widget.sliderOpen == SliderOpen.LEFT_TO_RIGHT ||
widget.sliderOpen == SliderOpen.RIGHT_TO_LEFT) {
_slideBarXOffset = widget.sliderMenuOpenOffset;
} else {
_slideBarYOffset = widget.sliderMenuOpenOffset;
}
_isSlideBarOpen = true;
});*/
}
/// Close drawer /// Close drawer
void closeDrawer() { void closeDrawer() => _animationDrawerController.reverse();
_animationDrawerController.reverse();
/* setState(() {
_animationButtonController.reverse();
if (widget.sliderOpen == SliderOpen.LEFT_TO_RIGHT ||
widget.sliderOpen == SliderOpen.RIGHT_TO_LEFT) {
_slideBarXOffset = widget.sliderMenuCloseOffset;
} else {
_slideBarYOffset = widget.sliderMenuCloseOffset;
}
_isSlideBarOpen = false;
});*/
}
@override @override
void initState() { void initState() {
super.initState(); super.initState();
/* _animationButtonController = AnimationController(
vsync: this,
duration:
Duration(milliseconds: widget.sliderAnimationTimeInMilliseconds));*/
_animationDrawerController = AnimationController( _animationDrawerController = AnimationController(
vsync: this, vsync: this,

Loading…
Cancel
Save