Hidden Drawer Menu is a library for adding a beautiful drawer mode menu feature with perspective animation.

Overview

pub package buymeacoffee

Hidden Drawer Menu

Hidden Drawer Menu is a library for adding a beautiful drawer mode menu feature with perspective animation.

You can use a pre-defined menu or make a fully customized menu.

Usage of the hidden_drawer_menu widget on an android device

Download APK Example

Use with default menu

import 'package:hidden_drawer_menu/model/hidden_drawer_menu.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key}) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  List<ScreenHiddenDrawer> itens = new List();

  @override
  void initState() {
    itens.add(new ScreenHiddenDrawer(
        new ItemHiddenMenu(
          name: "Screen 1",
          baseStyle: TextStyle( color: Colors.white.withOpacity(0.8), fontSize: 28.0 ),
          colorLineSelected: Colors.teal,
        ),
        FirstSreen()));

    itens.add(new ScreenHiddenDrawer(
        new ItemHiddenMenu(
          name: "Screen 2",
          baseStyle: TextStyle( color: Colors.white.withOpacity(0.8), fontSize: 28.0 ),
          colorLineSelected: Colors.orange,
        ),
        SecondSreen()));

    super.initState();
  }

  @override
  Widget build(BuildContext context) {

    return HiddenDrawerMenu(
      backgroundColorMenu: Colors.blueGrey,
      backgroundColorAppBar: Colors.cyan,
      screens: itens,
        //    typeOpen: TypeOpen.FROM_RIGHT,
        //    disableAppBarDefault: false,
        //    enableScaleAnimin: true,
        //    enableCornerAnimin: true,
        //    slidePercent: 80.0,
        //    verticalScalePercent: 80.0,
        //    contentCornerRadius: 10.0,
        //    iconMenuAppBar: Icon(Icons.menu),
        //    backgroundContent: DecorationImage((image: ExactAssetImage('assets/bg_news.jpg'),fit: BoxFit.cover),
        //    whithAutoTittleName: true,
        //    styleAutoTittleName: TextStyle(color: Colors.red),
        //    actionsAppBar: <Widget>[],
        //    backgroundColorContent: Colors.blue,
        //    elevationAppBar: 4.0,
        //    tittleAppBar: Center(child: Icon(Icons.ac_unit),),
        //    enableShadowItensMenu: true,
        //    backgroundMenu: DecorationImage(image: ExactAssetImage('assets/bg_news.jpg'),fit: BoxFit.cover),
    );
    
  }
}

Use with full customization menu

import 'package:hidden_drawer_menu/model/hidden_drawer_menu.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: SimpleHiddenDrawer(
        menu: Menu(),
        screenSelectedBuilder: (position,controller) {
          
          Widget screenCurrent;
          
          switch(position){
            case 0 : screenCurrent = Screen1(); break;
            case 1 : screenCurrent = Screen2(); break;
            case 2 : screenCurrent = Screen3(); break;
          }
          
          return Scaffold(
            backgroundColor: backgroundColorContent,
            appBar: AppBar(
              leading: IconButton(
                  icon: Icon(Icons.menu),
                  onPressed: () {
                    controller.toggle();
                  }),
            ),
            body: screenCurrent,
          );
          
        },
      ),
    );
  }
}

class Menu extends StatefulWidget {
  @override
  _SecondSreenState createState() => _MenuState();
}

class _MenuState extends State<SecondSreen> {

  SimpleHiddenDrawerController controller;

  @override
  void didChangeDependencies() {
    controller = SimpleHiddenDrawerController.of(context);
    super.didChangeDependencies();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.maxFinite,
      height: double.maxFinite,
      color: Colors.cyan,
      padding: const EdgeInsets.all(8.0),
      child: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[
            RaisedButton(
              onPressed: () {
                controller.setSelectedMenuPosition(0);
              },
              child: Text("Menu 1"),
            ),
            RaisedButton(
              onPressed: () {
                controller.setSelectedMenuPosition(1);
              },
              child: Text("Menu 2"),
            )
          ],
        ),
      ),
    );
  }
}

Actions

This actions is only accessible by the children of HiddenDrawerMenu or SimpleHiddenDrawer.

Select item menu

SimpleHiddenDrawerController.of(context).setSelectedMenuPosition(0);

Toggle menu (if opened will close, if closed will open)

SimpleHiddenDrawerController.of(context).toggle();

Open

SimpleHiddenDrawerController.of(context).open();

Close

SimpleHiddenDrawerController.of(context).close();

Listen selected position

final controller = SimpleHiddenDrawerController.of(context);
controller.addListener((){
  print(controller.position);
});

Listen to menu status (closed,opening,open,closing)

final controller = SimpleHiddenDrawerController.of(context);
controller.addListener((){
  print(controller.state);
});

If you want to use only the widget responsible for the animation, it is now available as AnimatedDrawerContent

Example usage AnimatedDrawerContent

AnimatedDrawerController controller = AnimatedDrawerController(
  vsync: this,
  animationCurve:Curves.decelerate,
  duration:const Duration(milliseconds: 350,
);

return AnimatedDrawerContent(
  controller: controller,
  whithPaddingTop: false, //(optional) default = false // Add padding top in de gesture equals Heigth of the AppBar
  whithShadow: false, //(optional) default = false
  isDraggable: true, //(optional) default = true
  child: Screen(),
);

You can control actions by controller such as:

controller.toggle() // Open or Close
controller.open()
controller.close()
controller.move(percent) // moves to a specific position from 0 to 1 (0 = fully enclosed, 1 = fully opened)

Available settings

Menu

  • change BackgroundColor
  • set DecorationImage backgroud
  • enable Shadow above itens

Itens Menu

  • change colorText when selected
  • change colorText when unselected
  • change color lineleft selected

AppBar

  • change menu icon
  • change elavation
  • change BackgroundColor
  • set AutoTittleName
  • set actions
  • set widget in tittleAppBar

Content

  • change BackgroundColor
  • enable dragable
  • change curve animation
Comments
  • Should set a screen without opening the menu

    Should set a screen without opening the menu

    Hi.

    In some cases, I should open some screens which are on the menu. If I open these screens using Navigator.push(), menu will not be shown. So, to handle this problem, I use SimpleHiddenDrawerProvider.of(context).setSelectedMenuPosition(). But everytime I use setSelectedMenuPosition(), it opens the menu. I should set screen without opening the menu for these kind of cases.

    opened by egulhan 4
  • Integration with Maps

    Integration with Maps

    Hi,

    I'm trying to integrate a SimpleHiddenDrawer widget with a GoogleMaps in the main screen. Problem is that the GestureDetector prevents the map to be draggable, i've set the isDraggable to false but that doesn't work, the GestureDetector still gets the dragging events.

    As a work around, i've altered a bit the animated_drawer_content.dart file to avoid the GestureDetector catching dragging events if the isDraggable flag is true.

    Do you have another solution for this?

    Thank you.

    opened by damato3 3
  • How to pass controller toggle to another file?

    How to pass controller toggle to another file?

    Hi,

    I want to pass my controller toggle (which is in the example custom menu script,) to another file so it will open and close my sliding menu.

    Effectively I have disabled the app bar from being forced onto every screen it goes to, but I still want the feature of toggling the controller from the app bar

    How would I be able to pass this to my second script?

    Can post code below if anyone needs it!

    Thanks @RafaelBarbosatec

    opened by StefanTFletcher 3
  • Touch target for dragging screen back is too small

    Touch target for dragging screen back is too small

    The touch target on the selected screen when the menu is open is waaaaay to small. It needs to be smaller and / or tapping anywhere on the selected screen should close the menu.

    opened by hinterlandcreative 3
  • Selected Screen (Current Screen) is intractable

    Selected Screen (Current Screen) is intractable

    Hello guys, I've started to use the fabulous Hidden Drawer Menu, but my problem is that, while the menu is opened screen on the right is intractable. What could I do to prevent it from interacting? I want it opened if the user tapped on it.

    Kind Regards

    opened by morteza-bahrami 3
  • ItemHiddenMenu's onTap function does not work

    ItemHiddenMenu's onTap function does not work

    Hi,

    I am using the drawer menu in my application with the default menu (close the example of the homepage), and the navigation between pages works great.

    However, in the 'logout' option I need to dispatch this event in my bloc, and not navigate to any page. So I tried using onTap by calling a logout function, But when I click, nothing happens. Any ideas?

    
      List<ScreenHiddenDrawer> itens = new List();
    
      _HomeScreenState(this._user);
    
      @override
      void initState() {
        super.initState();
        itens.add(new ScreenHiddenDrawer(
            new ItemHiddenMenu(
              name: 'Home',
              colorLineSelected: Colors.red[700],
              selectedStyle: TextStyle(fontWeight: FontWeight.w700),
            ),
            HomeTab()));
        itens.add(new ScreenHiddenDrawer(
            new ItemHiddenMenu(
                name: 'Card',
                colorLineSelected: Colors.red[700],
                selectedStyle: TextStyle(fontWeight: FontWeight.w700)),
            cardTab()));
        itens.add(new ScreenHiddenDrawer(
            new ItemHiddenMenu(
                name: 'Offers',
                colorLineSelected: Colors.red[700],
                selectedStyle: TextStyle(fontWeight: FontWeight.w700)),
            offersTab()));
        itens.add(new ScreenHiddenDrawer(
            new ItemHiddenMenu(
              name: 'Exit',
              colorLineSelected: Colors.red[700],
              selectedStyle: TextStyle(fontWeight: FontWeight.w700),
              onTap: () {
                _exitToApp();
              },
            ),
            null));   ///i'm replace with empty container, but has the same effect
      }
    
      void _exitToApp() {
        ...
      }
    
      @override
      void dispose() {
        super.dispose();
      }
    
      Widget cardTab() {
        ...
      }
    
      Widget homeTab() {
        ...
      }
    
      Widget offersTab() {
        ...
      }
    
      @override
      Widget build(BuildContext context) {
        return HiddenDrawerMenu(
          initPositionSelected: 0,
          backgroundColorMenu: Colors.grey,
          backgroundColorAppBar: Theme.of(context).primaryColor,
          elevationAppBar: 2,
          isTitleCentered: true,
          whithAutoTittleName: true,
          screens: itens,
          backgroundColorContent: Theme.of(context).scaffoldBackgroundColor,
          enableShadowItensMenu: true,
          contentCornerRadius: 10,
          slidePercent: 60,
          verticalScalePercent: 85,
          isDraggable: true,
          curveAnimation: Curves.fastLinearToSlowEaseIn,
          enableScaleAnimin: true,
          enableCornerAnimin: true ),
        );
      }
    }```
    opened by rbocchi 2
  • Keeping each ScreenHiddenDrawer alive?

    Keeping each ScreenHiddenDrawer alive?

    Each of the ScreenHiddenDrawer is rebuilding each time I change the the screen from the drawer. How can stop rebuilding it? Tried to include automatickeepalivemixin in each of the screens but not working!

    opened by adar2378 2
  • Page is disappearing using perspective and latest Flutter version.

    Page is disappearing using perspective and latest Flutter version.

    Thanks for this awesome package!

    Page disapears on latest Flutter version.

    Flutter (Channel beta, v1.1.8, on Mac OS X 10.14.2 18C54, locale pt-BR) hidden_drawer_menu 0.5.0

    Simulate: Just update flutter (Beta channel) and set 'enablePerspective' to true (version 0.5.0).

    screenshot_1549048651

    opened by FCMHUB 2
  • appBar customisation

    appBar customisation

    I don't know if this is the right place to post this, but I love your plugin and I'm wondering if it's possible to implement more customisation for the appbar. Now it's possible to set the appbar color etc. but this is for all the appbars. Would it be possible to set a different color for every 'screen'? Or would it else be possible to open/close the menu from a standard scaffold appbar?

    opened by gaauwe 2
  • AppBar doesn't update on Theme Changed

    AppBar doesn't update on Theme Changed

    Hi. I was trying to redraw / update my AppBar backgroundColor but it doesn't rebuild itself when I toggle() my current Theme colors. AppBar only rebuilds itself with Hot Restart.

    I tried:

    • setState
    • Provider
    • Inherited Widget
    • Hardcoding bool value and ternary operator to change background color, doesn't work either
    • Inheritance from another class
    • Passing values in constructor
    • Builder & StatefulBuilder

    It only rebuilds itself with the provided values when I re Run the app | Hot Restart.

    How can I rebuild this HiddenDrawerMenu when the color value has changed (with Provider for state management)?

    return HiddenDrawerMenu( backgroundColorAppBar: myColor, // -> This doesn't change backgroundColorMenu: myColor, // -> This works fine screens: mynewList); }

    hidden_drawer.dart

    Thank you, guys.

    opened by Adel-Cabrera 1
  • How make a custom menu page?

    How make a custom menu page?

    I am trying to use the following code:

    screenSelectedBuilder: (position) { switch(position){ case 0 : return Page1(); break; case 1 : return Page2(); break; case 2 : return Page3(); break; } }, but it marks me error. I'm guiding myself on the readme

    opened by DamianRincon 1
  •   SimpleHiddenDrawerController.of(context).setSelectedMenuPosition(SharedPref.getPreviousPosition(),openMenu: false); not working

    SimpleHiddenDrawerController.of(context).setSelectedMenuPosition(SharedPref.getPreviousPosition(),openMenu: false); not working

    Hi there, I am using your package in my application. The issue is that there's no implementation for the Routes. The problem is that our junior programmer who was tasked with this package sure that it's fine. but now it's not working.

    1st issue the 2nd approach you've mentioned in your package takes screen as a widget. It's one screen per widget. How are we supposed to make it work with a bottom navigation bar? The package doesn't work with Routes.

    I tried an approach of using Shared Preference and storing the current position of the Drawer's Current screen before moving to other. So I can use the value from Shared preference and set the selected position by using SimpleHiddenDrawerController.of(Context).setPosition.

    image

    Here you can see the snippet of how I am storing the value

    image

    Here you can see the way I am setting the selected position

    The issue itself

    When I set Position of the Drawer instead of moving to that screen the button opens up the Drawer menu itself!!!!

    opened by Umar-Khan-Yousafzai 0
  • Add optional parameters for more customizations

    Add optional parameters for more customizations

    Screenshot_1614432450

    1. add matrix builder parameter for custom transitions
    2. add close on tap flag instead of using isDraggable flag
    3. add optional animated background
    4. add example to show custom edits above here is a video of the example https://user-images.githubusercontent.com/38167511/109388678-412ff900-7911-11eb-95dd-ef7db70db751.mp4
    opened by youssefali424 2
  • How to go back to main page using arrow icon?

    How to go back to main page using arrow icon?

    Hi @RafaelBarbosatec, the use case scenario is similar to the one on the official guide: https://flutter.dev/docs/cookbook/navigation/navigation-basics#interactive-example

    If inside Page1 i can navigate to pageX, how can i go back to Page1 using the button in the appbar? The drawer icon should became the back button (arrow icon instead 3 lines icon), but it isn't so. Also i need the appbar on every screen, so I can't use the gestures to navigate back.

    opened by JoeCapo87 2
Releases(1.1.2)
Owner
Rafael Almeida Barbosa
Mobile Developer(Android/Flutter) In love with solutions that fit in the palm of the hand
Rafael Almeida Barbosa
A Beautiful Side Drawer Made With Flutter

Flutter Custom Drawer A beautiful side drawer. Made with Flutter ?? A while back, using Facebook, I stumbled upon a post on the Flutter Developers gro

Aashar Wahla 12 Dec 23, 2022
A beautiful drawer for flutter

flurry_drawer The repo is solving a problem with package flurry_navigation as it's old any the owner didn't update it. The drawer is very beautiful an

null 4 Feb 15, 2022
A Flutter package consisting of pre animated cards(containers) with fluid animation for freely adding user customized cards to the app with heavy customizable options adding up to an incredible UI experience

A Flutter package consisting of pre animated cards(containers) with fluid animation for freely adding user customized cards to the app with heavy customizable options adding up to an incredible UI experience

Shantanu 12 Dec 30, 2022
This is a repository for Flutter Focused Menu, an easy to implement package for adding Focused Long Press Menu to Flutter Applications

Focused Menu This is an easy to implement package for adding Focused Long Press Menu to Flutter Applications Current Features Add Focused Menu to Any

Paras Jain 160 Dec 26, 2022
AdvFAB - An Advanced floating action button that expands itself to reveal its hidden widget

AdvFAB (More Than Just A Floating Action Button) AdvFAB is An Advanced floating action button that expands itself to reveal its hidden widget. It can

null 19 Nov 4, 2022
Easy to use 3D Perspective PageView for Flutter

perspective_pageview With this you will be able to create 3D Perspective PageView in Flutter Easily Getting Started This project is a starting point f

Paras Jain 10 Nov 26, 2022
Loading times are unavoidable in application development. From a user experience (UX) perspective

loading A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

azzouz abdelhakim 2 Feb 12, 2022
Deepak Sharma 149 Dec 10, 2022
On making this project I learned using Getx to change between dark mode to light mode, learned about the time zone and schedule notification , That I have Integrated in this small app, This is the small section of making a todo app.

On making this project I learned using Getx to change between dark mode to light mode, learned about the time zone and schedule notification , That I have Integrated in this small app, This is the small section of making a todo app.

Pawan Kumar 1 Aug 22, 2022
Flutter application for latest news by top newspapers . And allow for share articles with friends. Now available in night mode. Also landscape mode is available

Breaking News Latest news for almost 55 country. Feature of saving article and search ariticles. Used API https://newsapi.org/ Note: if data is not ge

null 7 Oct 24, 2022
Flutter heatmap calendar inspired by github contribution chart. [traditional mode / calendar mode]

Flutter Heatmap Flutter heatmap calendar inspired by github contribution chart.

Kim Seung Hwan 1 Dec 26, 2021
A simple animated circular menu for Flutter, Adjustable radius, colors, alignment, animation curve and animation duration.

A simple animated circular menu for Flutter, Adjustable radius, colors, alignment, animation curve and animation duration. pub package Getting Started

Hasan Mohammed 91 Dec 20, 2022
Liquid swipe with Drawer - Liquid swipe application with full customizable drawer with govt logo

Liquid swipe with Drawer Liquid swipe application with full customizable drawer

Munem Sarker 1 Jan 19, 2022
Login Animation Ruchika GuptaLogin Animation [953⭐] - Smooth animation from login to home by Ruchika Gupta.

Flutter Login Home Animation A new open-source Flutter project that enables the developer to quickly get started with the Flutter animation and applic

GeekyAnts 1.1k Dec 28, 2022
Flutter: Animation Series || Episode 1 || Basic Animation || Episode 1 || Basic Animation

animationseries A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Pawan Kumar 24 Oct 31, 2022
Flutter animation tutorials, such common animation, flare animation.

❤️ Star ❤️ the repo to support the project or ?? Follow Me.Thanks! Facebook Page Facebook Group QQ Group Developer Flutter Open Flutter Open 963828159

Flutter开源社区 123 Sep 3, 2022
Flutter animation tutorials, such common animation, flare animation.

❤️ Star ❤️ the repo to support the project or ?? Follow Me.Thanks! Facebook Page Facebook Group QQ Group Developer Flutter Open Flutter Open 963828159

Flutter开源社区 123 Sep 3, 2022
News App developed with Flutter featuring beautiful UI, category-based news, story for faster news reading, inbuilt article viewer, share feature, and more.

Ariel News App developed with Flutter featuring beautiful UI, category-based news, story for faster news reading, inbuilt article viewer, share featur

Hash Studios 30 Nov 9, 2022
Flutter plugin for selecting images from the Android and iOS image library, taking new pictures with the camera, and edit them before using such as rotation, cropping, adding sticker/text/filters.

advance_image_picker Flutter plugin for selecting multiple images from the Android and iOS image library, taking new pictures with the camera, and edi

Weta Vietnam 91 Dec 19, 2022
A UI library for easily adding audio waveforms to your apps, with several customization options

A UI library for easily adding audio waveforms to your apps, with several custom

RutvikTak 64 Dec 11, 2022