darioielardi / flutter_speed_dial

Flutter plugin to implement a Material Design Speed Dial
https://pub.dev/packages/flutter_speed_dial
MIT License
410 stars 177 forks source link

SpeedDial won't close #296

Closed SirioRigel closed 1 year ago

SirioRigel commented 1 year ago

So apparently the speedDial (which should close automatically) doesn't close at all when I click on a SpeedDialChild. Am I getting something wrong here ?. I'm using flutter_speed_dial 6.2.0 ( the latest version ). Here I have attached the code I'm using for the floating Action button using the SpeedDial object.

 floatingActionButton: SpeedDial(
        icon: Icons.add,
        activeIcon: Icons.close,
        spacing: 10,
        overlayOpacity: 0.3,
        children: [
          SpeedDialChild(
            label: "Add exercise",
            child: FloatingActionButton(
              child: const Icon(Icons.add_box_outlined),
              onPressed: () {
                addExercise();
              },
            )
          ),
          SpeedDialChild(
            label: "Add workout",
            child: FloatingActionButton(
              child: const Icon(Icons.add_circle_outline),
              onPressed: () => addWorkout(),
            )
          ),
          SpeedDialChild(
            label: "Abc",
            child: FloatingActionButton(
              onPressed: () {  },
              child: const Icon(Icons.abc)
            )
          )
        ]
      ),
SirioRigel commented 1 year ago

So I was using the onPressed function of the child (The Floating action button) instead of the onTap function of the SpeedDialChild. This means that, since the proper onTap function was not called, the SpeedDial wasn't closing .