Home > Enterprise >  Change cursor to Hand icon when hover over the menu item in popup
Change cursor to Hand icon when hover over the menu item in popup

Time:12-07

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"){
      
      }

    });
    

  }

CodePudding user response:

Wrap the ListTile with MouseRegion:

MouseRegion(
      cursor: SystemMouseCursors.click,
      child: ListTile(...),
          ),

CodePudding user response:

LisTile provides mouse cursor property. so add like below,

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