salah-rashad / flutter_context_menu

Create and display a customizable context menus in your app.
BSD 3-Clause "New" or "Revised" License
21 stars 7 forks source link

How to change the style of a certain menu item to a disabled state? #8

Open JackpotM1103 opened 6 months ago

JackpotM1103 commented 6 months ago

Is there any way to disable an item in the right-click menu? Just like the click event in flutter is assigned null After I assigned null to MenuItem, the style did not change.

MenuItem(
  label: 'xxx',
  icon: Icons.open_in_new,
  onSelected: item.data['source'] == 0 ? null : () {
    Provider.of<TreeModel>(context, listen: false)
      .loadAndSelectObject(item.data['source']);
  },
),
salah-rashad commented 1 week ago

I don't think I implemented this feature yet, but It will be in consideration. Thanks for letting me know.