sliding_drawer

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

sliding drawer

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
copied to clipboard
🚀 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.
}
}
copied to clipboard

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'),
),
),
),
);
copied to clipboard

(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,
);
copied to clipboard
❤️ Additional information #
Pull requests are welcome!
If you encounter any problems or you have any ideas, feel free to open an issue:

Form for bugs
Form for feature requests
Form for questions

There might be some grammar issues in the docs. I would be very grateful if you could help me to fix it.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.