flutter_sliding_drawer 2.0.0 copy "flutter_sliding_drawer: ^2.0.0" to clipboard
flutter_sliding_drawer: ^2.0.0 copied to clipboard

flutter_sliding_drawer package was created for nice and convenient way to show drawer with sliding animation.

SWUbanner

pub package

If you want to add a beautiful sliding animation menu to your application in an easy way, you can use this package. All you need is to pass your content and drawer widgets to the SlidingDrawer.

How to use #

To use the SlidingDrawer pass build functions drawerBuilder and contentBuilder that return drawer and content widgets correspondingly.
You can set drawer width, animation duration and curve by using settings argument.
Set ignorePointer to true if you need to disable opening/closing drawer by dragging.
To respond to opening/closing drawer, API provide listener onAnimationStatusChanged.
Supports left and right drawer position.

Example #

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<StatefulWidget> createState() {
    return _MyHomePageState();
  }
}

class _MyHomePageState extends State<MyHomePage> {
  // Optional. Provide Key<SlidingDrawerState> if you want
  // to open/close the drawer in response to some action
  final slidingDrawerKey = GlobalKey<SlidingDrawerState>();

  @override
  Widget build(BuildContext context) {
    return SlidingDrawer(
      key: slidingDrawerKey,
      // Build content widget
      contentBuilder: (context) {
        return Scaffold(
          appBar: AppBar(
            automaticallyImplyLeading: false,
            leading: IconButton(
              icon: const Icon(
                Icons.menu_rounded,
              ),
              onPressed: () {
                // Open drawer
                slidingDrawerKey.open();
              },
            ),
            title: const Text('Home page'),
          ),
          body: const MyHomePageBodyWidget(),
        );
      },
      // Build drawer widget
      drawerBuilder: (context) {
        return MyDrawerWidget(
            onItemPress: () {
              // Close drawer
              slidingDrawerKey.close();
            }
        );
      },
    );
  }
}
17
likes
130
pub points
77%
popularity

Publisher

verified publisherlanars.com

flutter_sliding_drawer package was created for nice and convenient way to show drawer with sliding animation.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-2-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_sliding_drawer