addCustomWatermark method
添加自定义水印。将widget
覆盖在所有视图的最上层
Implementation
void addCustomWatermark(BuildContext context, Widget widget) {
if (_overlayEntry != null) {
_overlayEntry!.remove();
}
OverlayState? overlayState = Overlay.of(context);
_overlayEntry = OverlayEntry(
builder: (context) => IgnorePointer(//忽略自定义水印的点击事件
child: widget,
),
);
overlayState?.insert(_overlayEntry!);
}