flutter_inner_drawer

pub package Awesome Flutter Donate

Inner Drawer is an easy way to create an internal side section (left/right) where you can insert a list menu or other.

Installing

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_inner_drawer: "^0.4.0"

Demo

Simple usage

import 'package:flutter_inner_drawer/inner_drawer.dart';
.
.
.

    final GlobalKey<InnerDrawerState> _innerDrawerKey = GlobalKey<InnerDrawerState>();


    @override
    Widget build(BuildContext context)
    {
        return InnerDrawer(
            key: _innerDrawerKey,
            onTapClose: true, // default false
            swipe: true, // default true            
            colorTransition: Color.red, // default Color.black54
            innerDrawerCallback: (a) => print(a ),// return bool
            leftOffset: 0.6, // default 0.4
            rightOffset: 0.6, // default 0.4
            leftAnimationType: InnerDrawerAnimation.static, // default static
            rightAnimationType: InnerDrawerAnimation.quadratic, // default static
            // at least one child is required
            leftChild: Container(),
            rightChild: Container(),
            //  A Scaffold is generally used but you are free to use other widgets
            // Note: use "automaticallyImplyLeading: false" if you do not personalize "leading" of Bar
            scaffold: Scaffold(
                appBar: AppBar(
                    automaticallyImplyLeading: false
                ),
            ) 
            OR
            CupertinoPageScaffold(                
                navigationBar: CupertinoNavigationBar(
                    automaticallyImplyLeading: false
                ),
            ), 
        )
    }
    
    void _toggle()
    {
       _innerDrawerKey.currentState.toggle(
       // direction is optional 
       // if not set, the last direction will be used                             
        direction: InnerDrawerDirection.end 
       );
    }
    
    

All parameters

  • leftChild - Inner Widget
  • rightChild - Inner Widget
  • scaffold - A Scaffold is generally used but you are free to use other widgets (required)
  • leftOffset - Offset drawer width (default 0.4)
  • rightOffset - Offset drawer width (default 0.4)
  • onTapClose - bool (default false)
  • swipe - bool (default true)
  • tapScaffoldEnabled - possibility to tap the scaffold even when open (default false)
  • boxShadow - BoxShadow of scaffold opened
  • colorTransition - default Colors.black54
  • leftAnimationType - static / linear / quadratic (default static)
  • rightAnimationType - static / linear / quadratic (default static)
  • innerDrawerCallback - Optional callback that is called when a InnerDrawer is opened or closed
  • innerDrawerKey.currentState.open - Open InnerDrawer
  • innerDrawerKey.currentState.close - Close InnerDrawer
  • innerDrawerKey.currentState.toggle - Open or Close InnerDrawer

If you found this project helpful or you learned something from the source code and want to thank me:

  • Donate

Issues

If you encounter problems, open an issue. Pull request are also welcome.

Libraries

inner_drawer