hasan-hm1 / circular_menu

A simple animated circular menu for Flutter, Adjustable radius, colors, alignment, animation curve and animation duration.
MIT License
99 stars 52 forks source link

CircularMenuItem not trigger onTab #13

Closed mahmood-heja closed 3 years ago

mahmood-heja commented 3 years ago

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),
                  ),
                ],
              )
hasan-hm1 commented 3 years ago

Hi @mahmood-heja Thanks for opening this issue and sorry for the late response, Problem Please notice that CircularMenuuses Stack and Transformwidget under the hood , When you tap on part of widget outside the original boundary lines, the parent widget thinks you are not hitting it (in your case the 60 * 60 container) since, you technically tapped outside the widget , this limitation is related to Transform widget please refer this , this and this . Solution Please make sure the backgroundWidget is big enough to transform the tappable area so tap is detected and onTap is triggered.