Flutter-Web: Mouse hover -> Change cursor to pointer

前端 未结 8 1560
走了就别回头了
走了就别回头了 2021-02-05 06:59

How can the cursor appearance be changed within Flutter? I know that with the Listener() Widget we can listen for Mouse-Events, but I haven\'t found any information regarding h

8条回答
  •  耶瑟儿~
    2021-02-05 07:25

    You can use an InkWell that has an onHover event

    InkWell(
        onTap: () {},
        onHover: (value) {
          setState(() {
            isHovered = value;
          });
        },
        child: Container(
          width: 50,
          height: 72,
          color: Colors.black   
        )
    );
    

    Make sure to have something onTap, even an empty function, else it is considered to be disabled, and the hover won't work

提交回复
热议问题