Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/src/base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ class SideMenu extends StatefulWidget {
/// 4. slide
final SideMenuType type;

/// If true, shows a colored mask [barrierColor] over the child as SideMenu open and tap to close SideMenu.
/// This can also avoid gestures in child part.
final bool isDismissible;

/// If [isDismissible] is true, custom the mask color.
final Color? barrierColor;

/// Custom animation curve.
final Curve curve;

/// Liquid Shrink Side Menu is compatible with [Liquid ui](https://pub.dev/packages/liquid_ui)
///
/// Create a SideMenu / Drawer
Expand Down Expand Up @@ -107,6 +117,9 @@ class SideMenu extends StatefulWidget {
this.type = SideMenuType.shrikNRotate,
this.maxMenuWidth = 275.0,
bool inverse = false,
this.isDismissible = false,
this.barrierColor,
this.curve = Curves.fastLinearToSlowEaseIn,
}) : assert(maxMenuWidth > 0),
_inverse = inverse ? -1 : 1,
super(key: key);
Expand Down
29 changes: 20 additions & 9 deletions lib/src/shrik_slide_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ShrinkSlideSideMenuState extends SideMenuState {
_getCloseButton(statusBarHeight),
AnimatedContainer(
duration: const Duration(milliseconds: 350),
curve: Curves.fastLinearToSlowEaseIn,
curve: widget.curve,
alignment: Alignment.topLeft,
transform: _getMatrix4(size),
decoration: BoxDecoration(
Expand All @@ -35,15 +35,26 @@ class ShrinkSlideSideMenuState extends SideMenuState {
);
}

Widget _getChild() => _opened
? SafeArea(
child: ClipRRect(
borderRadius: _getBorderRadius(),
clipBehavior: Clip.antiAlias,
child: widget.child,
Widget _getChild() => Stack(
children: [
SafeArea(
top: _opened,
bottom: _opened,
right: _opened,
left: _opened,
child: ClipRRect(
borderRadius: _getBorderRadius(),
clipBehavior: Clip.antiAlias,
child: widget.child,
),
),
)
: widget.child;
if (_opened)
GestureDetector(
onTap: closeSideMenu,
child: Container(color: widget.barrierColor ?? Colors.transparent),
),
],
);

BorderRadius _getBorderRadius() => _opened
? (widget.radius ?? BorderRadius.circular(34.0))
Expand Down
29 changes: 20 additions & 9 deletions lib/src/shrink_slide_rotate_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ShrinkSlideRotateSideMenuState extends SideMenuState {
_getCloseButton(statusBarHeight),
AnimatedContainer(
duration: const Duration(milliseconds: 350),
curve: Curves.fastLinearToSlowEaseIn,
curve: widget.curve,
transform: _getMatrix4(size),
decoration: BoxDecoration(
borderRadius: _getBorderRadius(),
Expand All @@ -39,15 +39,26 @@ class ShrinkSlideRotateSideMenuState extends SideMenuState {
);
}

Widget _getChild() => _opened
? SafeArea(
child: ClipRRect(
borderRadius: _getBorderRadius(),
clipBehavior: Clip.antiAlias,
child: widget.child,
Widget _getChild() => Stack(
children: [
SafeArea(
top: _opened,
bottom: _opened,
right: _opened,
left: _opened,
child: ClipRRect(
borderRadius: _getBorderRadius(),
clipBehavior: Clip.antiAlias,
child: widget.child,
),
),
)
: widget.child;
if (_opened)
GestureDetector(
onTap: closeSideMenu,
child: Container(color: widget.barrierColor ?? Colors.transparent),
),
],
);

BorderRadius _getBorderRadius() => _opened
? (widget.radius ?? BorderRadius.circular(34.0))
Expand Down
15 changes: 13 additions & 2 deletions lib/src/slide_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,27 @@ class SlideSideMenuState extends SideMenuState {
_getCloseButton(statusBarHeight),
AnimatedContainer(
duration: const Duration(milliseconds: 350),
curve: Curves.fastLinearToSlowEaseIn,
curve: widget.curve,
alignment: Alignment.topLeft,
transform: _getMatrix4(size),
child: widget.child,
child: _getChild(),
),
],
),
);
}

Widget _getChild() => Stack(
children: [
widget.child,
if (_opened)
GestureDetector(
onTap: closeSideMenu,
child: Container(color: widget.barrierColor ?? Colors.transparent),
),
],
);

Matrix4 _getMatrix4(Size size) {
if (_opened) {
return Matrix4.identity()
Expand Down
29 changes: 20 additions & 9 deletions lib/src/slide_rotate_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SlideRotateSideMenuState extends SideMenuState {
_getCloseButton(statusBarHeight),
AnimatedContainer(
duration: const Duration(milliseconds: 350),
curve: Curves.fastLinearToSlowEaseIn,
curve: widget.curve,
transform: _getMatrix4(size),
decoration: BoxDecoration(
borderRadius: _getBorderRadius(),
Expand All @@ -39,15 +39,26 @@ class SlideRotateSideMenuState extends SideMenuState {
);
}

Widget _getChild() => _opened
? SafeArea(
child: ClipRRect(
borderRadius: _getBorderRadius(),
clipBehavior: Clip.antiAlias,
child: widget.child,
Widget _getChild() => Stack(
children: [
SafeArea(
top: _opened,
bottom: _opened,
right: _opened,
left: _opened,
child: ClipRRect(
borderRadius: _getBorderRadius(),
clipBehavior: Clip.antiAlias,
child: widget.child,
),
),
)
: widget.child;
if (_opened)
GestureDetector(
onTap: closeSideMenu,
child: Container(color: widget.barrierColor ?? Colors.transparent),
),
],
);

BorderRadius _getBorderRadius() => _opened
? (widget.radius ?? BorderRadius.circular(34.0))
Expand Down