flutter_custom_drawer 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 71

flutter_custom_drawer #

a fully customizable drawer like a slider

##Screenshots

How to use #

‘‘‘ drag right to open drawer and drag left to close drawer, width of draggable area is drawWidth in ModernDrawer widget ’’’

Example #

import 'package:flutter/material.dart';

void main() => runApp(
  MaterialApp(
    home: MyApp(),
  )
);


class MyApp extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    var size = MediaQuery.of(context).size;
    return Scaffold(
        body: ModernDrawer(
          drawWidth: size.width * 0.5,
          top: size.height * 0.05,
          bottom: size.height * 0.05,
          swipableAreaWidth: size.width * 0.5,
          backgroundWidget: Container(
            color: Colors.black.withOpacity(0.2),
            alignment: Alignment.centerRight,
            child: Container(
              alignment: Alignment.center,
              width: size.width * 0.48,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  Card(
                    elevation: 4,
                    child: Container(
                      height: 70,
                      alignment: Alignment.center,
                      child: Text(
                        "Button",
                        style: TextStyle(
                          color: Colors.black,
                          fontWeight: FontWeight.bold,
                          fontSize: 17
                        ),
                      ),
                    ),
                  ),
                  Card(
                    elevation: 4,
                    child: Container(
                      height: 70,
                      alignment: Alignment.center,
                      child: Text(
                        "Button",
                        style: TextStyle(
                          color: Colors.black,
                          fontWeight: FontWeight.bold,
                          fontSize: 17
                        ),
                      ),
                    ),
                  ),
                  Card(
                    elevation: 4,
                    child: Container(
                      height: 70,
                      alignment: Alignment.center,
                      child: Text(
                        "Button",
                        style: TextStyle(
                          color: Colors.black,
                          fontWeight: FontWeight.bold,
                          fontSize: 17
                        ),
                      ),
                    ),
                  ),
                  Card(
                    elevation: 4,
                    child: Container(
                      height: 70,
                      alignment: Alignment.center,
                      child: Text(
                        "Button",
                        style: TextStyle(
                          color: Colors.black,
                          fontWeight: FontWeight.bold,
                          fontSize: 17
                        ),
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ),
          foregroundWidget: Container(
            color: Colors.lightBlue,
            width: size.width,
            height: size.height,
          ),
        ),
    );
  }
}

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

[0.0.1] - Release #

  • A customizable cutom drawer written in dart

[0.1.0] - Release #

fixed some issues made it more stable

example/example.md

How to use #

‘‘‘ drag right to open drawer and drag left to close drawer, width of draggable area is drawWidth in ModernDrawer widget ’’’

Example #

import 'package:flutter/material.dart';

void main() => runApp(
  MaterialApp(
    home: MyApp(),
  )
);


class MyApp extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    var size = MediaQuery.of(context).size;
    return Scaffold(
        body: ModernDrawer(
          drawWidth: size.width * 0.5,
          top: size.height * 0.05,
          bottom: size.height * 0.05,
          swipableAreaWidth: size.width * 0.5,
          backgroundWidget: Container(
            color: Colors.black.withOpacity(0.2),
            alignment: Alignment.centerRight,
            child: Container(
              alignment: Alignment.center,
              width: size.width * 0.48,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  Card(
                    elevation: 4,
                    child: Container(
                      height: 70,
                      alignment: Alignment.center,
                      child: Text(
                        "Button",
                        style: TextStyle(
                          color: Colors.black,
                          fontWeight: FontWeight.bold,
                          fontSize: 17
                        ),
                      ),
                    ),
                  ),
                  Card(
                    elevation: 4,
                    child: Container(
                      height: 70,
                      alignment: Alignment.center,
                      child: Text(
                        "Button",
                        style: TextStyle(
                          color: Colors.black,
                          fontWeight: FontWeight.bold,
                          fontSize: 17
                        ),
                      ),
                    ),
                  ),
                  Card(
                    elevation: 4,
                    child: Container(
                      height: 70,
                      alignment: Alignment.center,
                      child: Text(
                        "Button",
                        style: TextStyle(
                          color: Colors.black,
                          fontWeight: FontWeight.bold,
                          fontSize: 17
                        ),
                      ),
                    ),
                  ),
                  Card(
                    elevation: 4,
                    child: Container(
                      height: 70,
                      alignment: Alignment.center,
                      child: Text(
                        "Button",
                        style: TextStyle(
                          color: Colors.black,
                          fontWeight: FontWeight.bold,
                          fontSize: 17
                        ),
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ),
          foregroundWidget: Container(
            color: Colors.lightBlue,
            width: size.width,
            height: size.height,
          ),
        ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_custom_drawer: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_custom_drawer/flutter_custom_drawer.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
45
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
94
Overall:
Weighted score of the above. [more]
71
Learn more about scoring.

We analyzed this package on Jul 9, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • flutter_custom_drawer that is a package requiring null.

Health suggestions

Fix lib/flutter_custom_drawer.dart. (-0.50 points)

Analysis of lib/flutter_custom_drawer.dart reported 1 hint:

line 6 col 7: This class (or a class that this class inherits from) is marked as '@immutable', but one or more of its instance fields aren't final: ModernDrawer.backgroundColor, ModernDrawer.drawWidth, ModernDrawer.swipableAreaWidth, ModernDrawer.backgroundWidget, ModernDrawer.foregroundWidget, ModernDrawer.top, ModernDrawer.bottom

Maintenance suggestions

The description is too long. (-6 points)

Search engines display only the first part of the description. Try to keep the value of the description field in your package's pubspec.yaml file between 60 and 180 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.1
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test