Giter Club home page Giter Club logo

circular_menu's Introduction

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,
                  ),
                ]),
          ])

circular_menu's People

Contributors

hasan-hm1 avatar zeusbaba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

circular_menu's Issues

Icon

How can i change a menu icon

Widget instead of animated icon data

Animated icons are only few and I prefer to use my own icon.

In my case I want to show Mobile as main icon and the user can select whether to call or Whatsapp or whatever else similar.

Dart null support

Just wondering, if anyone is working on a null support version of this? Thank you

How to add tooltip for items?

I want to show a hint like a tooltip widget for each item. How to do this?

At this moment I need to edit the file at pub.dev\circular_menu-2.0.1\lib\src\circular_menu_item.dart about CircularMenuItem class for adding the Tooltip widget.

like this code below:

import 'package:flutter/material.dart';

class CircularMenuItem extends StatelessWidget {
  /// if icon and animatedIcon are passed, icon will be ignored
  final IconData? icon;
  final Color? color;
  final Color? iconColor;
  final VoidCallback onTap;
  final double iconSize;
  final double padding;
  final double margin;
  final List<BoxShadow>? boxShadow;
  final bool enableBadge;
  final double? badgeRightOffet;
  final double? badgeLeftOffet;
  final double? badgeTopOffet;
  final double? badgeBottomOffet;
  final double? badgeRadius;
  final TextStyle? badgeTextStyle;
  final String? badgeLabel;
  final Color? badgeTextColor;
  final Color? badgeColor;
  final String? toolTip;

  /// if animatedIcon and icon are passed, icon will be ignored
  final AnimatedIcon? animatedIcon;

  /// creates a menu item .
  /// [onTap] must not be null.
  /// [padding] and [margin]  must be equal or greater than zero.
  CircularMenuItem({
    required this.onTap,
    this.icon,
    this.color,
    this.iconSize = 30,
    this.boxShadow,
    this.iconColor,
    this.animatedIcon,
    this.padding = 10,
    this.margin = 10,
    this.enableBadge = false,
    this.badgeBottomOffet,
    this.badgeLeftOffet,
    this.badgeRightOffet,
    this.badgeTopOffet,
    this.badgeRadius,
    this.badgeTextStyle,
    this.badgeLabel,
    this.badgeTextColor,
    this.badgeColor,
    this.toolTip,
  })  : assert(padding >= 0.0),
        assert(margin >= 0.0);

  Widget _buildCircularMenuItem(BuildContext context) {
    final child = Container(
      margin: EdgeInsets.all(margin),
      decoration: BoxDecoration(
        color: Colors.transparent,
        boxShadow: boxShadow ??
            [
              BoxShadow(
                color: color ?? Theme.of(context).primaryColor,
                blurRadius: 10,
              ),
            ],
        shape: BoxShape.circle,
      ),
      child: ClipOval(
        child: Material(
          color: color ?? Theme.of(context).primaryColor,
          child: InkWell(
            child: Padding(
              padding: EdgeInsets.all(padding),
              child: animatedIcon == null
                  ? Icon(
                icon,
                size: iconSize,
                color: iconColor ?? Colors.white,
              )
                  : animatedIcon,
            ),
            onTap: onTap,
          ),
        ),
      ),
    );
    return toolTip == null ? child : Tooltip(message: toolTip!, child: child);
  }

  Widget _buildCircularMenuItemWithBadge(BuildContext context) {
    return _Badge(
      color: badgeColor,
      bottomOffset: badgeBottomOffet,
      rightOffset: badgeRightOffet,
      leftOffset: badgeLeftOffet,
      topOffset: badgeTopOffet,
      radius: badgeRadius,
      textStyle: badgeTextStyle,
      onTap: onTap,
      textColor: badgeTextColor,
      label: badgeLabel,
      child: _buildCircularMenuItem(context),
    );
  }

  @override
  Widget build(BuildContext context) {
    return enableBadge
        ? _buildCircularMenuItemWithBadge(context)
        : _buildCircularMenuItem(context);
  }
}

class _Badge extends StatelessWidget {
  const _Badge({
    Key? key,
    required this.child,
    required this.label,
    this.color,
    this.textColor,
    this.onTap,
    this.radius,
    this.bottomOffset,
    this.leftOffset,
    this.rightOffset,
    this.topOffset,
    this.textStyle,
  }) : super(key: key);

  final Widget child;
  final String? label;
  final Color? color;
  final Color? textColor;
  final Function? onTap;
  final double? rightOffset;
  final double? leftOffset;
  final double? topOffset;
  final double? bottomOffset;
  final double? radius;
  final TextStyle? textStyle;

  @override
  Widget build(BuildContext context) {
    return Stack(
      alignment: Alignment.center,
      clipBehavior: Clip.none,
      children: [
        child,
        Positioned(
          right: (leftOffset == null && rightOffset == null) ? 8 : rightOffset,
          top: (topOffset == null && bottomOffset == null) ? 8 : topOffset,
          left: leftOffset,
          bottom: bottomOffset,
          child: FittedBox(
            child: GestureDetector(
              onTap: onTap as void Function()? ?? () {},
              child: CircleAvatar(
                maxRadius: radius ?? 10,
                minRadius: radius ?? 10,
                backgroundColor: color ?? Theme.of(context).primaryColor,
                child: FittedBox(
                  child: Text(
                    label ?? '',
                    textAlign: TextAlign.center,
                    style: textStyle ??
                        TextStyle(
                            fontSize: 10,
                            color: textColor ??
                                Theme.of(context).colorScheme.secondary),
                  ),
                ),
              ),
            ),
          ),
        )
      ],
    );
  }
}

Image as icon, close menu ontap

Hi, i been trying this menu, seems really great, but i can also see its been some times since anyone updated it.

Its not possible to add a image as a icon on the CircularMenuItem?

Is it possible to close the circular menu when user click a CircularMenuItem item?

I just cant seem to find this.

Reopen Issue #34: Grey Overlay on circular menu button

Hello,

I like to reopen my Issue.

#34

As of today the new version of Flutter / Dart has been promoted
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.22.0, on macOS 14.4.1 23E224 darwin-arm64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2024.1.1)
[✓] Connected device (4 available)
[✓] Network resources

The Plugin has stopped working when promoting it to TestFlight on Apple App Store

Please Correct this as soon as possible

Thanks

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

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?

Custom icons

Would be nice if i could use my own icons on closed and opened CircularMenu.

Grey overlay over the whole Screen on iOS in Production mode (not in Debug mode)!

Hi,
I have used your plugin since a wile. Now I must upgrade it to the latest Version and face an issue on iOS:
Running the App In IDE with Simulator or iOS in debug mode everything works fine and screens are displayed as expected.
As soon I push the App to Production on Apple Store I get a grey screen overlay on top of the Screen. Guestures do not work in this area.

When I set a normal FAB its displaying fine

floatingActionButtonLocation: Platform.isIOS
  ? FloatingActionButtonLocation.centerDocked
  : FloatingActionButtonLocation.centerFloat,
floatingActionButton: FloatingActionButton(
  backgroundColor: _color,
  onPressed: () {
    if (kDebugMode) {
      print('Pressed 999');
    }
    trailsAreLoaded = false;
    trailsProvider.disableActiveTrail();
  },
  child: const Icon(Icons.exit_to_app), // customize the icon as needed
),

IMG_2107

When configuring Circular Menu FAB the Problem comes up to the Screen in production mode:

floatingActionButtonLocation: Platform.isIOS
  ? FloatingActionButtonLocation.centerDocked
  : FloatingActionButtonLocation.centerFloat,
floatingActionButton: CircularMenu(
   //alignment: Alignment.bottomCenter,
   //toggleButtonColor: Theme.of(context).primaryColor.withOpacity(0.6),
   toggleButtonAnimatedIconData: AnimatedIcons.menu_close,
   items: [
     CircularMenuItem(
       color: Colors.transparent,
       onTap: () {}
     ),
     CircularMenuItem(
       icon: Icons.directions_walk,
       color: _color,
       onTap: () {
         setState(() {
           if (_colorIsActive == true){
             _colorIsActive = false;
           } else {
            _colorIsActive = true;
           }
           trackUserLocation = !trackUserLocation;
           if (kDebugMode) {
             print('OnTap_001.1: $trackUserLocation');
           }
         });
       }
     ),
     CircularMenuItem(
       icon: Icons.add_location,
       color: Theme.of(context).primaryColor.withOpacity(0.6),
       onTap: () {
        setState(()  {
          setCameraPosition();
          if (kDebugMode) {
            print('OnTap_001.2');
          }
        });
      }
    ),
    CircularMenuItem(
      color: Colors.transparent,
      onTap: () {}
    ),
  ],
),

IMG_2106

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,

ontab fungerar inte

class _CircleButtonState extends State {
_CircleButtonState();

void setstateham() {
setState(() {

});

}
@OverRide
Widget build(BuildContext context) {
final double tophe = MediaQuery.of(context).padding.top;
final pro = Provider.of(context);
US(context);

GlobalKey<CircularMenuState> key = GlobalKey<CircularMenuState>();
return Scaffold(
  backgroundColor: pro.mainColor,
  body: CircularMenu(
    toggleButtonSize: 25.0,
    toggleButtonColor: pro.backColor_jinblue,
    toggleButtonIconColor: Colors.white,
    startingAngleInRadian: 0.45 * 3.14,
    endingAngleInRadian: 0.95 *  3.14,
    toggleButtonOnPressed: (){},
    key: key,
    items: [
      CircularMenuItem(
        icon: Icons.settings,
        onTap: () {
          pro.changeMainColor();
          print('click1');
          setstateham();
        },
        color: pro.backColor_jinblue,
        iconColor: Colors.white,
      ),
      CircularMenuItem(
        icon: Icons.info_outline_rounded,
        onTap: () {
          pro.changeMainColor();
          print('click2');
          setstateham();
        },
        color: pro.backColor_jinblue,
        iconColor: Colors.white,
      ),
      CircularMenuItem(
        icon: Icons.invert_colors,
        onTap: () {
          pro.changeMainColor();
          print('click3');
          setstateham();
        },

        color: pro.backColor_jinblue,
        iconColor: Colors.white,
      ),

    ],
  ),
);

}
}

Oavsett hur mycket ontab trycks ner händer ingenting.
toggleButtonOnPressed: (){}, fungerar bra
Animeringen av CircularMenuItem som utvecklas fungerar också.
Men när jag lägger in någon funktion eller åtgärd i onTap händer ingenting.
Det finns inget fel och det finns ingen logg som visar att beröringen har gått förlorad. Endast ViewPostIme-pekare 1 och ViewPostIme-pekare 0 som indikerar att någon del av skärmen berördes upprepas.

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.

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.

[question] How to disable an item

Hi,
First thanks for your work on this package.

Currently I'm using CircularMenu with dynamic items (some options are available or not according to the current context displayed). Of course I could add items dynamically, but in some context only one item would have been displayed which is awful and impossible as CircularMenu needs at least 2 items. As my total number of items are fixed, I'd like to disable some items and I tried to set onTap: null but this is not possible.

I perhaps miss something but is there a way to disable an item:

  • no ink if the user try to click on a disabled item
  • a disable color
    Or perhaps is it planned?

Thanks for your answer

[Question] : Icon not visible

I'm contacting you because I can't get the icons to appear using circularMenuItems.

I've had a good look at the documentation, but I don't understand what I'm doing wrong.

image

Thank you in advance for your help,

The version 4.0.0 of cicular_menu id used.

flutter doctor

┌─────────────────────────────────────────────────────────┐
│ A new version of Flutter is available!                  │
│                                                         │
│ To update to the latest version, run "flutter upgrade". │
└─────────────────────────────────────────────────────────┘
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.22.1, on macOS 14.5 23F79 darwin-arm64, locale fr-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2024.1.4)
[✓] VS Code (version 1.91.1)
[✓] Connected device (5 available)
[✓] Network resources

• No issues found!
CircularMenu(
                        toggleButtonColor: Colors.transparent,
                        alignment: Alignment.topRight,
                        backgroundWidget: const Icon(
                          Icons.menu,
                          color: Colors.white,
                          size: 30,
                        ),
                        items: [
                          CircularMenuItem(
                            iconColor: Colors.white,
                            icon: Icons.leaderboard,
                            iconSize: 20,
                            animatedIcon: null,
                            onTap: () => Navigator.pushNamed(
                              context,
                              Routes.leaderboard,
                              arguments: {
                                'user': widget.user,
                                'company': widget.company
                              },
                            ),
                          ),
                          CircularMenuItem(
                            iconColor: Colors.white,
                            icon: Icons.leaderboard,
                            animatedIcon: null,
                            iconSize: 20,
                            onTap: () => Navigator.pushNamed(
                              context,
                              Routes.settings,
                              arguments: {
                                'user': widget.user,
                                'company': widget.company
                              },
                            ),
                          ),
                          ],
                      )
                      ```

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.

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

Change the initial settings icon

Hey, thank you very much for that amazing work.

I would be interested to change the initial menu button but could not find the right icon parameter.
grafik

Could you give a parameter to change this icon?

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),
                  ),
                ],
              )

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

Need an option to add my own custom widget with my own icon image

Hi just a question for my particular use case,

I want to add my own widget to the CircularMenuItem list [ ] , which only accepts type "CircularMenuItem"

I want to draw my own widget there ... My widget will not contain an icon but a customised container with a small png image.asset circular etc...then i just wana pass my images in.
currently the CircularMenuItem class just accepts constructs that use icons essentially.
which is fine , however can it be overridden ?

I tried modifying your list's type like this List<CircularMenuItem || Widget> ... so I could pass your class or pass any widget of my own

still does not seem to work.

also tried copying the CircularMenuItem.dart to my local lib and using the
import "...." hide CircularMenuItem; on your class
and import "myfile.dart" show CircularMenuItem;
and just overriding the build method in my class ...but dart still complains that the class exists in both places ... I really thought that will work as thats the purpose of show and hide right?

sorry for the long story ...

is there a way I can achieve this ... I love the menu animation and how slick it looks and its perfect for my project...just can't get around this part of customising the list to show my own widgets when the menu opens.

will it be possible to change the lib to accept a custom widget. ?

any help will be appreciated.

Thanks and regards.

update:
I managed to get this working ... like this for now (it's hacky)
added a new String field
String? IconImagePath to circular_menu_item.dart.

then I call the class like this
CircularMenuItem( onTap: (){}, iconImagePath: "assets/images/whatever.png" )

so when the @ ternary check in the ClipOval() I just commented out icon code and used an image asset placeholder instead.
maybe the code can be updated to check if the user wants to pass his own image...then check if its passed and either use icon way or custom image way. (like in a new version)

code snip
child: ClipOval( child: Material( color: color ?? Theme.of(context).primaryColor, child: InkWell( child: Padding( padding: EdgeInsets.all(padding), child: animatedIcon == null ? Image.asset( iconImagePath ?? "assets/images/placeholder.png", fit: BoxFit.contain, width: 50, height: 50, ) // ? Icon( // icon, // size: iconSize, // color: iconColor ?? Colors.white, // ) : animatedIcon, ),
end code snip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.