uts_sidemenu 1.0.1

uts_sidemenu #

A sidemenu for Flutter that goes under the Scaffold.

Getting Started #

This is basically a drawer but goes under the Scaffold.

Parameters #

  • Widget body: The main body of the page;
  • Widget menuBody: The menu body;
  • AppBar appBar: This is used to calculated the appBar height for the back drop;
  • int duration: The menu transition duration in milliseconds;
  • double menuSize: The menu size on percentage (> 0.0 && < 1.0)
  • bool isPanDisabled: Used to enabled/disabled pan gesture;
  • bool isBackDropDisabled: Used to enable/disabled the back drop;
  • BoxShadow shadow: The shadow of the main body that goes on the menu;
  • double menuFriction: This is used to give a parallax effect. 0.0 is static, with 1.0 the menu follows the main body (> 0.0 && < 1.0);
  • UTSDirection direction: horizontal or vertical;
  • UTSMode mode: The position of the menu for the horizontal direction, left or right;
  • curve: The animation curve;
  • onOpen, onClose, onSlide: callbacks;

Usage #

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: UTSSideMenu(
        body: _getMainBody(),
        menuBody: _getPegasoMenuBody(),
        appBar: _appBar,
        duration: 600,
        menuSize: 0.7,
        isPanDisabled: false,
        isBackdropDisabled: false,
        shadow: BoxShadow(
          color: Colors.black45,
          offset: Offset(3.0, 0.0),
          spreadRadius: 10.0,
          blurRadius: 3.0
        ),
        menuFriction: 0.3,
        direction: UTSDirection.horizontal,
        mode: UTSMode.right,
        curve: Curves.easeInOut,
        onOpen: () {
          //your code
        },
        onClose: () {
          // your code
        },
        onSlide: (dx) {
          setState(() {
            // your code
          });
        },
      ),
    );
  } 

[1.0.0] - 26 Dec 2018.

  • TODO: Right now, when dragging, the main section doesn't follow the finger precisely because of the Curve. Now works well only with linear curve.

example/main.dart

import 'package:flutter/material.dart';
import 'package:uts_sidemenu/uts_sidemenu.dart';


class ExampleApp extends StatelessWidget {
  AppBar _getAppBar() {
    return AppBar(
      actions: <Widget>[
        FlatButton(
          onPressed: () {
            // Toggle the menu state open/close
            MenuNotifier.notify.toggle();

            // or user directly open/close methods
            // MenuNotifier.notify.open();

            // or
            // MenuNotifier.notify.close();
          },
          child: Icon(
            Icons.menu,
            color: Colors.white,
          ),
        ),
      ],
      title: Text("Title"),
    );
  }

  Widget _getMainBody() {
    return Scaffold(
      appBar: _getAppBar(),
      body: Container(),
    );
  }

  Widget _getMenuBody() {
    return Container(
      child: Text("This is my menu body"),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: UTSSideMenu(
        body: _getMainBody(),
        menuBody: _getMenuBody(),
        appBar: _getAppBar(),
        duration: 600,
        menuSize: 0.7,
        isPanDisabled: false,
        isBackdropDisabled: false,
        shadow: BoxShadow(
            color: Colors.black45,
            offset: Offset(3.0, 0.0),
            spreadRadius: 10.0,
            blurRadius: 3.0),
        menuFriction: 0.3,
        direction: UTSDirection.horizontal,
        mode: UTSMode.right,
        curve: Curves.easeInOut,
        onOpen: () {
          //your code
        },
        onClose: () {
          // your code
        },
        onSlide: (dx) {
          // your code
        },
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  uts_sidemenu: ^1.0.1

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:uts_sidemenu/uts_sidemenu.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
54
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
77
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test

Admin