flutter 鼠标放上去变成手指

2020-02-16  本文已影响0人  你妹妹的灵魂

导包:
https://pub.dev/packages/universal_html

import 'package:flutter/gestures.dart';
import 'package:flutter/widgets.dart';
import 'package:universal_html/html.dart' as html;

class HoverAware extends Listener {
  static final bodyContainer =
      html.window.document.getElementById('body-container');

  HoverAware({Widget child})
      : super(
          onPointerHover: (PointerHoverEvent evt) {
            bodyContainer.style.cursor = 'pointer';
          },
          onPointerExit: (PointerExitEvent evt) {
            bodyContainer.style.cursor = 'default';
          },
          child: child,
        );
}
上一篇下一篇

猜你喜欢

热点阅读