diff --git a/LICENSE b/LICENSE index ba75c69..fd0e73d 100644 --- a/LICENSE +++ b/LICENSE @@ -1 +1,25 @@ -TODO: Add your license here. +BSD 2-Clause License + +Copyright (c) [2020], [Nikhil Vadoliya] +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/README.md b/README.md index 7572147..49efc8b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Flutter slider drawer -[![pub package](https://img.shields.io/pub/v/flutter_slider_drawer)](https://pub.dev/packages/flutter_slider_drawer) +[![pub package](https://img.shields.io/pub/v/flutter_slider_drawer)](https://pub.dev/packages/flutter_slider_drawer) [![pub package](https://img.shields.io/github/languages/code-size/NikhilVadoliya/Flutter_slider_drawer)](https://pub.dev/packages/flutter_slider_drawer) + A Flutter package with custom implementation of the Sider Drawer Menu @@ -83,3 +84,9 @@ GlobalKey _key = ``` + +License +---- + +BSD 2-Clause License + diff --git a/lib/flutter_slider_drawer.dart b/lib/flutter_slider_drawer.dart index 446bb5c..f78a631 100644 --- a/lib/flutter_slider_drawer.dart +++ b/lib/flutter_slider_drawer.dart @@ -56,17 +56,17 @@ class SliderMenuContainerState extends State double db = 0; bool get isDrawerOpen => _isSlideBarOpen; - Animation _translationValues; void toggle() { setState(() { _isSlideBarOpen - ? _animationController.forward() - : _animationController.reverse(); + ? _animationController.reverse() + : _animationController.forward(); _slideBarXOffset = _isSlideBarOpen - ? widget.sliderMenuOpenOffset - : widget.sliderMenuCloseOffset; - // _slideBarYOffset = _isSlideBarOpen ? widget.sliderMainOffset : 0; + ? widget.sliderMenuCloseOffset + : widget.sliderMenuOpenOffset; + _slideBarYOffset = 0; + _isSlideBarOpen = !_isSlideBarOpen; }); } @@ -74,8 +74,8 @@ class SliderMenuContainerState extends State setState(() { _animationController.forward(); _slideBarXOffset = widget.sliderMenuOpenOffset; - // _slideBarYOffset = widget.sliderMainOffset; - }); + _isSlideBarOpen=true; + }); } void closeDrawer() { @@ -83,6 +83,8 @@ class SliderMenuContainerState extends State _animationController.reverse(); _slideBarXOffset = widget.sliderMenuCloseOffset; _slideBarYOffset = 0; + _isSlideBarOpen=false; + }); } @@ -100,58 +102,57 @@ class SliderMenuContainerState extends State Widget build(BuildContext context) { return Container( child: Stack(children: [ - Container( - width: widget.sliderMenuOpenOffset, - child: widget.sliderMenuWidget, - ), - AnimatedContainer( - duration: + Container( + width: widget.sliderMenuOpenOffset, + child: widget.sliderMenuWidget, + ), + AnimatedContainer( + duration: Duration(milliseconds: widget.sliderAnimationTimeInMilliseconds), - curve: Curves.easeIn, - width: double.infinity, - height: double.infinity, - color: Colors.white, - transform: Matrix4.translationValues( - _slideBarXOffset, _slideBarYOffset, 1.0), - child: Column( - children: [ - Container( - padding: widget.appBarPadding ?? const EdgeInsets.only(top: 24), - color: widget.appBarColor, - child: Row( - children: [ - SizedBox( - height: widget.appBarHeight ?? 0, - ), - widget.drawerIcon ?? - IconButton( - icon: AnimatedIcon( - icon: AnimatedIcons.menu_close, - color: widget.drawerIconColor, - size: widget.drawerIconSize, - progress: _animationController), - onPressed: () { - _isSlideBarOpen = !_isSlideBarOpen; - toggle(); - }), - Expanded( - child: widget.isTitleCenter - ? Center( - child: widget.title, - ) - : widget.title, - ), - widget.trailing ?? - SizedBox( - width: 35, + curve: Curves.easeIn, + width: double.infinity, + height: double.infinity, + color: Colors.white, + transform: Matrix4.translationValues( + _slideBarXOffset, _slideBarYOffset, 1.0), + child: Column( + children: [ + Container( + padding: widget.appBarPadding ?? const EdgeInsets.only(top: 24), + color: widget.appBarColor, + child: Row( + children: [ + SizedBox( + height: widget.appBarHeight ?? 0, + ), + widget.drawerIcon ?? + IconButton( + icon: AnimatedIcon( + icon: AnimatedIcons.menu_close, + color: widget.drawerIconColor, + size: widget.drawerIconSize, + progress: _animationController), + onPressed: () { + toggle(); + }), + Expanded( + child: widget.isTitleCenter + ? Center( + child: widget.title, ) - ], + : widget.title, ), - ), - Expanded(child: widget.sliderMainWidget), - ], - )), - ])); + widget.trailing ?? + SizedBox( + width: 35, + ) + ], + ), + ), + Expanded(child: widget.sliderMainWidget), + ], + )), + ])); } @override diff --git a/pubspec.yaml b/pubspec.yaml index ea13ebe..934ff44 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,7 @@ name: flutter_slider_drawer description: A Flutter package with custom implementation of the Sider Drawer Menu version: 1.0.1 +author: Nikhil Vadoliya homepage: https://github.com/NikhilVadoliya/Flutter_slider_drawer environment: