showDebugBtn method

void showDebugBtn({
  1. double? top,
  2. double? bottom,
  3. double? left,
  4. double? rigth,
  5. double? width,
  6. double? height,
})

显示全局调试按钮,双击隐藏按钮

left, top, bottom, rigth 可自定义按钮浮动显示的位置

width 定义按钮的高度

height 定义按钮的宽度

Implementation

void showDebugBtn({
  double? top,
  double? bottom,
  double? left,
  double? rigth,
  double? width,
  double? height,
}) {
  try {
    if (!_judegInit()) return;
    // ignore: unnecessary_null_comparison
    if (Overlay.of(_context) == null) {
      throw Exception(
          '${JhConstants.ERROR_TIPS_PREFIX}init方法中的context参数非法,请不要在MaterialApp组件中init初始化');
    }
    if (_overlayCode != null) return;

    _overlayEntry = new OverlayEntry(
      builder: (context) {
        return StackPosBtn(
          width: width,
          height: height,
          top: top,
          bottom: bottom,
          left: left,
          rigth: rigth,
        );
      },
    );

    Overlay.of(_context).insert(_overlayEntry);
    _overlayCode = _overlayEntry.hashCode;
  } catch (e) {
    throw Exception(
        '${JhConstants.ERROR_TIPS_PREFIX}showDebugBtn方法,只能在调用jhDebug.init方法页面中使用');
  }
}