drawer_master_detail 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 50

drawer_master_detail #

A new Flutter package to build a Drawer like Master Detail Page of Xamarin and Android Native Drawer.

Getting Started #

Usage Example #

import drawer_master_detail.dart

import 'package:drawer_master_detail/drawer_master_detail.dart';

Samples #

import 'package:drawer_master_detail/drawer_master_detail.dart';
import 'package:drawer_master_detail/model/drawer_master_item.dart';
import 'package:example_drawer_master_detail/src/pages/page_01.dart';
import 'package:example_drawer_master_detail/src/pages/page_02.dart';
import 'package:example_drawer_master_detail/src/pages/page_03.dart';
import 'package:flutter/material.dart';

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return DrawerMasterDetail(      
      selectedBackGroundColor: Colors.grey,
      drawerMasterItems: [
        DrawerMasterItem(page: Page01(),item:ListTile(title: Text("Page 01"),), selectedItem:ListTile(title: Text("Page 01" , style: TextStyle(color: Colors.white), ),) ),
        DrawerMasterItem(page: Page02(),item:ListTile(title: Text("Page 02"),)),
        DrawerMasterItem(page: Page03(),item:ListTile(title: Text("Page 03"),)),
        DrawerMasterItem.customItem(Divider(
          color: Colors.red,
        )),
        DrawerMasterItem(page: Page03(),item:ListTile(title: Text("Page 04"),) , appBar:AppBar(title: Text("Menu legal"),),),
        DrawerMasterItem(page: Page03(),item:ListTile(title: Text("Page 05"),)),
        DrawerMasterItem(page: Page03(),item:ListTile(title: Text("Page 06"),)),
        DrawerMasterItem(page: Page03(),item:ListTile(title: Text("Page 07"),)),        
        DrawerMasterItem(page: Page03(),item:ListTile(title: Text("Page 08"),)),
        DrawerMasterItem.customItem(Container(         
          child: Column(            
            children: <Widget>[            
              Divider(),
              Text("Titulo Diferente", style: TextStyle(color: Colors.grey),),            
            ],
          ),
        )),
        DrawerMasterItem(page: Page03(),item:ListTile(title: Text("Page 09"),)),
        DrawerMasterItem(page: Page03(),item:ListTile(title: Text("Page 10"),)),
        DrawerMasterItem(page: Page03(),item:ListTile(title: Text("Page 11"),)),
        DrawerMasterItem(page: Page03(),item:ListTile(title: Text("Page 12"),)),
        DrawerMasterItem(page: Page03(),item:ListTile(title: Text("Page 13"),)),
        DrawerMasterItem(page: Page03(),item:ListTile(title: Text("Page 14"),)),
      ],
      footer: Container(
        height: 50,
        alignment: Alignment.center,
        width: double.infinity,
        color: Colors.red,
        child: Text("Footer")),
   //   header: Text("Casa"),
      userAccountsDrawerHeader: UserAccountsDrawerHeader(
        accountEmail: Text("bwolfnoob@gmail.com"),
        accountName: Text("bwolf"),
        currentAccountPicture: CircleAvatar(
          child: Text("BW"),
          backgroundColor: Colors.yellowAccent,
        ),
      ),
      
      initPage: DrawerMasterItem(page: Page01(),item:ListTile(title: Text("Home Page"),) ),
    );
  }
}

Samples dynamicaly #


class HomeDynamicPage extends StatefulWidget {
  @override
  _HomeDynamicPageState createState() => _HomeDynamicPageState();
}

class _HomeDynamicPageState extends State<HomeDynamicPage> {
  var bloc = HomeDynamicModule.to.getBloc<HomeDynamicBloc>();

  @override
  Widget build(BuildContext context) {
    return DrawerMasterDetail(
      selectedBackGroundColor: Colors.grey,
      builder: () {

        // if (logged) {
        //    return
        //     [ DrawerMasterItem(
        //        page: Page01(),
        //        item: ListTile(
        //          title: Text("Page 01"),
        //        ),
        //        selectedItem: ListTile(
        //          title: Text(
        //            "Page 01",
        //            style: TextStyle(color: Colors.white),
        //          ),
        //        ),
        //      ),
        //      DrawerMasterItem(
        //        page: Page02(),
        //        item: ListTile(
        //          title: Text("Page 02"),
        //        ),
        //      ),
        //      DrawerMasterItem(
        //        page: Page03(),
        //        item: ListTile(
        //          title: Text("Page 03"),
        //        ),
        //      ),
        //     ];       
        //   } else {
        //     return [];
        // },
      
       
        return [
          DrawerMasterItem(
            page: Page01(),
            item: ListTile(
              title: Text("Page 01"),
            ),
            selectedItem: ListTile(
              title: Text(
                "Page 01",
                style: TextStyle(color: Colors.white),
              ),
            ),
          ),
          DrawerMasterItem(
            page: Page02(),
            item: ListTile(
              title: Text("Page 02"),
            ),
          ),
          DrawerMasterItem(
            page: Page03(),
            item: ListTile(
              title: Text("Page 03"),
            ),
          ),         
         //     ....
        ];
      },
      footer: Container(
          height: 50,
          alignment: Alignment.center,
          width: double.infinity,
          color: Colors.red,
          child: Text("Footer")),
      headerMenuBuilder: () {

       // if (logged) {
       //       return UserAccountsDrawerHeader(
       //         accountEmail: Row(
       //           children: <Widget>[
       //             Text("bwolfnoob@gmail.com"),
       //             Spacer(),
       //             FlatButton(
       //               onPressed: () {
       //                 bloc.logOut();
       //               },
       //               child: Text(
       //                 "LogOut",
       //                 style: TextStyle(color: Colors.white),
       //               ),
       //             )
       //           ],
       //         ),
       //         accountName: Text("bwolf"),
       //         currentAccountPicture: CircleAvatar(
       //           child: Text("BW"),
       //           backgroundColor: Colors.yellowAccent,
       //         ),
       //       );
       //     } else {
       //       return Container(
       //         height: 200,
       //         child: Column(
       //           mainAxisAlignment: MainAxisAlignment.center,
       //           crossAxisAlignment: CrossAxisAlignment.center,
       //           children: <Widget>[
       //             Text("You aren't logged"),
       //             RaisedButton(
       //               onPressed: () {
       //                 bloc.logIn();
       //               },
       //               child: Text("Login"),
       //             )
       //           ],
       //         ),
       //       );
       //     }
       //   },
       // );

        return StreamBuilder<bool>(
          stream: bloc.logged,
          builder: (BuildContext context, AsyncSnapshot snapshot) {
          
            if (!snapshot.hasData) {
              return CircularProgressIndicator();
            }

            if (snapshot.data) {
              return UserAccountsDrawerHeader(
                accountEmail: Row(
                  children: <Widget>[
                    Text("bwolfnoob@gmail.com"),
                    Spacer(),
                    FlatButton(
                      onPressed: () {
                        bloc.logOut();
                      },
                      child: Text(
                        "LogOut",
                        style: TextStyle(color: Colors.white),
                      ),
                    )
                  ],
                ),
                accountName: Text("bwolf"),
                currentAccountPicture: CircleAvatar(
                  child: Text("BW"),
                  backgroundColor: Colors.yellowAccent,
                ),
              );
            } else {
              return Container(
                height: 200,
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: <Widget>[
                    Text("You aren't logged"),
                    RaisedButton(
                      onPressed: () {
                        bloc.logIn();
                      },
                      child: Text("Login"),
                    )
                  ],
                ),
              );
            }
          },
        );
      },
      initPage: DrawerMasterItem(
          page: Page01(),
          item: ListTile(
            title: Text("Home Page"),
          )),
    );
  }
}

[0.1.1] - Add dynamics menus [0.0.1] - First Release but with good things

example/README.md

example_drawer_master_detail #

A new Flutter application.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

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

Use this package as a library

1. Depend on it

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


dependencies:
  drawer_master_detail: ^0.1.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:drawer_master_detail/drawer_master_detail.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
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]
50
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
rxdart ^0.22.1+1 0.22.4
uuid ^2.0.2 2.0.2
Transitive dependencies
charcode 1.1.2
collection 1.14.11 1.14.12
convert 2.1.1
crypto 2.1.3
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test