applyOverlayMode function
Future<void>
applyOverlayMode(
- OverlayMode mode, {
- double blurRadius = 30.0,
- int color = 0xFF000000,
Applies the given mode using the idempotent NoScreenshot API.
nonere-enables screenshots (no protection).secureblocks screenshots and screen recording.blurshows a blur overlay in the app switcher.colorshows a solid color overlay in the app switcher.imageshows a custom image overlay in the app switcher.
Implementation
Future<void> applyOverlayMode(
OverlayMode mode, {
double blurRadius = 30.0,
int color = 0xFF000000,
}) async {
final noScreenshot = NoScreenshot.instance;
switch (mode) {
case OverlayMode.none:
await noScreenshot.screenshotOn();
case OverlayMode.secure:
await noScreenshot.screenshotOff();
case OverlayMode.blur:
await noScreenshot.screenshotWithBlur(blurRadius: blurRadius);
case OverlayMode.color:
await noScreenshot.screenshotWithColor(color: color);
case OverlayMode.image:
await noScreenshot.screenshotWithImage();
}
}