A simple animated circular menu for Flutter, Adjustable radius, colors, alignment, animation curve and animation duration.

Overview

A simple animated circular menu for Flutter, Adjustable radius, colors, alignment, animation curve and animation duration.

pub package

bottom_center bottom_left bottom_right center center_left center_right top_center top_left top_right bottom_center

Getting Started

Installation

Add

 circular_menu : ^latest_version

to your pubspec.yaml, and run

flutter pub get

in your project's root directory.

Basic Usage

Import it to your project file

import 'package:circular_menu/circular_menu.dart';

And add it in it's most basic form :

final circularMenu = CircularMenu(items: [
    CircularMenuItem(icon: Icons.home, onTap: () {
      // callback
    }),
    CircularMenuItem(icon: Icons.search, onTap: () {
      //callback
    }),
    CircularMenuItem(icon: Icons.settings, onTap: () {
      //callback
    }),
    CircularMenuItem(icon: Icons.star, onTap: () {
      //callback
    }),
    CircularMenuItem(icon: Icons.pages, onTap: () {
      //callback
    }),
  ]);
  • There are additional optional parameters to initialize the menu with:
  final circularMenu = CircularMenu(
      // menu alignment
      alignment: Alignment.bottomCenter,
      // menu radius
      radius: 100,
      // widget in the background holds actual page content
      backgroundWidget: MyCustomWidget(),
      // global key to control the animation anywhere in the code.
      key: // GlobalKey<CircularMenuState>(),
      // animation duration
      animationDuration: Duration(milliseconds: 500),
      // animation curve in forward
      curve: Curves.bounceOut,
      // animation curve in reverse
      reverseCurve: Curves.fastOutSlowIn,
	    // first item angle
      startingAngleInRadian : 0 ,
    	// last item angle
      endingAngleInRadian : pi,
      // toggle button callback
      toggleButtonOnPressed: () {
        //callback
      },
      // toggle button appearance properties
      toggleButtonColor: Colors.pink,
      toggleButtonBoxShadow: [
              BoxShadow(
                color: Colors.blue,
                blurRadius: 10,
              ),
            ], 
      toggleButtonIconColor: Colors.white,
      toggleButtonMargin: 10.0,
      toggleButtonPadding: 10.0,
      toggleButtonSize: 40.0,
      items: [
        CircularMenuItem(
          // menu item callback
          onTap: () {
            // callback
          },
          // menu item appearance properties
          icon: Icons.home,
          color: Colors.blue,
          elevation: 4.0,
          iconColor: Colors.white,
          iconSize: 30.0,
          margin: 10.0,
          padding: 10.0,
          // when 'animatedIcon' is passed,above 'icon' will be ignored
           animatedIcon:// AnimatedIcon(),
        ),
        CircularMenuItem(
            icon: Icons.search,
            onTap: () {
              //callback
            }),
        CircularMenuItem(
            icon: Icons.settings,
            onTap: () {
              //callback
            }),
        CircularMenuItem(
            icon: Icons.star,
            onTap: () {
              //callback
            }),
        CircularMenuItem(
            icon: Icons.pages,
            onTap: () {
              //callback
            }),
      ]);
  • add badge to CircularMenuItem by setting the property enableBadge to true
CircularMenuItem(
              enableBadge: true,
            )
  • customize badge by setting the parameters badgeColor , badgeLabel , badgeRadius badgeTextColor , badgeRightOffet , badgeTopOffet , badgeBottomOffet , badgeLeftOffet badgeTextStyle to satisfy requirements .
CircularMenuItem(
              enableBadge: true,
              badgeColor: Colors.amber,
              badgeLabel: '3',
              badgeRadius: 15,
              badgeTextColor: Colors.white,
              badgeRightOffet: 0,
              badgeTopOffet: 0,
              onTap: () {
                print('badge on circular menu item');
              },
              icon: Icons.home,
              color: Colors.teal,
            )
  • control animation anywhere in your code using a key:
  GlobalKey<CircularMenuState> key = GlobalKey<CircularMenuState>();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.pink,
        title: Text(
          'Flutter Circular Menu',
          style: TextStyle(
            color: Colors.white,
          ),
        ),
      ),
      body: CircularMenu(
        alignment: Alignment.bottomCenter,
        startingAngleInRadian: 1.25 * pi,
        endingAngleInRadian: 1.75 * pi,
        backgroundWidget: Center(
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: <Widget>[
              MaterialButton(
                onPressed: () {
                  key.currentState.forwardAnimation();
                },
                color: Colors.pink,
                shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(15)),
                padding: const EdgeInsets.all(15),
                child: Text(
                  'forward',
                  style: TextStyle(
                    color: Colors.white,
                    fontSize: 24,
                  ),
                ),
              ),
              MaterialButton(
                onPressed: () {
                  key.currentState.reverseAnimation();
                },
                shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(15)),
                padding: const EdgeInsets.all(15),
                color: Colors.pink,
                child: Text(
                  'reverse',
                  style: TextStyle(
                    color: Colors.white,
                    fontSize: 24,
                  ),
                ),
              ),
            ],
          ),
        ),
        key: key,
        items: [
          CircularMenuItem(
            icon: Icons.home,
            onTap: () {},
            color: Colors.green,
            iconColor: Colors.white,
          ),
          CircularMenuItem(
            icon: Icons.search,
            onTap: () {},
            color: Colors.orange,
            iconColor: Colors.white,
          ),
          CircularMenuItem(
            icon: Icons.settings,
            onTap: () {},
            color: Colors.deepPurple,
            iconColor: Colors.white,
          ),
        ],
      ),
    );
  }
}
  • use MultiCircularMenu to show more than one menu in the same widget :
MultiCircularMenu(
          backgroundWidget: Center(
            child: Text(
              "Flutter Circular Menu",
              style: TextStyle(
                fontWeight: FontWeight.bold,
                fontSize: 25,
              ),
            ),
          ),
          menus: [
            CircularMenu(
                toggleButtonColor: Colors.pink,
                alignment: Alignment.bottomLeft,
                items: [
                  CircularMenuItem(
                    onTap: () {
                      print('tapped');
                    },
                    icon: Icons.search,
                    color: Colors.blue,
                  ),
                  CircularMenuItem(
                    onTap: () {
                      print('tapped');
                    },
                    icon: Icons.home,
                    color: Colors.grey,
                  ),
                  CircularMenuItem(
                    onTap: () {
                      print('tapped');
                    },
                    icon: Icons.settings,
                    color: Colors.green,
                  ),
                ]),
            CircularMenu(
                toggleButtonColor: Colors.deepPurpleAccent,
                alignment: Alignment.bottomRight,
                items: [
                  CircularMenuItem(
                    onTap: () {
                      print('tapped');
                    },
                    icon: Icons.save,
                    color: Colors.teal,
                  ),
                  CircularMenuItem(
                    onTap: () {
                      print('tapped');
                    },
                    icon: Icons.filter,
                    color: Colors.amber,
                  ),
                  CircularMenuItem(
                    onTap: () {
                      print('tapped');
                    },
                    icon: Icons.star_border,
                    color: Colors.lightGreen,
                  ),
                ]),
          ])

Comments
  • CircularMenuItem onTap not working

    CircularMenuItem onTap not working

    I tried out the package with image selection app. Both of these approaches were used, onTap: () => getImage(ImageSource.gallery) onTap (){getImage(ImageSource.camera)} but none trigger getImage method.

    opened by ebena107 3
  • Wrong Button OnTap When radius <75

    Wrong Button OnTap When radius <75

    hi,

    I found your widget have a bug, the on tap function button execute wrong button when CircularMenu Radius < 75.

    Screen Shot 2020-05-20 at 22 13 05

    When I tapped on black area on red button that execute orange button onTap.

    btw thank you for great widget

    opened by jemariads 2
  • CircularMenuItem not trigger onTab

    CircularMenuItem not trigger onTab

    when try to a test the onTap for CircularMenuItem not called

    CircularMenu(
                    toggleButtonIconColor: ColorsHelper.BUTTON_COLOR,
                    backgroundWidget: Container(
                      height: 60,
                      width: 60,
                    ),
                    toggleButtonSize: 16,
                    animationDuration: Duration(milliseconds: 500),
                    startingAngleInRadian: pi,
                    endingAngleInRadian: 1.5 * pi,
                    radius: 70,
                    curve: Curves.bounceOut,
                    reverseCurve: Curves.fastOutSlowIn,
                    alignment: Alignment.center,
                    toggleButtonBoxShadow: [
                      BoxShadow(
                        color: ColorsHelper.BUTTON_COLOR,
                        blurRadius: 10,
                      ),
                    ],
                    toggleButtonColor: Colors.white,
                    items: [
                      CircularMenuItem(
                        color: Colors.white,
                        iconColor: ColorsHelper.MENU_ICON_COLOR,
                        iconSize: 24,
                        icon: Icons.download_sharp,
                        onTap: () => downloadApk(app),
                      ),
                      CircularMenuItem(
                        iconSize: 24,
                        color: Colors.white,
                        iconColor: ColorsHelper.MENU_ICON_COLOR,
                        icon: Icons.share,
                        onTap: () {
                          print("Share");
                          //callback
                        },
                      ),
                      CircularMenuItem(
                        iconSize: 24,
                        color: Colors.white,
                        iconColor: ColorsHelper.MENU_ICON_COLOR,
                        icon: Icons.edit,
                        onTap: () => openAppDetail(app),
                      ),
                    ],
                  )
    
    opened by mahmood-heja 1
  • Starting/Ending Angle Doesn't Change Upon Rebuild

    Starting/Ending Angle Doesn't Change Upon Rebuild

    The starting and ending angles of the Circular Menu are not reflected during hot reload or if a rebuild occurs. They're only reflected during a hot restart or rerunning the application.

    I have a case where based on the language chosen the button moves from bottomRight to bottomLeft and so the angles have to be reflected. The button moves to the other side, but the initial angles remain the same even though I have an if condition to change them during the rebuild.

    Also, the Widget does not automatically change based on the application RTL/LTR.

    opened by kareem-darwinz 1
  • Use the circular_menu in appbar

    Use the circular_menu in appbar

    Hi, Can I use the circular_menu widget in the app bar, I have a IconButton upon which I open a PopupMenuButton, but this formation looks old in front of your widget please guide me how can I use this widget in the app bar.

    Thanks,

    question 
    opened by areeba-arshad 1
  • [Question] Can it be use in ListView?

    [Question] Can it be use in ListView?

    Hi @hasan-hm1 ,

    This is a very cool widget!

    Can we use this in a list view? In my list view, I have ListTile as list item, can I place this menu in the list item?

    Thanks in advance.

    opened by jasonlaw 1
  • Feature Request: Add a submenu

    Feature Request: Add a submenu

    I'd like to have an option to also add a CircularMenu as item. That way I might be able to pop out the first level of menus and when clicking one item it will pop out the second level of menu. I am not sure how complicated it is to make this happen?

    opened by xetra11 0
  • how to change the three stripes icon?

    how to change the three stripes icon?

    Hello bro, your plugin is so beutiful and I would like to use for my project, but I would like to change the icon of your main menu, could i change it? and how? image

    opened by DanteAlucard98 0
  • New Requirement: When Click a CircularMenuItem then reduce Circular to its original state

    New Requirement: When Click a CircularMenuItem then reduce Circular to its original state

    Hello, I like very much your circular_menu. Is it possible to add a boolean trigger in the CircularMenuItem which indicates the CircularMenu Button to close/reduce to its original (not clicked) state? Many Thanks Roman

    opened by securexperts 1
  • How To Implement in Bottom Navigation Bar

    How To Implement in Bottom Navigation Bar

    Thank you for the incredible work. Is there any way to implement this plugin into the Bottom Navigation Bar?

    Screen Shot 2022-07-22 at 11 08 03

    Right now I did like this, but actually, it was separated by the Bottom Nav Bar. The goal is that the toggle button should have the same color and text like nav bar.

    Thankyou Ofid

    opened by f1dz 0
  • Upgrade for Flutter 3.0

    Upgrade for Flutter 3.0

    the widget uses inside a stack that no longer has the overflow property starting from Flutter 3.0. Consequently, during the build phase, the Circular Menu does not recognize the Stack and produces an error. I tried to add // near the overflow property in Circular Menu and worked fine.

    opened by salvatoremiccio 0
Owner
Hasan Mohammed
Hasan Mohammed
Circular Reveal Animation as Flutter widget!

Circular Reveal Animation Circular Reveal Animation as Flutter widget! Inspired by Android's ViewAnimationUtils.createCircularReveal(...). Статья с оп

Alexander Zhdanov 48 Aug 15, 2022
An animated menu with both RTL and LTR direction support

animated_menu A new Flutter package project. Getting Started This project is a starting point for a Dart package, a library module containing code tha

Persian Flutter Community 5 Jan 31, 2022
Animated Menu in Flutter using radial.

Animated_radial_Menu_in_Flutter Animated Menu in Flutter using radial. Getting Started This project is a starting point for a Flutter application. A f

Habib ullah 4 Jul 18, 2022
Flutter-animated-ui-space-app - ⚡Animated UI Space App Challenge Part 5 🐱‍👤🐱‍👤

Flutter-animated-ui-space-app ?? ?? Project img : Image Challenge Code Image Note !! : Please include your photos to show and install simple_animation

Hmida 7 Sep 15, 2022
Flutter animation tutorials, such common animation, flare animation.

❤️ Star ❤️ the repo to support the project or ?? Follow Me.Thanks! Facebook Page Facebook Group QQ Group Developer Flutter Open Flutter Open 963828159

Flutter开源社区 123 Sep 3, 2022
Flutter animation tutorials, such common animation, flare animation.

❤️ Star ❤️ the repo to support the project or ?? Follow Me.Thanks! Facebook Page Facebook Group QQ Group Developer Flutter Open Flutter Open 963828159

Flutter开源社区 123 Sep 3, 2022
🐱‍👤 Flutter-Animation 🔥 🔥 List Animated Staggered Animations

??‍?? Staggered Animations made with algeria ❤

Hmida 17 Nov 22, 2022
Flutter's core Dropdown Button widget with steady dropdown menu and many options you can customize to your needs.

Flutter DropdownButton2 Intro Flutter's core Dropdown Button widget with steady dropdown menu and many options you can customize to your needs. Featur

AHMED ELSAYED 125 Jan 4, 2023
Like Button is a flutter library that allows you to create a button with animation effects similar to Twitter's heart when you like something and animation effects to increase like count.

like_button Language: English | 中文简体 Like Button is a flutter library that allows you to create a button with animation effects similar to Twitter's h

FlutterCandies 357 Dec 27, 2022
Beautiful Animated ListView and GridView

staggered_animated_listview Beautiful Animated ListView and GridView Online Preview Getting Started This project is a starting point for a Flutter app

Elyas Sekhavati Nia 1 Dec 11, 2021
A Flutter library that makes animation easer. It allows for separation of animation setup from the User Interface.

animator This library is an animation library for Flutter that: makes animation as simple as the simplest widget in Flutter with the help of Animator

MELLATI Fatah 225 Dec 22, 2022
BKash-Ballance-Animation - BKash Ballance Animation For Flutter

BKash-Ballance-Animation before clone the GitHub repository please give a star o

Blackshadow Software Ltd 11 Sep 1, 2022
Fisherman-Fishing-Animation - Fisherman Fishing Animation With Flutter

Fisherman Fishing Animation before clone the GitHub repository please give a sta

Blackshadow Software Ltd 9 Oct 27, 2022
Nubank card animation - Nubank card animation built with flutter

Nubank card animation Project | Technologies | How to run | How to contribute ??

Lucas da Silva Barbosa 8 Nov 6, 2022
Fade animation - Add fade animation to your app easily

fade_animation Add fade animation to your app easily using simple_animations pac

Mazouzi Aymene 3 Oct 6, 2022
✨ A collection of loading indicators animated with flutter. Heavily Inspired by http://tobiasahlin.com/spinkit.

✨ Flutter Spinkit A collection of loading indicators animated with flutter. Heavily inspired by @tobiasahlin's SpinKit. ?? Installing dependencies:

Jeremiah Ogbomo 2.7k Dec 30, 2022
Cool 3D Drawer Animated With flutter part 2 🔥 🔥

Cool 3D Drawer Animated With flutter part 2 ?? ??

Hmida 12 Nov 22, 2022
A beautiful animated flutter widget package library. The tab bar will attempt to use your current theme out of the box, however you may want to theme it.

Motion Tab Bar A beautiful animated widget for your Flutter apps Preview: | | Getting Started Add the plugin: dependencies: motion_tab_bar: ^0.1.5 B

Rezaul Islam 237 Nov 15, 2022
Animated Backgrounds for Flutter.

Animated Backgrounds for Flutter Animated Backgrounds for Flutter. Easily extended to paint whatever you want on the canvas. Note: These examples are

André Baltazar 168 Nov 27, 2022