sliding_drawer 1.0.2
sliding_drawer: ^1.0.2 copied to clipboard
A Flutter widget that provides a drawer with the sliding effect.
Sliding Drawer #
A Flutter widget that provides a drawer with the sliding effect.

🎯 Features #
- Easy to use API
- Any direction support
- Customizable drawer width
- Controller which manages a drawer state
- Customizable shade color
⚙️ Getting started #
Add the following line to pubspec.yaml
:
dependencies:
sliding_drawer: ^1.0.2
🚀 Usage #
- Create a SlidingDrawerController in the state of your stateful widget:
class _SomeWidgetState extends State<SomeWidget> {
// Create a drawer controller.
// Also you can set up the drawer width and
// the initial state here (optional).
final SlidingDrawerController _drawerController = SlidingDrawerController(
this.isOpenOnInitial = false,
this.drawerFraction = 0.7,
);
@override
void dispose() {
// Clean up the controller when the widget is removed
// from the widget tree.
_drawerController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
// Fill this out in the next step.
}
}
- Create a SlidingDrawer and connect the controller to it:
SlidingDrawer(
// Connect the controller to the drawer.
controller: _drawerController,
// You can set up some optional properties
// (eg, a shade color, an axis direction, a onShadedAreaTap callback)
shadeColor: Colors.black,
axisDirection: AxisDirection.right,
onShadedAreaTap: () {},
// Add a drawer widget.
drawer: const Scaffold(
body: ColoredBox(
color: Colors.amber,
child: Center(
child: Text('Drawer'),
),
),
),
// Add a body widget.
body: const Scaffold(
body: ColoredBox(
color: Colors.pink,
child: Center(
child: Text('Body'),
),
),
),
);
- (Optional) Use the controller to interact with the drawer (e.g., for closing):
// Call the animateClose method to close the drawer with an animation.
_drawerController.animateClose(
duration: const Duration(milliseconds: 300),
curve: Curves.easeOut,
);
❤️ Additional information #
Pull requests are welcome!
If you encounter any problems or you have any ideas, feel free to open an issue:
There might be some grammar issues in the docs. I would be very grateful if you could help me to fix it.