kf_drawer 1.1.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 82

Flutter side menu (Drawer)

Getting Started #

Use KFDrawer widget as Scaffold's body with items property (List<KFDrawerItem>)

you should define onPressed on KFDrawerItem

KFDrawer properties
  • controller (optional)
  • header
  • footer
  • items (optional if controller defined)
  • decoration

or set drawer items with controller (KFDrawerController)

define page property on KFDrawerItem

KFDrawerController properties
  • initialPage
  • items
Drawer page widget should extend KFDrawerContent widget
You can use ClassBuilder for string based class init

Example #

class MainWidget extends StatefulWidget {
  @override
  _MainWidgetState createState() => _MainWidgetState();
}

class _MainWidgetState extends State<MainWidget> {
  KFDrawerController _drawerController;

  @override
  void initState() {
    super.initState();
    _drawerController = KFDrawerController(
      initialPage: ClassBuilder.fromString('MainPage'),
      items: [
        KFDrawerItem.initWithPage(
          text: Text('MAIN', style: TextStyle(color: Colors.white)),
          icon: Icon(Icons.home, color: Colors.white),
          page: MainPage(),
        ),
        KFDrawerItem.initWithPage(
          text: Text(
            'CALENDAR',
            style: TextStyle(color: Colors.white),
          ),
          icon: Icon(Icons.calendar_today, color: Colors.white),
          page: CalendarPage(),
        ),
        KFDrawerItem.initWithPage(
          text: Text(
            'SETTINGS',
            style: TextStyle(color: Colors.white),
          ),
          icon: Icon(Icons.settings, color: Colors.white),
          page: ClassBuilder.fromString('SettingsPage'),
        ),
      ],
    );
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: KFDrawer(
        controller: _drawerController,
        header: Align(
          alignment: Alignment.centerLeft,
          child: Container(
            padding: EdgeInsets.symmetric(horizontal: 16.0),
            width: MediaQuery.of(context).size.width * 0.6,
            child: Image.asset(
              'assets/logo.png',
              alignment: Alignment.centerLeft,
            ),
          ),
        ),
        footer: KFDrawerItem(
          text: Text(
            'SIGN IN',
            style: TextStyle(color: Colors.white),
          ),
          icon: Icon(
            Icons.input,
            color: Colors.white,
          ),
          onPressed: () {
            Navigator.of(context).push(CupertinoPageRoute(
              fullscreenDialog: true,
              builder: (BuildContext context) {
                return AuthPage();
              },
            ));
          },
        ),
        decoration: BoxDecoration(
          gradient: LinearGradient(
            begin: Alignment.topLeft,
            end: Alignment.bottomRight,
            colors: [Color.fromRGBO(255, 255, 255, 1.0), Color.fromRGBO(44, 72, 171, 1.0)],
            tileMode: TileMode.repeated,
          ),
        ),
      ),
    );
  }
}

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.

example/README.md

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:
  kf_drawer: ^1.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:kf_drawer/kf_drawer.dart';
  
Version Uploaded Documentation Archive
1.1.1 Jun 7, 2019 Go to the documentation of kf_drawer 1.1.1 Download kf_drawer 1.1.1 archive
1.1.0 May 17, 2019 Go to the documentation of kf_drawer 1.1.0 Download kf_drawer 1.1.0 archive
1.0.0 Mar 20, 2019 Go to the documentation of kf_drawer 1.0.0 Download kf_drawer 1.0.0 archive
0.0.2 Mar 4, 2019 Go to the documentation of kf_drawer 0.0.2 Download kf_drawer 0.0.2 archive
0.0.1 Mar 4, 2019 Go to the documentation of kf_drawer 0.0.1 Download kf_drawer 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
75
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
75
Overall:
Weighted score of the above. [more]
82
Learn more about scoring.

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

  • Dart: 2.3.2
  • pana: 0.12.18
  • Flutter: 1.5.4-hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/kf_drawer.dart. (-1.99 points)

Analysis of lib/kf_drawer.dart reported 4 hints:

line 16 col 7: This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: KFDrawerContent.onMenuPressed

line 25 col 7: This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: KFDrawer.header, KFDrawer.footer, KFDrawer.decoration, KFDrawer.items, KFDrawer.controller, KFDrawer.drawerWidth, KFDrawer.minScale, KFDrawer.borderRadius, KFDrawer.shadowBorderRadius, KFDrawer.shadowOffset, KFDrawer.scrollable, KFDrawer.menuPadding, KFDrawer.disableContentTap

line 272 col 7: This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: _KFDrawer.header, _KFDrawer.footer, _KFDrawer.items, _KFDrawer.decoration, _KFDrawer.scrollable, _KFDrawer.padding, _KFDrawer.animationController

line 353 col 7: This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: KFDrawerItem.onPressed, KFDrawerItem.text, KFDrawerItem.icon, KFDrawerItem.alias, KFDrawerItem.page

Maintenance issues and suggestions

Support latest dependencies. (-5 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.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