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

前端 未结 8 1471
走了就别回头了
走了就别回头了 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:23

    final appContainer 
         = html.document.getElementsByTagName('body')[0] as html.Element;
    
                GestureDetector(
                            child: MouseRegion(
                              child: Text(
                                'https://github.com/yumi0629',
                                style: textStyle,
                              ),
                              onHover: (_) => appContainer.style.cursor = 'pointer',
                              onExit: (_) => appContainer.style.cursor = 'default',
                            ),
                            onTap: () {
                              print('open');
                              js.context.callMethod(
                                  'open', ['https://github.com/yumi0629']);
                            },
                          )
    

提交回复
热议问题