fab_circular_menu 0.1.4

FAB Circular Menu #

Pub Pull Requests are welcome Pull Requests are welcome Codemagic build status

A Flutter package to create a nice circular menu using a Floating Action Button.

Inspired by Mayur Kshirsagar's great FAB Microinteraction design.

Showcase

Getting started #

Wrap your content with FabCircularMenu and set your desired options:

MaterialApp(
  home: Scaffold(
    body: FabCircularMenu(
      child: Placeholder(), // Replace this with your content
      options: <Widget>[
        IconButton(icon: Icon(Icons.home), onPressed: () {
          print('Pressed!');
        })
      ]
    )
  )
)

Options #

PropertyTypeDescriptionDefaultCaveat
childWidgetThe child of this widget-
optionsListThe available options of the menu-
ringColorColorThe color of the ringColors.white
ringDiameterdoubleThe diameter of the ringscreenWidth * 1.2
ringWidthdoubleThe width of the ringringDiameter / 3
fabMarginEdgeInsetsThe margin around the FABEdgeInsets.all(24.0)
fabColorColorThe color of the FABprimaryColor
fabOpenColorColorThe color of the FAB when openedprimaryColorWill override fabColor for open state
fabCloseColorColorThe color of the FAB when closedprimaryColorWill override fabColor for close state
fabOpenIconIconThe open iconIcon(Icons.menu)
fabCloseIconIconThe close iconIcon(Icons.close)
animationDurationDurationThe animation durationDuration(milliseconds: 800)
onDisplayChangeFunctionA callback called when the open/close state changesFunction

0.1.4 #

  • #7 Add Close Color option and open/close change callback

0.1.3 #

  • Bugfixes
  • Improved animation

0.1.2 #

  • Fixes multiple tickers error

0.1.1 #

  • Added an example

0.1.0 #

  • First functional release.

example/lib/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: FabCircularMenu(
          child: Container(
            color: Colors.indigo[900],
            child: Center(
                child: Padding(
                  padding: const EdgeInsets.only(bottom: 256.0),
                  child: Text(
                      'FAB Circle Menu Example',
                      textAlign: TextAlign.center,
                      style: TextStyle(color: Colors.white, fontSize: 36.0)
                  ),
                )
            ),
          ),
          ringColor: Colors.white30,
          options: <Widget>[
            IconButton(icon: Icon(Icons.widgets), onPressed: () {}, iconSize: 48.0, color: Colors.white),
            IconButton(icon: Icon(Icons.widgets), onPressed: () {}, iconSize: 48.0, color: Colors.white),
            IconButton(icon: Icon(Icons.widgets), onPressed: () {}, iconSize: 48.0, color: Colors.white),
            IconButton(icon: Icon(Icons.widgets), onPressed: () {}, iconSize: 48.0, color: Colors.white),
          ],
        ),
      ),
    );
  }

}

Use this package as a library

1. Depend on it

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


dependencies:
  fab_circular_menu: ^0.1.4

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:fab_circular_menu/fab_circular_menu.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
96
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]
98
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Health suggestions

Format lib/fab_circular_menu.dart.

Run flutter format to format lib/fab_circular_menu.dart.

Dependencies

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