skip to Main Content

I need to show handicon when hover over the menu items.I tried with SystemMouseCursors.click but it didn’t works.It still show cursor

enter image description here

void showPopUpMenuAtTap(BuildContext context, TapDownDetails details,controller) {
    showMenu(
      context: context,
      position: RelativeRect.fromLTRB(
        details.globalPosition.dx,
        details.globalPosition.dy,
        details.globalPosition.dx,
        details.globalPosition.dy,
      ), items: [
      PopupMenuItem<String>(
        mouseCursor: SystemMouseCursors.click,

        padding: EdgeInsets.zero,

          child: ListTile(
            minLeadingWidth : 10,
            leading:SvgPicture.asset(Images.deleteGreyIcon), // your icon
            title: Text("Delete"),
          ), value: '1'),
      PopupMenuItem<String>(
          mouseCursor:MouseCursor.uncontrolled,

          padding: EdgeInsets.zero,
          child: ListTile(
            minLeadingWidth : 10,
            leading: SvgPicture.asset(Images.editIcon), // your icon
            title: Text("Rename"),
          ), value: '2'),

    ],
      elevation: 3.0,).then((value) {
      if (value == null) return;
      if(value == "1"){

       }else if(value == "2"){
      
      }

    });
    

  }

2

Answers


  1. Chosen as BEST ANSWER

    LisTile provides mouse cursor property. so add like below,

     ListTile(
                  mouseCursor: SystemMouseCursors.click,
                  minLeadingWidth : 10
                  leading:SvgPicture.asset(Images.deleteGreyIcon), 
                  title: Text("Delete"),
                ),
    

  2. Wrap the ListTile with MouseRegion:

    MouseRegion(
          cursor: SystemMouseCursors.click,
          child: ListTile(...),
              ),
    
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search